Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
commit 5ac92b49610beab6fc3063211153bd8f37f93a37 2 parents aadf654 + 523c89e
Wesley Workman authored
Showing with 174 additions and 304 deletions.
  1. +44 −0 CHANGELOG
  2. +20 −20 README.rdoc
  3. +3 −3 VERSION.yml
  4. +1 −1  lib/Buildfile
  5. +1 −1  lib/frameworks/sproutcore
  6. +17 −4 lib/gen/app/USAGE
  7. +0 −36 lib/gen/html_app/Buildfile
  8. +0 −1  lib/gen/html_app/README
  9. +0 −15 lib/gen/html_app/USAGE
  10. +0 −11 lib/gen/html_app/templates/apps/@target_name@/@target_name@.js
  11. 0  lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep
  12. +0 −6 lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css
  13. +0 −1  lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars
  14. +0 −45 lib/gen/html_project/Buildfile
  15. +0 −3  lib/gen/html_project/INIT
  16. +0 −1  lib/gen/html_project/README
  17. +0 −2  lib/gen/html_project/USAGE
  18. +0 −5 lib/gen/html_project/templates/@filename@/Buildfile
  19. +0 −4 lib/gen/html_project/templates/@filename@/README
  20. +4 −4 lib/gen/language/Buildfile
  21. +4 −4 lib/gen/language/USAGE
  22. +12 −4 lib/gen/statechart_app/USAGE
  23. +0 −45 lib/gen/statechart_project/Buildfile
  24. +0 −7 lib/gen/statechart_project/INIT
  25. +0 −1  lib/gen/statechart_project/README
  26. +0 −2  lib/gen/statechart_project/USAGE
  27. +0 −9 lib/gen/statechart_project/templates/@filename@/Buildfile
  28. +0 −3  lib/gen/statechart_project/templates/@filename@/README
  29. +1 −1  lib/sproutcore/helpers/html5_manifest.rb
  30. +25 −9 lib/sproutcore/rack/proxy.rb
  31. +18 −25 lib/sproutcore/tools.rb
  32. +10 −3 lib/sproutcore/tools/gen.rb
  33. +12 −26 lib/sproutcore/tools/init.rb
  34. +2 −2 sproutcore.gemspec
View
44 CHANGELOG
@@ -1,3 +1,47 @@
+*SproutCore 1.8.0 (March 06, 2012)*
+
+* Bumped the gem version to 1.8.0
+* Bumped SC to REL-1.8.0
+* Merge pull request #84 from pulletsforever/dwk/manifest.appcache
+* Merge pull request #74 from dkduck/redirect-fix
+* Figuring out how to use the language generator properly was hard to decipher, so I made the first argument the target app and the second argument the language. If no target app is given, it falls back to the default behaviour, which requires a target.
+* Fixed documentation of app and statechart_app generators.
+* Removed the statechart_project generator. It was identical to the project generator.
+* Bumped version to 1.8.0 and bumped SC framework to latest.
+* Add --statechart switch support when using sc-gen app or sc-gen project (not that it has an effect with sc-gen project, but someday it may).
+* Removed templates for html_app.
+* Removed deprecated options and removed --template which doesn't create a skeleton useful for a 1.8 project.
+* Fixed --dry-run option to work for sc-init and sc-gen.
+* Updated app.manifest to be manifest.appcache per http://html5.org/r/5812
+* Merge pull request #81 from sproutcore/team/workmanw/windows-spriting-fix
+* Bumped SC version.
+* The :mini framework (which was empty) has been removed from SproutCore for 1.8.
+* Added check before writing chance stuff to a file. If it's writing a png file it will be written as binary. This fixes spriting on Windows, previously newlines were converted to CRLF on Windows.
+* Merge pull request #79 from sproutcore/team/workmanw/sc-init-template-buildfile-fix
+* Updated abbot's Buildfile templates to reflect the changes made to sproutcore/master regarding moving the template system out of 'core_foundation' and into it's own framework 'template_view'.
+* This only returned the lines that matched and removed those that didn't.
+* Merge public branch
+* Merge pull request #76 from ChadEubanks/master
+* fixed a typo in description.
+* updated init.rb to call a statechart_project upon creation of an app using the --statechart switch and included a description of the inital files created in the statechart_project INIT file.
+* fixed indentation of the statechart.js file.
+* moved statechart.js to root of app directory, set up the statechart with just an initial ready state, and revised the property readyState to have proper casing.
+* updated statecharts switch to be --statechart and revised the generated code for statechart_app.
+* Modified abbot to have a state switch on sc-init. This builds a new sproutcore project with statecharts by default.
+* Modified abbot to have a state switch on sc-init. This builds a new sproutcore project with statecharts by default.
+* updated sc-init to include statecharts out of the box.
+* Merging public branch
+* Bumping js library submodule
+* Preprocess JSON files for static_urrl
+* Instead of overriding "readlines" everywhere, add a new "read" method and use that instead...
+* fixes a bug with automatically following redirects to external hosts
+* Typo. The proper setting is : connect_timeout
+* em-http changed the single :timeout setting to separate :inactivity_timeout and :connection_timeout settings, so this exposes these timeouts to the proxy config. Note, this still works with current Buildfiles since proxy[:timeout] is mapped over to :inactivity_timeout of em-http.
+* More complete fix for #69, thanks rykov!
+* Ruby 1.8 only allows splats for the last argument - Fixes #69
+* Updated StaticHelper to include the image_urls_for_client function
+* Typo prevented skipping of `top-right`
+
*SproutCore 1.7.1.beta (August 30, 2011)*
MINOR FEATURES
View
40 README.rdoc
@@ -6,38 +6,38 @@
== DESCRIPTION:
-SproutCore is a platform for building native look-and-feel applications on
-the web. This Ruby library includes a copy of the SproutCore JavaScript
+SproutCore is a platform for building native look-and-feel applications on
+the web. This Ruby library includes a copy of the SproutCore JavaScript
framework as well as a Ruby-based build system called Abbot.
-Abbot is a build system for creating static web content. You can supply Abbot with a collection of JavaScript, HTML, CSS and image files and it will
-combine the files into a bundle that are optimized for efficient, cached
+Abbot is a build system for creating static web content. You can supply Abbot with a collection of JavaScript, HTML, CSS and image files and it will
+combine the files into a bundle that are optimized for efficient, cached
deliver directly from your server or using a CDN.
-Some of the benefits of using Abbot versus assembling your own content
+Some of the benefits of using Abbot versus assembling your own content
include:
- * Easy maintenance. Organize your source content in a way that is useful for
+ * Easy maintenance. Organize your source content in a way that is useful for
you without impacting performance on loaded apps.
-
+
* Automatically versioned URLs. Serve content with long expiration dates
while Abbot handles the cache invalidation for you.
-
+
* Dependency management. Divide your code into frameworks; load 3rd party
libraries. Abbot will make sure everything loads in the correct order.
-
+
* Packing. Combines JavaScript and CSS into single files to minimize the
number of resources you download for each page.
-
-Although Abbot is intended primarily for building Web applications that
+
+Although Abbot is intended primarily for building Web applications that
use the SproutCore JavaScript framework, you can also use it to efficiently build any kind of static web content, even if SproutCore is not involved.
-Abbot can be used both directly from the command line or as a ruby library.
-
+Abbot can be used both directly from the command line or as a ruby library.
+
== USING ABBOT WITH SPROUTCORE:
This gem includes both the Abbot build tools and a copy of the SproutCore
-JavaScript framework. You can use built-in commands to create, develop,
+JavaScript framework. You can use built-in commands to create, develop,
build, and deploy SproutCore-based applications.
== USING ABBOT FROM SOURCE:
@@ -68,32 +68,32 @@ These steps will allow the use of a development release of abbot rather than an
== KNOWN LIMITATIONS:
* Currently does not support sites using relative-links. You must specify
- the absolute path you expect built targets to be hosted as.
+ the absolute path you expect built targets to be hosted as.
== SYNOPSIS:
To create a new project:
sc-init my_app
-
+
To test said project:
cd my_app
sc-server
open http://localhost:4020/my_app (in web browser)
-
+
Write code, refresh, debug. Once you are ready to deploy, build your static
output using:
cd my_app
sc-build my_app -rc
-
+
Copy the resulting files found in my_app/tmp/build to your server and you are
deployed!
== REQUIREMENTS:
-* Ruby 1.8.6 or later. Ruby 1.9 is currently untested
+* Ruby 1.8.6 or later.
* extlib 0.9.9 or later
* rack 0.9.1 or later
* erubis 2.6.2 or later
@@ -105,7 +105,7 @@ sudo gem install sproutcore
== LICENSE:
-Copyright (c) 2009 Apple Inc.
+Copyright (c) 2009 Apple Inc.
Portions copyright (c) 2006-2011 Strobe Inc. and contributors
Permission is hereby granted, free of charge, to any person obtaining
View
6 VERSION.yml
@@ -1,4 +1,4 @@
----
+---
:major: 1
-:minor: 7
-:patch: 1.beta
+:minor: 8
+:patch: 1
View
2  lib/Buildfile
@@ -117,7 +117,7 @@ mode :all do
# A hash of additional MIME types, i.e. { '.m4a' => 'audio/mp4a-latm' }
:mime_types => {},
- # Whether to generate an app.manifest file for HTML5 application caching
+ # Whether to generate an manifest.appcache file for HTML5 application caching
:html5_manifest => false,
# Which networks/URLs to allow if HTML5 application caching is turned on
:html5_manifest_networks => [],
2  lib/frameworks/sproutcore
@@ -1 +1 @@
-Subproject commit 97e12c7b0c1dc3d992eb95ca1a96c4a0d343915a
+Subproject commit 83dfd47662221cf1e84b7d6af8a34faec0eeaaa3
View
21 lib/gen/app/USAGE
@@ -2,12 +2,25 @@ app - Create a new SproutCore application target.
USAGE:
- sc-gen app AppName [--filename=FILENAME] [--target=TARGET_NAME]
+ sc-gen app AppName [--filename=FILENAME] [--target=TARGET_NAME] [--statechart]
DISCUSSION:
-This generator will create a new SproutCore application for a particular project. You should pass as the first parameter your AppName you want to create. For example:
+This generator will create a new SproutCore application for a particular
+project. You should pass as the first parameter your AppName you want to
+create. For example:
-sc-gen app Todos
+ sc-gen app Todos
-defines a new application called Todos in the file apps/todos/ .
+This defines a new application called Todos in the file apps/todos/ . Or you
+can include a basic statechart for example:
+
+ sc-gen app Todos --statechart
+
+This defines a new application called Todos in the file apps/todos/ using
+statecharts. Within the apps/Todos/resources directory you will have a
+statechart.js file and a states directory with the ready_state.js file. The
+statechart.js file sets the initial state of your app to ready.
+
+As your app grows. You will create new states within the statechart.js file.
+In your states folder you will describe the states declared in the statechart.js.
View
36 lib/gen/html_app/Buildfile
@@ -1,36 +0,0 @@
-# ==========================================================================
-# Generator: APP
-# Copyright: ©2006-2011 Strobe Inc. and contributors
-# portions copyright ©2009 Apple Inc.
-# ==========================================================================
-
-namespace :generator do
-
- # Require a project then make sure the build root is always the project
- # root.
- task :prepare do
- GENERATOR.requires! :target_project
-
- # if the target name has a slash in it, then we are trying to create a
- # nested target. extract the final part (since this is the target name)
- # and then set the build root to the parent target.
- if GENERATOR.target_name && GENERATOR.target_name =~ /\//
- parent_target_name = GENERATOR.target_name.split('/')
- GENERATOR.target_name = parent_target_name.pop
-
- parent_target_name = parent_target_name * "/"
- project = GENERATOR.target_project
-
- GENERATOR.parent_target_name = parent_target_name
- GENERATOR.parent_target = project.target_for(parent_target_name)
- GENERATOR.requires! :parent_target, :parent_target_name
-
- GENERATOR.build_root = GENERATOR.parent_target.source_root
-
- # otherwise just use project_root
- else
- GENERATOR.build_root = GENERATOR.target_project.project_root
- end
- end
-
-end
View
1  lib/gen/html_app/README
@@ -1 +0,0 @@
-Your application target is now ready to use!
View
15 lib/gen/html_app/USAGE
@@ -1,15 +0,0 @@
-html_app - Create a new HTML-based SproutCore application target.
-
-USAGE:
-
- sc-gen html_app AppName [--filename=FILENAME] [--target=TARGET_NAME]
-
-DISCUSSION:
-
-This generator will create a new SproutCore application for a particular project. You should pass as the first parameter your AppName you want to create. For example:
-
-sc-gen app Todos
-
-defines a new application called Todos in the file apps/todos/.
-
-Your application will be setup for using Handlebars to describe the view layer.
View
11 lib/gen/html_app/templates/apps/@target_name@/@target_name@.js
@@ -1,11 +0,0 @@
-<%= copyright_block(namespace) %>
-/*globals <%= namespace %> */
-
-<%= namespace %> = SC.Application.create();
-
-SC.ready(function() {
- <%= namespace %>.mainPane = SC.TemplatePane.append({
- layerId: '<%= target_name %>',
- templateName: '<%= target_name %>'
- });
-});
View
0  lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep
No changes.
View
6 lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css
@@ -1,6 +0,0 @@
-<%= copyright_block(namespace, :css) %>
-
-.sc-view {
- position: relative;
- overflow: visible;
-}
View
1  lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars
@@ -1 +0,0 @@
-<h1>Welcome to SproutCore!</h1>
View
45 lib/gen/html_project/Buildfile
@@ -1,45 +0,0 @@
-# ==========================================================================
-# Generator: PROJECT
-# Copyright: ©2006-2011 Strobe Inc. and contributors
-# portions copyright ©2009 Apple Inc.
-# ==========================================================================
-
-namespace :generator do
-
- # Accept the following types of arguments:
- #
- # project . #=> Make current working directory. like sc-init
- # project project_name #=> Create project_name, namespace: ProjectName
- # project ProjectName #=> Create project_name, namespace: ProjectName
- # project NameSpace path/to/project #=> Create path/to/project, NameSpace
- #
- task :prepare do
- # get arguments & normalize
- gen = GENERATOR
- namespace = gen.arguments[1]
- project_path = gen.arguments[2]
-
- if project_path
- project_path = File.expand_path(project_path)
- namespace = File.basename(project_path) if namespace == '.'
- elsif namespace == '.'
- project_path = Dir.pwd
- namespace = File.basename(project_path)
- else
- project_path = Dir.pwd / gen.snake_case(namespace)
- end
-
- # Setup standard options for generating a project
- gen.target_name = gen.target = gen.method_name = gen.class_name = nil
- gen.build_root = File.dirname(project_path) # dir where project dir lives
- gen.filename = File.basename(project_path) # project dir name
- gen.namespace = gen.camel_case namespace
- end
-
-end
-
-# default behavior for a template is to just copy the contents of the
-# templates directory to the end destination. Add any additional configs here.
-config :templates,
- :root_dir => '_file_path_'
-
View
3  lib/gen/html_project/INIT
@@ -1,3 +0,0 @@
-Your new SproutCore project is ready!
-
-To get started, you can find your initial application in the "apps" directory.
View
1  lib/gen/html_project/README
@@ -1 +0,0 @@
-Your project is now ready to use!
View
2  lib/gen/html_project/USAGE
@@ -1,2 +0,0 @@
-Usage:
- sc-gen project project_name
View
5 lib/gen/html_project/templates/@filename@/Buildfile
@@ -1,5 +0,0 @@
-<%= copyright_block(namespace, :ruby) %>
-
-# Add initial buildfile information here
-config :all, :required => "sproutcore/template_view", :theme => "sproutcore/empty_theme"
-
View
4 lib/gen/html_project/templates/@filename@/README
@@ -1,4 +0,0 @@
-<%= copyright_block(namespace, false) %>
-
-TODO: Describe Your Project
-
View
8 lib/gen/language/Buildfile
@@ -6,21 +6,21 @@
namespace :generator do
- # First argument must be the namespace. Second argument should be the
+ # First argument must be the namespace. Second argument should be the
# language we want to add. Generate a filename (foo.lproj) and language
# name.
task :prepare do
long_languages = %w(english french german italian spanish japanese)
- if language = GENERATOR.arguments[1]
+ if language = GENERATOR.arguments[2] || GENERATOR.arguments[1]
if long_languages.include?(language.downcase)
GENERATOR.language = language.downcase.capitalize
GENERATOR.filename = language.downcase + '.lproj'
else
- GENERATOR.language = language.gsub('_', '-')
+ GENERATOR.language = language.gsub('_', '-')
GENERATOR.filename = language.gsub('-', '_') + '.lproj'
end
end
GENERATOR.requires! :target_project, :target, :language, :filename
end
-
+
end
View
8 lib/gen/language/USAGE
@@ -2,12 +2,12 @@ language - Create a new language for a SproutCore application.
USAGE:
- sc-gen language LanguageName [--target=TARGET_NAME]
+ sc-gen language AppName LanguageName [--target=TARGET_NAME]
DISCUSSION:
-This generator will create a new language for a particular application. Please make sure you are in the specific application directory first, or specify one with the target parameter. You should pass as the first parameter the LanguageName you want to create. For example:
+This generator will create a new language for a particular application. For example:
-sc-gen language Norwegian
+sc-gen language MyApp Norwegian
-defines a new language in your current application in the directory norwegian.lproj .
+defines a new language in the MyApp application in the directory norwegian.lproj .
View
16 lib/gen/statechart_app/USAGE
@@ -2,12 +2,20 @@ statechart_app - Create a new SproutCore application target using statecharts.
USAGE:
- sc-gen app AppName [--filename=FILENAME] [--target=TARGET_NAME]
+ sc-gen statechart_app AppName [--filename=FILENAME] [--target=TARGET_NAME]
DISCUSSION:
-This generator will create a new SproutCore application with statecharts by default for a particular project. You should pass as the first parameter your AppName you want to create followed by the --statechart switch. For example:
+This generator will create a new SproutCore application with statecharts by
+default for a particular project. You should pass as the first parameter your
+AppName you want to create. For example:
-sc-gen app Todos --statechart
+ sc-gen statechart_app Todos
-This defines a new application called Todos in the file apps/todos/. Within the apps/Todos/resources directory you will have a statechart.js file and a states directory with the ready_state.js file. The statechart.js file sets the initial state of your app to ready. As your app grows. You will create new states within the statechart.js file. In your states folder you will describe the states declared in the statechart.js.
+This defines a new application called Todos in the file apps/todos/ using
+statecharts. Within the apps/Todos/resources directory you will have a
+statechart.js file and a states directory with the ready_state.js file. The
+statechart.js file sets the initial state of your app to ready.
+
+As your app grows. You will create new states within the statechart.js file.
+In your states folder you will describe the states declared in the statechart.js.
View
45 lib/gen/statechart_project/Buildfile
@@ -1,45 +0,0 @@
-# ==========================================================================
-# Generator: PROJECT
-# Copyright: ©2006-2011 Strobe Inc. and contributors
-# portions copyright ©2009 Apple Inc.
-# ==========================================================================
-
-namespace :generator do
-
- # Accept the following types of arguments:
- #
- # project . #=> Make current working directory. like sc-init
- # project project_name #=> Create project_name, namespace: ProjectName
- # project ProjectName #=> Create project_name, namespace: ProjectName
- # project NameSpace path/to/project #=> Create path/to/project, NameSpace
- #
- task :prepare do
- # get arguments & normalize
- gen = GENERATOR
- namespace = gen.arguments[1]
- project_path = gen.arguments[2]
-
- if project_path
- project_path = File.expand_path(project_path)
- namespace = File.basename(project_path) if namespace == '.'
- elsif namespace == '.'
- project_path = Dir.pwd
- namespace = File.basename(project_path)
- else
- project_path = Dir.pwd / gen.snake_case(namespace)
- end
-
- # Setup standard options for generating a project
- gen.target_name = gen.target = gen.method_name = gen.class_name = nil
- gen.build_root = File.dirname(project_path) # dir where project dir lives
- gen.filename = File.basename(project_path) # project dir name
- gen.namespace = gen.camel_case namespace
- end
-
-end
-
-# default behavior for a template is to just copy the contents of the
-# templates directory to the end destination. Add any additional configs here.
-config :templates,
- :root_dir => '_file_path_'
-
View
7 lib/gen/statechart_project/INIT
@@ -1,7 +0,0 @@
-Your new SproutCore project with StateCharts is ready!
-
-To get started, you can find your initial application in the "apps" directory.
-
-Within the apps/appname directory you will have a statechart.js file and a states directory with the ready_state.js file.
-
-The statechart.js file sets the initial state of your app to ready. And as your app grows. You will create new states within the statechart.js file. In your states folder you will describe the states declared in the statechart.js.
View
1  lib/gen/statechart_project/README
@@ -1 +0,0 @@
-Your project is now ready to use!
View
2  lib/gen/statechart_project/USAGE
@@ -1,2 +0,0 @@
-Usage:
- sc-gen project project_name
View
9 lib/gen/statechart_project/templates/@filename@/Buildfile
@@ -1,9 +0,0 @@
-<%= copyright_block(namespace, :ruby) %>
-
-# This is your Buildfile, which sets build settings for your project.
-# For example, this tells SproutCore's build tools that EVERYTHING
-# requires the SproutCore framework.
-config :all, :required => :sproutcore
-
-# In addition to this Buildfile, which gives settings for your entire project,
-# each of your apps has its own Buildfile with settings specific to that app.
View
3  lib/gen/statechart_project/templates/@filename@/README
@@ -1,3 +0,0 @@
-<%= copyright_block(namespace, false) %>
-
-TODO: Describe Your Project
View
2  lib/sproutcore/helpers/html5_manifest.rb
@@ -29,7 +29,7 @@ def build(dst_path)
@files << "\n"
end
- manifest_path = dst_path.sub('index.html', '') + 'app.manifest'
+ manifest_path = dst_path.sub('index.html', '') + 'manifest.appcache'
writelines manifest_path, @files
end
View
34 lib/sproutcore/rack/proxy.rb
@@ -66,6 +66,18 @@ def chunked?
end
+ # clears host field from request header if it's redirected request
+ class RedirectHostHeaderKiller
+
+ def response(r)
+ if r.redirect?
+ puts r.req.headers
+ r.req.headers.delete('Host')
+ end
+ end
+
+ end
+
# Rack application proxies requests as needed for the given project.
class Proxy
@@ -127,26 +139,30 @@ def handle_proxy(proxy, proxy_url, env)
req_body = req_body.read
end
+ # Options for the connection
+ connect_options = {}
+ if proxy[:inactivity_timeout] # allow the more verbose setting to take precedence
+ connect_options[:inactivity_timeout] = proxy[:inactivity_timeout]
+ elsif proxy[:timeout] # check the legacy and simpler setting
+ connect_options[:inactivity_timeout] = proxy[:timeout]
+ end
+ connect_options[:connect_timeout] = proxy[:connect_timeout] if proxy[:connect_timeout]
+
# Options for the request
request_options = {}
request_options[:head] = headers
request_options[:body] = req_body if !!req_body
- if proxy[:inactivity_timeout] # allow the more verbose setting to take precedence
- request_options[:inactivity_timeout] = proxy[:inactivity_timeout]
- elsif proxy[:timeout] # check the legacy and simpler setting
- request_options[:inactivity_timeout] = proxy[:timeout]
- end
- request_options[:connect_timeout] = proxy[:connect_timeout] if proxy[:connect_timeout]
- request_options[:redirects] = 10 if proxy[:redirect] != false
+ request_options[:redirects] = 5 if proxy[:redirect] != false
request_options[:decoding] = false # don't decode gzipped content
EventMachine.run {
body = nil
- conn = EM::HttpRequest.new(url)
+ conn = EM::HttpRequest.new(url, connect_options)
chunked = false
headers = {}
method = env['REQUEST_METHOD'].upcase
status = 0
+ conn.use RedirectHostHeaderKiller
case method
when 'GET'
@@ -333,4 +349,4 @@ def strip_domain(cookie)
end
end
-end
+end
View
43 lib/sproutcore/tools.rb
@@ -38,20 +38,13 @@ def self.invoke(task_name)
class_option "build", :type => :string, :aliases => "-b"
class_option "build-targets",:type => :string,
:desc => "Targets to build (excluding their dependencies)"
-
- class_option "yui-minification", :type => :boolean,
- :desc => "Deprecated. Does nothing."
-
+
class_option "dont-minify", :type => :boolean,
:desc => "Disables minification for the build."
-
+
class_option "verbose", :type => :boolean, :aliases => "-v"
class_option "very-verbose", :type => :boolean, :aliases => "-V"
-
- class_option "library", :type => :string, #deprecated
- :desc => "Deprecated."
- class_option "environment", :type => :string, #deprecated
- :desc => "Deprecated."
+
class_option "help", :type => :boolean
default_task :banner
@@ -140,7 +133,7 @@ def prepare_mode!(preferred_mode = 'production')
build_mode = (options[:mode] || options[:environment] || preferred_mode).to_s.downcase.to_sym
SC.build_mode = build_mode
end
-
+
def prepare_app!
if options[:'build-targets']
SC.env[:build_targets] = options[:'build-targets'].split(',')
@@ -148,7 +141,7 @@ def prepare_app!
SC.env[:build_targets] = ''
end
end
-
+
def dont_minify!
SC.env[:dont_minify] = options[:'dont-minify']
end
@@ -247,7 +240,7 @@ def find_targets(*targets)
# Filter out any empty target names. Sometimes this happens when
# processing arguments.
-
+
targets.reject! { |x| x.nil? || x.size == 0}
# If targets are specified, find the targets project or parents...
@@ -279,8 +272,8 @@ def find_targets(*targets)
appnames = SC.env[:build_targets]
- # if it has the appname argument only build the target with the appname
- if appnames.size > 0
+ # if it has the appname argument only build the target with the appname
+ if appnames.size > 0
tar = []
targets.each do |target|
appnames.each do |appname|
@@ -346,36 +339,36 @@ def find_build_numbers(*targets)
SC.logger.info "Using build numbers: #{numbers.map { |k,v| "#{k}: #{v}" }.join(',')}"
end
end
-
+
def each_manifest_for_targets(*targets)
# setup build numbers
find_build_numbers(*targets)
requires_project! # get project
-
+
targets = find_targets(*targets) # get targets
# log output
SC.logger.info "Building targets: #{targets.map { |t| t.target_name } * ","}"
-
+
languages = find_languages(*targets) # get languages
SC.logger.info "Building languages: #{ languages * "," }"
-
+
index = 1
count = targets.length * languages.length
SC.logger.info "Total target/language combinations to build: #{count}"
-
+
targets.each {|target|
languages.each {|l|
manifest = target.manifest_for :language => l
SC.logger.info "Creating manifest #{index} of #{count} for: #{manifest.target.target_name}:#{manifest.language}"
-
+
yield manifest
-
+
index += 1
}
}
-
+
end
# Core method to process command line options and then build a manifest.
@@ -384,11 +377,11 @@ def build_manifests(*targets)
# Build'em
each_manifest_for_targets(*targets) do |manifest|
manifest.build!
-
+
yield manifest
end
end
-
+
# Loops over all of the manifest's entries and builds all essential entries.
# Entries such as javascript.js are considered non-essential because they will
# not actually be used in a fully built app (except for modules).
View
13 lib/sproutcore/tools/gen.rb
@@ -54,7 +54,8 @@ def show_help(generator_name=nil, generator=nil)
:filename => :string,
:target => :string,
'--dry-run' => false,
- :force => false)
+ :force => false,
+ :statechart => false)
def gen(*arguments)
return show_help if arguments.empty?
@@ -62,14 +63,20 @@ def gen(*arguments)
# backwards compatibility case: client is a synonym for 'app'
name = arguments[0]=='client' ? 'app' : arguments[0]
+ # The --statechart switch uses a different app or project generator
+ if name == 'app' && options[:statechart]
+ name = 'statechart_app'
+ end
+
# Load generator
generator_project = self.project || SC.builtin_project
generator = generator_project.generator_for name,
:arguments => arguments,
:filename => options[:filename],
:target_name => options[:target],
- :dry_run => options['dry-run'],
- :force => options[:force]
+ :dry_run => options[:"dry-run"],
+ :force => options[:force],
+ :statechart => options[:statechart]
# if no generator could be found, or if we just asked to show help,
# just return the help...
View
38 lib/sproutcore/tools/init.rb
@@ -10,47 +10,33 @@ class Tools
desc "init PROJECT [APP]",
"Generates a SproutCore project with an initial application"
- method_options('--dry-run' => false, :force => false, '--template' => false, '--statechart' => false)
+ method_options('--dry-run' => false, :force => false, '--statechart' => false)
def init(project_name, app_name=nil)
-
- if project_type = options[:template]
- project_type = options[:template] ? 'html_project' : 'project'
- elsif project_type = options[:statechart]
- project_type = options[:statechart] ? 'statechart_project' : 'project'
- else project_type = options[:dry_run]
- project_type = options[:dry_run] ? 'project' : 'project'
- end
-
# Generate the project
- project_gen = SC.builtin_project.generator_for project_type,
+ project_gen = SC.builtin_project.generator_for 'project',
:arguments => ['project', project_name],
- :dry_run => options['dry-run'],
+ :dry_run => options[:"dry-run"],
:force => options[:force]
-
+
project_gen.prepare!.build!
-
+
# Next, get the project root & app name
project_root = project_gen.build_root / project_gen.filename
app_name = project_gen.filename if app_name.nil?
-
+
# And get the app generator and run it
project = SC::Project.load project_root, :parent => SC.builtin_project
-
- if project_type = options[:template]
- app_type = options[:template] ? 'html_app' : 'app'
- elsif project_type = options[:statechart]
- app_type = options[:statechart] ? 'statechart_app' : 'app'
- else project_type = options[:dry_run]
- app_type = options[:dry_run] ? 'app' : 'app'
- end
-
+
+ # Use the statechart_app generator if --statechart is provided
+ app_type = options[:statechart] ? 'statechart_app' : 'app'
+
generator = project.generator_for app_type,
:arguments => ['app', app_name],
- :dry_run => options['dry-run'],
+ :dry_run => options[:"dry-run"],
:force => options[:force]
generator.prepare!.build!
-
+
project_gen.log_file(project_gen.source_root / 'INIT')
return 0
end
View
4 sproutcore.gemspec
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency 'compass', '~> 0.11.3'
s.add_dependency 'chunky_png', '~> 1.2.0'
- s.add_dependency 'em-http-request', '~> 1.0.0.beta'
+ s.add_dependency 'em-http-request', '~> 1.0'
if is_jruby
s.add_dependency 'mongrel', '~> 1.1.5'
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'less', "~> 1.2.21"
s.add_development_dependency 'RedCloth', "~> 4.2.3"
s.add_development_dependency 'BlueCloth', "~> 1.0.1"
-
+
s.require_paths << 'lib'
s.require_paths << 'vendor/chance/lib'
Please sign in to comment.
Something went wrong with that request. Please try again.