sproutcore 1.6.0.1-java → 1.7.1.beta-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/CHANGELOG +21 -0
  2. data/Gemfile +5 -0
  3. data/Rakefile +26 -13
  4. data/VERSION.yml +2 -2
  5. data/lib/Buildfile +43 -4
  6. data/lib/buildtasks/build.rake +10 -0
  7. data/lib/buildtasks/helpers/file_rule.rb +22 -0
  8. data/lib/buildtasks/helpers/file_rule_list.rb +137 -0
  9. data/lib/buildtasks/manifest.rake +133 -122
  10. data/lib/frameworks/sproutcore/CHANGELOG.md +69 -2
  11. data/lib/frameworks/sproutcore/apps/tests/english.lproj/strings.js +1 -0
  12. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -22
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +9 -5
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +1 -1
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +18 -13
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +5 -3
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +2 -0
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +80 -0
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +84 -116
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +8 -5
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +157 -157
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +5 -3
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +6 -6
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +10 -7
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +106 -0
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +18 -0
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +71 -1
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/attribute_bindings_test.js +38 -0
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js +47 -0
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +18 -18
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +42 -10
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +158 -1
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +26 -1
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +14 -8
  35. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +15 -2
  36. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +108 -108
  37. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1 -1
  38. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +2 -4
  39. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +2 -2
  40. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +26 -0
  41. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +7 -0
  42. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +1 -1
  43. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +4 -1
  44. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +6 -0
  45. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +26 -5
  46. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +97 -96
  47. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -3
  48. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +17 -4
  49. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +7 -7
  50. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +7 -5
  51. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +12 -3
  52. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +23 -14
  53. data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +5 -1
  54. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/render_delegates/menu_scroller.js +28 -0
  55. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/tests/menu/scroll.js +235 -0
  56. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +363 -0
  57. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroller.js +250 -0
  58. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +92 -0
  59. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/native_scroll.js +25 -0
  60. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/scroll.js +33 -0
  61. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/touch_scroller.js +76 -0
  62. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/integration.js +50 -0
  63. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/methods.js +143 -0
  64. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +258 -0
  65. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +1164 -0
  66. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroller.js +332 -0
  67. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +236 -0
  68. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroller.js +347 -0
  69. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +15 -0
  70. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroller.js +10 -0
  71. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +804 -0
  72. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroller.js +133 -0
  73. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +3 -3
  74. data/lib/frameworks/sproutcore/frameworks/foundation/validators/number.js +3 -1
  75. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +3 -3
  76. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +2 -1
  77. data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +2 -1
  78. data/lib/frameworks/sproutcore/frameworks/media/views/media_slider.js +2 -4
  79. data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +2 -4
  80. data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +2 -4
  81. data/lib/frameworks/sproutcore/frameworks/media/views/video.js +2 -2
  82. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +29 -3
  83. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  84. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +1 -1
  85. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -1
  86. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +3 -3
  87. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +2 -2
  88. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +1 -1
  89. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
  90. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/segmented.css +1 -1
  91. data/lib/gen/app/templates/apps/@target_name@/Buildfile +3 -5
  92. data/lib/gen/app/templates/apps/@target_name@/resources/_theme.css +18 -0
  93. data/lib/gen/project/templates/@filename@/Buildfile +2 -2
  94. data/lib/sproutcore.rb +30 -5
  95. data/lib/sproutcore/builders.rb +1 -0
  96. data/lib/sproutcore/builders/chance_file.rb +9 -16
  97. data/lib/sproutcore/builders/html.rb +2 -1
  98. data/lib/sproutcore/builders/minify.rb +4 -35
  99. data/lib/sproutcore/builders/module.rb +38 -1
  100. data/lib/sproutcore/builders/split.rb +63 -0
  101. data/lib/sproutcore/builders/strings.rb +7 -1
  102. data/lib/sproutcore/helpers.rb +1 -1
  103. data/lib/sproutcore/helpers/css_split.rb +190 -0
  104. data/lib/sproutcore/helpers/entry_sorter.rb +2 -0
  105. data/lib/sproutcore/helpers/minifier.rb +40 -16
  106. data/lib/sproutcore/helpers/static_helper.rb +35 -17
  107. data/lib/sproutcore/models/manifest.rb +26 -0
  108. data/lib/sproutcore/models/target.rb +12 -1
  109. data/lib/sproutcore/rack.rb +1 -0
  110. data/lib/sproutcore/rack/proxy.rb +244 -225
  111. data/lib/sproutcore/rack/restrict_ip.rb +67 -0
  112. data/lib/sproutcore/rack/service.rb +8 -2
  113. data/lib/sproutcore/tools.rb +102 -46
  114. data/lib/sproutcore/tools/build.rb +91 -43
  115. data/lib/sproutcore/tools/gen.rb +2 -3
  116. data/lib/sproutcore/tools/manifest.rb +22 -16
  117. data/lib/sproutcore/tools/server.rb +21 -0
  118. data/spec/buildtasks/helpers/accept_list +22 -0
  119. data/spec/buildtasks/helpers/accept_list.rb +128 -0
  120. data/spec/buildtasks/helpers/list.json +11 -0
  121. data/spec/buildtasks/manifest/prepare_build_tasks/chance_2x_spec.rb +1 -39
  122. data/spec/buildtasks/manifest/prepare_build_tasks/chance_spec.rb +0 -38
  123. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +4 -4
  124. data/spec/buildtasks/manifest/prepare_build_tasks/module_spec.rb +2 -2
  125. data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_indirect_spec.rb +7 -16
  126. data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_spec.rb +7 -17
  127. data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +11 -6
  128. data/spec/fixtures/builder_tests/Buildfile +2 -1
  129. data/spec/fixtures/builder_tests/apps/module_test/modules/required_module/core.js +0 -0
  130. data/spec/lib/builders/module_spec.rb +1 -1
  131. data/spec/spec_helper.rb +1 -0
  132. data/sproutcore.gemspec +4 -9
  133. data/vendor/chance/lib/chance.rb +25 -6
  134. data/vendor/chance/lib/chance/factory.rb +45 -0
  135. data/vendor/chance/lib/chance/instance.rb +173 -28
  136. data/vendor/chance/lib/chance/instance/data_url.rb +0 -29
  137. data/vendor/chance/lib/chance/instance/slicing.rb +57 -4
  138. data/vendor/chance/lib/chance/instance/spriting.rb +112 -21
  139. data/vendor/chance/lib/chance/parser.rb +80 -52
  140. data/vendor/sproutcore/SCCompiler.jar +0 -0
  141. data/vendor/sproutcore/lib/args4j-2.0.12.jar +0 -0
  142. data/vendor/sproutcore/lib/yuicompressor-2.4.2.jar +0 -0
  143. metadata +84 -25
data/CHANGELOG CHANGED
@@ -1,3 +1,24 @@
1
+ *SproutCore 1.7.1.beta (August 30, 2011)*
2
+
3
+ MINOR FEATURES
4
+
5
+ * When the file hits the 4096 CSS selectors limit in IE , the tools will split the files.
6
+ * Sprites are now optimized to use space in the most optimal way, to reduce
7
+ memory foot print generated by a lot of extra transparent space.
8
+ * Layout.js will be always first when building the js files , just as strings.js (Layout.js includes loc metrics)
9
+ * Added security feature for dev environment. By default sc-server can only be used from your local machine unless you set a flag.
10
+
11
+ BUG FIXES
12
+
13
+ * Sprites is again the default for abbot after several perf problems with base64 urls across different browsers.
14
+ * Minification is optimized again to minify the index.html.
15
+ * Fixes for whitelist, when the name filenames include the 'html' string.
16
+ * Several bug fixes for speed and reliability of whitelisting.
17
+ * Fixed retina display styling.
18
+ * Fixed --help command line option.
19
+ * Updated abbot gem dependencies.
20
+
21
+
1
22
  *SproutCore 1.6.0 (June 09, 2011)*
2
23
 
3
24
  * Code cleanup + Stream the headers and body directly across the proxy as they arrive, which will work with streaming APIs like Twitter
data/Gemfile CHANGED
@@ -1,3 +1,8 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'packager' if Bundler::VERSION[0,3] == '1.1'
8
+ end
data/Rakefile CHANGED
@@ -66,11 +66,6 @@ end
66
66
 
67
67
  ### RELEASE TASKS ###
68
68
 
69
- rvm_data = `rvm list` rescue nil
70
- rvm_versions = rvm_data ? rvm_data.split("\n")[3..-1].map{|l| l[3..-1].split(" ")[0] } : []
71
- rvm_mri = rvm_versions.select{|v| v =~ /^ruby-/ }[-1]
72
- rvm_jruby = rvm_versions.select{|v| v =~ /^jruby-/ }[-1]
73
-
74
69
  version = SproutCore::VERSION
75
70
 
76
71
  namespace :release do
@@ -85,6 +80,7 @@ namespace :release do
85
80
  chdir File.expand_path('../lib/frameworks/sproutcore', __FILE__)
86
81
  end
87
82
 
83
+ desc "Update framework"
88
84
  task :update do
89
85
  branch = `git describe --contains --all HEAD`
90
86
  puts "Checking out framework branch: #{branch}"
@@ -95,6 +91,7 @@ namespace :release do
95
91
  end
96
92
  end
97
93
 
94
+ desc "Update framework changelog with latest changes"
98
95
  task :changelog => :chdir do
99
96
  last_tag = `git describe --tags --abbrev=0`.strip
100
97
  puts "Getting Changes since #{last_tag}"
@@ -117,6 +114,7 @@ namespace :release do
117
114
  end
118
115
  end
119
116
 
117
+ desc "Update framework version references"
120
118
  task :update_references => :chdir do
121
119
  puts "Updating version references to #{version}"
122
120
 
@@ -127,6 +125,7 @@ namespace :release do
127
125
  pretend? ? puts(cmd) : system(cmd)
128
126
  end
129
127
 
128
+ desc "Commit framework version bump"
130
129
  task :commit => :chdir do
131
130
  puts "Commiting Version Bump"
132
131
  unless pretend?
@@ -136,11 +135,13 @@ namespace :release do
136
135
  end
137
136
  end
138
137
 
138
+ desc "Tag new framework version"
139
139
  task :tag => :chdir do
140
140
  puts "Tagging REL-#{version}"
141
141
  system "git tag REL-#{version}" unless pretend?
142
142
  end
143
143
 
144
+ desc "Push framework to git"
144
145
  task :push => :chdir do
145
146
  puts "Pushing Repo"
146
147
  unless pretend?
@@ -155,7 +156,10 @@ namespace :release do
155
156
  end
156
157
  end
157
158
 
159
+ desc "Prepare for new framework release"
158
160
  task :prepare => [:update, :changelog, :update_references]
161
+
162
+ desc "Commit framework updates and push"
159
163
  task :deploy => [:commit, :tag, :push]
160
164
 
161
165
  end
@@ -166,11 +170,13 @@ namespace :release do
166
170
  chdir File.dirname(__FILE__)
167
171
  end
168
172
 
173
+ desc "Update repo"
169
174
  task :update do
170
175
  puts "Checking updating repo"
171
176
  system "git pull" unless pretend?
172
177
  end
173
178
 
179
+ desc "Update Changelog"
174
180
  task :changelog => :chdir do
175
181
  last_tag = `git describe --tags --abbrev=0`.strip
176
182
  puts "Getting Changes since #{last_tag}"
@@ -193,6 +199,7 @@ namespace :release do
193
199
  end
194
200
  end
195
201
 
202
+ desc "Commit version bump"
196
203
  task :commit => :chdir do
197
204
  puts "Commiting Version Bump"
198
205
  unless pretend?
@@ -202,11 +209,13 @@ namespace :release do
202
209
  end
203
210
  end
204
211
 
212
+ desc "Tag new version"
205
213
  task :tag => :chdir do
206
214
  puts "Tagging REL-#{version}"
207
215
  system "git tag REL-#{version}" unless pretend?
208
216
  end
209
217
 
218
+ desc "Push new commit to git"
210
219
  task :push => :chdir do
211
220
  puts "Pushing Repo"
212
221
  unless pretend?
@@ -221,24 +230,23 @@ namespace :release do
221
230
  end
222
231
  end
223
232
 
233
+ desc "Prepare for a new release"
224
234
  task :prepare => [:update, :changelog]
235
+
236
+ desc "Commit the new release"
225
237
  task :deploy => [:commit, :tag, :push]
226
238
 
227
239
  end
228
240
 
229
241
  namespace :gems do
230
242
 
243
+ desc "Build a new sproutcore gem"
231
244
  task :build do
232
- versions = [rvm_mri, rvm_jruby].compact
233
- unless versions.empty?
234
- puts "Building for #{versions.join(", ")}"
235
- system "rvm #{versions.join(',')} exec gem build sproutcore.gemspec" unless pretend?
236
- else
237
- puts "Building for current version"
238
- system "gem build sproutcore.gemspec" unless pretend?
239
- end
245
+ puts "Building for current version"
246
+ system "gem build sproutcore.gemspec" unless pretend?
240
247
  end
241
248
 
249
+ desc "Push new sproutcore gems"
242
250
  task :push do
243
251
  Dir["sproutcore-#{version}*.gem"].each do |g|
244
252
  puts "Pushing #{g}"
@@ -255,11 +263,16 @@ namespace :release do
255
263
  end
256
264
 
257
265
  task :prepare => []
266
+
267
+ desc "Build and push new sproutcore gems"
258
268
  task :deploy => [:build, :push]
259
269
 
260
270
  end
261
271
 
272
+ desc "Prepare for a new gem release"
262
273
  task :prepare => ["framework:prepare", "abbot:prepare", "gems:prepare"]
274
+
275
+ desc "Push new release to github and rubygems.org"
263
276
  task :deploy => ["framework:deploy", "abbot:deploy", "gems:deploy"]
264
277
 
265
278
  end
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
- :minor: 6
4
- :patch: 0.1
3
+ :minor: 7
4
+ :patch: 1.beta
data/lib/Buildfile CHANGED
@@ -57,13 +57,26 @@ mode :all do
57
57
  # Generate a combined javascript and stylesheet
58
58
  :combine_javascript => true,
59
59
  :combine_stylesheets => true,
60
+
61
+ # We do NOT want to pad sprites for debugging in production. This both increases filesize
62
+ # and makes the background of the sprite an embarrassing pink.
63
+ :pad_sprites_for_debugging => false,
64
+
65
+ # Optimizing sprites is good, but some apps that (appeared) to work before may break with
66
+ # this turned on. :pad_sprites_for_debugging makes the errors very visible, and that IS
67
+ # turned on in dev by default, so hopefully we should be able to make this default eventually.
68
+ #
69
+ # For reference, optimized sprites lay out sprites horizontally in addition to vertically.
70
+ :optimize_sprites => false,
71
+
72
+ # enable the hack that splits CSS into files with only ~4000 selectors for IE
73
+ :split_css_for_ie => true,
60
74
 
61
75
  # by default all targets autobuild
62
76
  :autobuild => true,
63
77
 
64
78
  # by default minify javacript and stylesheets
65
79
  :minify => true,
66
- :minify_css => true,
67
80
 
68
81
  # use the default layout defined in SproutCore
69
82
  :layout => 'sproutcore:lib/index.rhtml',
@@ -82,6 +95,11 @@ mode :all do
82
95
  # packs all JavaScript and CSS into one file for reduced HTTP requests
83
96
  :use_packed => true,
84
97
 
98
+ # generates output using sprites rather than data urls. This is default
99
+ # for all modes: it is faster to generate and browsers handle sprites better
100
+ # than data urls.
101
+ :use_sprites => true,
102
+
85
103
  # If set to true, the specified framework, if loaded via the SC.loadBundle
86
104
  # API, will be set up to be lazily instantiated when loaded.
87
105
  :lazy_instantiation => false,
@@ -103,10 +121,26 @@ mode :all do
103
121
  :html5_manifest => false,
104
122
  # Which networks/URLs to allow if HTML5 application caching is turned on
105
123
  :html5_manifest_networks => [],
106
-
107
- # whether to include touch icons in the index.html and other touch related
124
+
125
+ # Default favicon. You can set your own or set it to nil to not use one.
126
+ # If one is set, the path will be evaluated via sc_static() in the
127
+ # index.rhtml file.
128
+ :favicon => 'favicon.ico',
129
+
130
+ # Whether to include touch icons in the index.html and other touch related
108
131
  # properties
109
- :touch_enabled => true
132
+ :touch_enabled => true,
133
+
134
+ # If touch graphics are enabled (see above), then these are the paths which
135
+ # will be used for the various graphics. The paths will be evaluated via
136
+ # sc_static() in the index.rhtml file.
137
+ #
138
+ # Note: If you specify both a precomposed icon and a "regular" icon, the
139
+ # precomposed version will be used.
140
+ :icon => 'sproutcore-logo.png',
141
+ :precomposed_icon => nil,
142
+ :startup_image_portrait => 'sproutcore-startup-portrait.png',
143
+ :startup_image_landscape => 'sproutcore-startup-landscape.png'
110
144
 
111
145
  end
112
146
 
@@ -126,6 +160,11 @@ mode :debug do
126
160
 
127
161
  :minify_javascript => false,
128
162
  :minify_css => false,
163
+ :minify_html => false,
164
+
165
+ # In debug mode, we want to pad sprites for debugging so it is clear
166
+ # when the developer messes up their CSS.
167
+ :pad_sprites_for_debugging => true,
129
168
 
130
169
  :build_prefix => 'tmp/debug/build',
131
170
  :staging_prefix => 'tmp/debug/staging',
@@ -33,6 +33,11 @@ namespace :build do
33
33
  SC::Builder::Handlebars.build env[:entry], env[:dst_path]
34
34
  end
35
35
 
36
+ desc "splits CSS files by rule count so IE doesn't crap out"
37
+ build_task :split_css do |task, env|
38
+ SC::Builder::SplitCSS.build env[:entry], env[:dst_path]
39
+ end
40
+
36
41
  desc "builds a single sass file"
37
42
  build_task :sass do |task, env|
38
43
  SC::Builder::Sass.build env[:entry], env[:dst_path]
@@ -95,6 +100,11 @@ namespace :build do
95
100
  SC::Builder::Minify.build env[:entry], env[:dst_path], :javascript
96
101
  end
97
102
 
103
+ desc "minifies a HTML file by invoking the HTML compressor"
104
+ build_task :html do |task, env|
105
+ SC::Builder::Minify.build env[:entry], env[:dst_path], :html
106
+ end
107
+
98
108
  desc "minifies a Javascript file immediately by invoking the YUI compressor"
99
109
  build_task :inline_javascript do |task, env|
100
110
  SC::Builder::Minify.build env[:entry], env[:dst_path], :inline_javascript
@@ -0,0 +1,22 @@
1
+ module SproutCore
2
+ class FileRule
3
+
4
+ def initialize(exp, mode)
5
+ @mode = mode
6
+ @expression = Regexp.new(exp)
7
+ end
8
+
9
+ # Decides whether or not a file should be included.
10
+ # Returns either true, false, or nil (for not a match at all)
11
+ def include?(file)
12
+ ret = (@mode == :deny) ? false : true
13
+
14
+ if file =~ @expression
15
+ return ret
16
+ else
17
+ return nil
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,137 @@
1
+ require "json"
2
+ require "buildtasks/helpers/file_rule"
3
+
4
+ module SproutCore
5
+
6
+ # The FileRuleList applies a list of ordered rules to a file path to
7
+ # determine whether to reject it or approve it.
8
+ #
9
+ # The FileRuleList actually manages multiple sets of rules, separated by
10
+ # target name.
11
+ #
12
+ # The FileRuleList can read in JSON files (in either Allow or Deny mode)
13
+ # and SproutCore Approve Lists.
14
+ #
15
+ # To read JSON:
16
+ # list.read_json(path, :allow)
17
+ #
18
+ # To read Approve Lists
19
+ # list.read(path)
20
+ #
21
+ class FileRuleList
22
+ attr_accessor :allow_by_default, :ignore_list
23
+
24
+ ALWAYS_ACCEPTED_FILE_TYPES= [
25
+ '.manifest',
26
+ '.htm',
27
+ '.html',
28
+ '.rhtml',
29
+ '.png',
30
+ '.jpg',
31
+ '.jpeg',
32
+ '.gif'
33
+ ]
34
+
35
+ def initialize
36
+ @allow_by_default = false
37
+ @ignore_list = true
38
+ @file_rule_lists = {}
39
+ end
40
+
41
+ def add_rule(target, rule)
42
+ @ignore_list = false
43
+
44
+ @file_rule_lists[target] ||= []
45
+ @file_rule_lists[target] << rule
46
+ end
47
+
48
+ def include?(target, file)
49
+ return true if @ignore_list
50
+ return true if ALWAYS_ACCEPTED_FILE_TYPES.include?(File.extname file)
51
+
52
+ list = @file_rule_lists[target.to_s]
53
+ return @allow_by_default if list.nil?
54
+
55
+ approved = @allow_by_default
56
+ list.each {|rule|
57
+ _approved = rule.include? file
58
+ approved = _approved if not _approved.nil?
59
+ }
60
+
61
+ approved
62
+ end
63
+
64
+ #
65
+ # Read methods
66
+ #
67
+ def read_json(path, mode)
68
+ @ignore_list = false
69
+
70
+ if mode != :allow and mode != :deny
71
+ raise "read_json must be given either mode :allow or mode :deny"
72
+ end
73
+
74
+ content = JSON.parse(File.read(path))
75
+
76
+ content.each do |target, list|
77
+ list = [list] if list.kind_of?(String)
78
+
79
+ list.each do |expression|
80
+ rule = SproutCore::FileRule.new(expression, mode)
81
+ add_rule(target, rule)
82
+ end
83
+
84
+ end
85
+ end
86
+
87
+ def read(path)
88
+ @ignore_list = false
89
+
90
+ mode = :allow
91
+ target = nil
92
+ line_number = 0
93
+ File.new(path).each_line {|line|
94
+ line_number += 1
95
+
96
+ line.strip!
97
+ next if line == ""
98
+ next if line =~ /^#/
99
+
100
+ target_match = /^TARGET\s+(?<target>[^\s]+)\s*$/.match line
101
+ if target_match
102
+ target = target_match[:target]
103
+ mode = :allow
104
+ next
105
+ end
106
+
107
+ if target.nil?
108
+ raise "Expected TARGET (target name) in Accept list at #{path}, line #{line_number}"
109
+ end
110
+
111
+ mode_match = /^(?<mode>ALLOW|DENY)(\s+(?<what>.*))?\s*$/i.match line
112
+ if mode_match
113
+ _mode = mode_match[:mode].downcase
114
+ _mode = (_mode == "allow" ? :allow : :deny)
115
+
116
+ if mode_match[:what]
117
+ exp = mode_match[:what]
118
+ exp = ".*" if exp == "all"
119
+ rule = SproutCore::FileRule.new(exp, _mode)
120
+
121
+ add_rule target, rule
122
+ else
123
+ mode = _mode
124
+ end
125
+
126
+ next
127
+ end
128
+
129
+ match = /(?<expression>.*)$/.match(line)
130
+ raise "Invalid rule: #{line}" if match.nil?
131
+
132
+ rule = SproutCore::FileRule.new(match[:expression], mode)
133
+ add_rule target, rule
134
+ }
135
+ end
136
+ end
137
+ end