sproutcore 1.6.0.1 → 1.7.1.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +21 -0
- data/Gemfile +5 -0
- data/Rakefile +26 -13
- data/VERSION.yml +2 -2
- data/lib/Buildfile +43 -4
- data/lib/buildtasks/build.rake +10 -0
- data/lib/buildtasks/helpers/file_rule.rb +22 -0
- data/lib/buildtasks/helpers/file_rule_list.rb +137 -0
- data/lib/buildtasks/manifest.rake +133 -122
- data/lib/frameworks/sproutcore/CHANGELOG.md +69 -2
- data/lib/frameworks/sproutcore/apps/tests/english.lproj/strings.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -22
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +9 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +18 -13
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +80 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +84 -116
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +8 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +157 -157
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +106 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +71 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/attribute_bindings_test.js +38 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js +47 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +18 -18
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +42 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +26 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +14 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +158 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +15 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +108 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +4 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +6 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +26 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +97 -96
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +17 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +12 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +23 -14
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +5 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/render_delegates/menu_scroller.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/tests/menu/scroll.js +235 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +363 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroller.js +250 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +92 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/native_scroll.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/scroll.js +33 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/touch_scroller.js +76 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/integration.js +50 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/methods.js +143 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +258 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +1164 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroller.js +332 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +236 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroller.js +347 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroller.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +804 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroller.js +133 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +3 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/number.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/media/views/media_slider.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/video.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +29 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
- data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/segmented.css +1 -1
- data/lib/gen/app/templates/apps/@target_name@/Buildfile +3 -5
- data/lib/gen/app/templates/apps/@target_name@/resources/_theme.css +18 -0
- data/lib/gen/project/templates/@filename@/Buildfile +2 -2
- data/lib/sproutcore/builders/chance_file.rb +9 -16
- data/lib/sproutcore/builders/html.rb +2 -1
- data/lib/sproutcore/builders/minify.rb +4 -35
- data/lib/sproutcore/builders/module.rb +38 -1
- data/lib/sproutcore/builders/split.rb +63 -0
- data/lib/sproutcore/builders/strings.rb +7 -1
- data/lib/sproutcore/builders.rb +1 -0
- data/lib/sproutcore/helpers/css_split.rb +190 -0
- data/lib/sproutcore/helpers/entry_sorter.rb +2 -0
- data/lib/sproutcore/helpers/minifier.rb +40 -16
- data/lib/sproutcore/helpers/static_helper.rb +35 -17
- data/lib/sproutcore/helpers.rb +1 -1
- data/lib/sproutcore/models/manifest.rb +26 -0
- data/lib/sproutcore/models/target.rb +12 -1
- data/lib/sproutcore/rack/proxy.rb +244 -225
- data/lib/sproutcore/rack/restrict_ip.rb +67 -0
- data/lib/sproutcore/rack/service.rb +8 -2
- data/lib/sproutcore/rack.rb +1 -0
- data/lib/sproutcore/tools/build.rb +91 -43
- data/lib/sproutcore/tools/gen.rb +2 -3
- data/lib/sproutcore/tools/manifest.rb +22 -16
- data/lib/sproutcore/tools/server.rb +21 -0
- data/lib/sproutcore/tools.rb +102 -46
- data/lib/sproutcore.rb +30 -5
- data/spec/buildtasks/helpers/accept_list +22 -0
- data/spec/buildtasks/helpers/accept_list.rb +128 -0
- data/spec/buildtasks/helpers/list.json +11 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/chance_2x_spec.rb +1 -39
- data/spec/buildtasks/manifest/prepare_build_tasks/chance_spec.rb +0 -38
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +4 -4
- data/spec/buildtasks/manifest/prepare_build_tasks/module_spec.rb +2 -2
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_indirect_spec.rb +7 -16
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_spec.rb +7 -17
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +11 -6
- data/spec/fixtures/builder_tests/Buildfile +2 -1
- data/spec/fixtures/builder_tests/apps/module_test/modules/required_module/core.js +0 -0
- data/spec/lib/builders/module_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/sproutcore.gemspec +4 -9
- data/vendor/chance/lib/chance/factory.rb +45 -0
- data/vendor/chance/lib/chance/instance/data_url.rb +0 -29
- data/vendor/chance/lib/chance/instance/slicing.rb +57 -4
- data/vendor/chance/lib/chance/instance/spriting.rb +112 -21
- data/vendor/chance/lib/chance/instance.rb +173 -28
- data/vendor/chance/lib/chance/parser.rb +80 -52
- data/vendor/chance/lib/chance.rb +25 -6
- data/vendor/sproutcore/SCCompiler.jar +0 -0
- data/vendor/sproutcore/lib/args4j-2.0.12.jar +0 -0
- data/vendor/sproutcore/lib/yuicompressor-2.4.2.jar +0 -0
- metadata +97 -38
|
@@ -53,48 +53,10 @@ describe "manifest:prepare_build_tasks:chance" do
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
x2_entry = entry_for(name + "@2x.css")
|
|
56
|
-
x2_entry[:chance_file].should == "chance@2x.css"
|
|
56
|
+
x2_entry[:chance_file].should == "chance-sprited@2x.css"
|
|
57
57
|
end
|
|
58
58
|
originals.size.should == 0
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
it "generates js, and mhtml entries" do
|
|
62
|
-
run_task
|
|
63
|
-
|
|
64
|
-
have_entry('stylesheet.css')
|
|
65
|
-
have_entry('stylesheet@2x.css')
|
|
66
|
-
have_entry('__sc_chance.js')
|
|
67
|
-
have_entry('__sc_chance_mhtml.txt')
|
|
68
|
-
|
|
69
|
-
stylesheet = entry_for('stylesheet.css')
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
it "provides all chance instances to the mhtml and js entries" do
|
|
73
|
-
run_task
|
|
74
|
-
|
|
75
|
-
js_entry = entry_for('__sc_chance.js')
|
|
76
|
-
mhtml_entry = entry_for('__sc_chance_mhtml.txt')
|
|
77
|
-
|
|
78
|
-
resources = {}
|
|
79
|
-
|
|
80
|
-
originals = @manifest.entries(:hidden=>true).select {|entry|
|
|
81
|
-
entry.entry_type == :css and not entry.combined and not entry[:resource].nil?
|
|
82
|
-
}
|
|
83
|
-
originals.size.should > 0
|
|
84
|
-
|
|
85
|
-
originals.each do |entry|
|
|
86
|
-
next if entry[:resource].nil?
|
|
87
|
-
|
|
88
|
-
resources[entry[:resource]] ||= []
|
|
89
|
-
resources[entry[:resource]] << entry
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
resources.each do |name, entries|
|
|
93
|
-
chance_instance = entry_for(name + ".css")[:chance_instance]
|
|
94
|
-
js_entry.chance_instances.should include(chance_instance)
|
|
95
|
-
mhtml_entry.chance_instances.should include(chance_instance)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
end
|
|
99
61
|
end
|
|
100
62
|
|
|
@@ -62,43 +62,5 @@ describe "manifest:prepare_build_tasks:chance" do
|
|
|
62
62
|
originals.size.should == 0
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
it "generates js, and mhtml entries" do
|
|
66
|
-
run_task
|
|
67
|
-
|
|
68
|
-
have_entry('stylesheet.css')
|
|
69
|
-
have_entry('stylesheet@2x.css', false)
|
|
70
|
-
have_entry('__sc_chance.js')
|
|
71
|
-
have_entry('__sc_chance_mhtml.txt')
|
|
72
|
-
|
|
73
|
-
stylesheet = entry_for('stylesheet.css')
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "provides all chance instances to the mhtml and js entries" do
|
|
77
|
-
run_task
|
|
78
|
-
|
|
79
|
-
js_entry = entry_for('__sc_chance.js')
|
|
80
|
-
mhtml_entry = entry_for('__sc_chance_mhtml.txt')
|
|
81
|
-
|
|
82
|
-
resources = {}
|
|
83
|
-
|
|
84
|
-
originals = @manifest.entries(:hidden=>true).select {|entry|
|
|
85
|
-
entry.entry_type == :css and not entry.combined and not entry[:resource].nil?
|
|
86
|
-
}
|
|
87
|
-
originals.size.should > 0
|
|
88
|
-
|
|
89
|
-
originals.each do |entry|
|
|
90
|
-
next if entry[:resource].nil?
|
|
91
|
-
|
|
92
|
-
resources[entry[:resource]] ||= []
|
|
93
|
-
resources[entry[:resource]] << entry
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
resources.each do |name, entries|
|
|
97
|
-
chance_instance = entry_for(name + ".css")[:chance_instance]
|
|
98
|
-
js_entry.chance_instances.should include(chance_instance)
|
|
99
|
-
mhtml_entry.chance_instances.should include(chance_instance)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
end
|
|
103
65
|
end
|
|
104
66
|
|
|
@@ -201,7 +201,7 @@ describe "manifest:prepare_build_tasks:combine" do
|
|
|
201
201
|
|
|
202
202
|
# get the expected set of ordered entries...based on contents of
|
|
203
203
|
# project...
|
|
204
|
-
expected = %w(source/lproj/strings.js source/core.js source/utils.js
|
|
204
|
+
expected = %w(source/lproj/strings.js source/core.js source/utils.js source/1.js source/a.js source/a/a.js source/a/b.js source/B.js source/b/a.js source/c.js source/t.js source/resources/main_page.js source/main.js)
|
|
205
205
|
|
|
206
206
|
entry.ordered_entries.should_not be_nil
|
|
207
207
|
filenames = entry.ordered_entries.map { |e| e.filename }
|
|
@@ -241,7 +241,7 @@ describe "manifest:prepare_build_tasks:combine" do
|
|
|
241
241
|
|
|
242
242
|
# get the expected set of ordered entries...based on contents of
|
|
243
243
|
# project... note that we require 'd', which should match 'lproj/d'
|
|
244
|
-
expected = %w(
|
|
244
|
+
expected = %w(source/c.js source/a.js source/lproj/d.js source/b.js)
|
|
245
245
|
|
|
246
246
|
entry.ordered_entries.should_not be_nil
|
|
247
247
|
filenames = entry.ordered_entries.map { |e| e.filename }
|
|
@@ -337,14 +337,14 @@ describe "manifest:prepare_build_tasks:combine" do
|
|
|
337
337
|
run_task
|
|
338
338
|
end
|
|
339
339
|
|
|
340
|
-
it " should be included in the requirements" do
|
|
340
|
+
it " should not be included in the requirements" do
|
|
341
341
|
target = target_for('photos')
|
|
342
342
|
target_requirements = target.required_targets
|
|
343
343
|
|
|
344
344
|
preferences_module = target.target_for('photos/preferences')
|
|
345
345
|
email_module = target.target_for('photos/email')
|
|
346
346
|
|
|
347
|
-
target_requirements.
|
|
347
|
+
target_requirements.should_not include(preferences_module)
|
|
348
348
|
target_requirements.should_not include(email_module)
|
|
349
349
|
end
|
|
350
350
|
end
|
|
@@ -69,14 +69,14 @@ describe "Target#modules" do
|
|
|
69
69
|
run_task
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
it "it should be included in the requirements" do
|
|
72
|
+
it "it should not be included in the requirements" do
|
|
73
73
|
target = target_for('photos')
|
|
74
74
|
target_requirements = target.required_targets
|
|
75
75
|
|
|
76
76
|
preferences_module = target.target_for('photos/preferences')
|
|
77
77
|
email_module = target.target_for('photos/email')
|
|
78
78
|
|
|
79
|
-
target_requirements.
|
|
79
|
+
target_requirements.should_not include(preferences_module)
|
|
80
80
|
target_requirements.should_not include(email_module)
|
|
81
81
|
end
|
|
82
82
|
end
|
|
@@ -115,7 +115,13 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
115
115
|
|
|
116
116
|
before do
|
|
117
117
|
run_task
|
|
118
|
-
|
|
118
|
+
|
|
119
|
+
# for 1x (but not 2x) there should be an intermediary entry for a transform
|
|
120
|
+
# (split_css) that... splits the CSS. See its documentation.
|
|
121
|
+
#
|
|
122
|
+
# we are looking for the stylesheet-packed.css that is set on its source entry.
|
|
123
|
+
@entry = entry_for('stylesheet-packed.css')[:source_entry]
|
|
124
|
+
|
|
119
125
|
@entry_2x = entry_for('stylesheet@2x-packed.css')
|
|
120
126
|
end
|
|
121
127
|
|
|
@@ -129,11 +135,6 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
129
135
|
@entry.source_entries.each do |entry|
|
|
130
136
|
entry.filename.should == 'stylesheet.css'
|
|
131
137
|
end
|
|
132
|
-
|
|
133
|
-
@entry_2x.source_entries.size.should > 0
|
|
134
|
-
@entry_2x.source_entries.each do |entry|
|
|
135
|
-
entry.filename.should == 'stylesheet@2x.css'
|
|
136
|
-
end
|
|
137
138
|
end
|
|
138
139
|
|
|
139
140
|
it "should include ordered_entries ordered by required target order" do
|
|
@@ -151,16 +152,6 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
151
152
|
entry.target.should == targets.shift
|
|
152
153
|
end
|
|
153
154
|
|
|
154
|
-
targets = @target.expand_required_targets(:theme => true) + [@target]
|
|
155
|
-
variation = @entry.manifest.variation
|
|
156
|
-
targets.reject! do |t|
|
|
157
|
-
t.manifest_for(variation).build!.entry_for('stylesheet@2x.css').nil?
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
@entry_2x.ordered_entries.each do |entry|
|
|
161
|
-
entry.target.should == targets.shift
|
|
162
|
-
end
|
|
163
|
-
|
|
164
155
|
end
|
|
165
156
|
|
|
166
157
|
it "should include the actual targets this packed version covers in the targets property (even those w no stylesheet.css)" do
|
|
@@ -111,7 +111,13 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
111
111
|
|
|
112
112
|
before do
|
|
113
113
|
run_task
|
|
114
|
-
|
|
114
|
+
|
|
115
|
+
# for 1x (but not 2x) there should be an intermediary entry for a transform
|
|
116
|
+
# (split_css) that... splits the CSS. See its documentation.
|
|
117
|
+
#
|
|
118
|
+
# we are looking for the stylesheet-packed.css that is set on its source entry.
|
|
119
|
+
@entry = entry_for('stylesheet-packed.css')[:source_entry]
|
|
120
|
+
|
|
115
121
|
@entry_2x = entry_for('stylesheet@2x-packed.css')
|
|
116
122
|
end
|
|
117
123
|
|
|
@@ -125,11 +131,6 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
125
131
|
@entry.source_entries.each do |entry|
|
|
126
132
|
entry.filename.should == 'stylesheet.css'
|
|
127
133
|
end
|
|
128
|
-
|
|
129
|
-
@entry_2x.source_entries.size.should > 0
|
|
130
|
-
@entry_2x.source_entries.each do |entry|
|
|
131
|
-
entry.filename.should == 'stylesheet@2x.css'
|
|
132
|
-
end
|
|
133
134
|
end
|
|
134
135
|
|
|
135
136
|
it "should include ordered_entries ordered by required target order" do
|
|
@@ -145,17 +146,6 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
145
146
|
@entry.ordered_entries.each do |entry|
|
|
146
147
|
entry.target.should == targets.shift
|
|
147
148
|
end
|
|
148
|
-
|
|
149
|
-
targets = @target.expand_required_targets(:theme => true) + [@target]
|
|
150
|
-
variation = @entry.manifest.variation
|
|
151
|
-
targets.reject! do |t|
|
|
152
|
-
t.manifest_for(variation).build!.entry_for('stylesheet@2x.css').nil?
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
@entry_2x.ordered_entries.each do |entry|
|
|
156
|
-
entry.target.should == targets.shift
|
|
157
|
-
end
|
|
158
|
-
|
|
159
149
|
end
|
|
160
150
|
|
|
161
151
|
it "should include the actual targets this packed version covers in the targets property (even those w no stylesheet.css)" do
|
|
@@ -40,8 +40,8 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
40
40
|
@manifest.entry_for('javascript-packed.js').should_not be_nil
|
|
41
41
|
@manifest.entry_for('stylesheet-packed.css').should_not be_nil
|
|
42
42
|
|
|
43
|
-
#
|
|
44
|
-
@manifest.entry_for('stylesheet@2x-packed.css').
|
|
43
|
+
# there must always be a 2x-packed entry
|
|
44
|
+
@manifest.entry_for('stylesheet@2x-packed.css').should_not be_nil
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
it "should remove non-packed JS entries from apps" do
|
|
@@ -132,16 +132,21 @@ describe "manifest:prepare_build_tasks:packed" do
|
|
|
132
132
|
|
|
133
133
|
run_task
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
# for 1x (but not 2x) there should be an intermediary entry for a transform
|
|
136
|
+
# (split_css) that... splits the CSS. See its documentation.
|
|
137
|
+
#
|
|
138
|
+
# we are looking for the stylesheet-packed.css that is set on its source entry.
|
|
139
|
+
@entry = entry_for('stylesheet-packed.css')[:source_entry]
|
|
140
|
+
|
|
136
141
|
@entry_2x = entry_for('stylesheet@2x-packed.css')
|
|
137
142
|
end
|
|
138
143
|
|
|
139
144
|
it "should generate a stylesheet-packed.css entry" do
|
|
140
145
|
@entry.should_not be_nil
|
|
141
146
|
|
|
142
|
-
# should be
|
|
143
|
-
#
|
|
144
|
-
@entry_2x.
|
|
147
|
+
# There should always be a 2x packed entry, because default JS
|
|
148
|
+
# looks for 2x when running in 2x mode, and has no fallback.
|
|
149
|
+
@entry_2x.should_not be_nil
|
|
145
150
|
end
|
|
146
151
|
|
|
147
152
|
it "should include stylesheet.css entries from all required targets" do
|
|
@@ -19,4 +19,5 @@ config '/module_test/deferred_module',
|
|
|
19
19
|
config :module_test,
|
|
20
20
|
:deferred_modules => [:deferred_module],
|
|
21
21
|
:prefetched_modules => [:required_target],
|
|
22
|
-
:inlined_modules => [:inlined_module]
|
|
22
|
+
:inlined_modules => [:inlined_module],
|
|
23
|
+
:required => [:required_module]
|
|
File without changes
|
|
@@ -45,7 +45,7 @@ describe 'SC::Builder::ModuleInfo' do
|
|
|
45
45
|
req = @target.required_targets
|
|
46
46
|
|
|
47
47
|
req.size.should == 1
|
|
48
|
-
req.first.target_name.should == :'/module_test/
|
|
48
|
+
req.first.target_name.should == :'/module_test/required_module'
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
it "should require one deferred module" do
|
data/spec/spec_helper.rb
CHANGED
data/sproutcore.gemspec
CHANGED
|
@@ -3,7 +3,6 @@ require "sproutcore/version"
|
|
|
3
3
|
|
|
4
4
|
os = Gem::Platform.local.os
|
|
5
5
|
is_jruby = (os == "java")
|
|
6
|
-
is_mingw = (os == "mingw32")
|
|
7
6
|
|
|
8
7
|
Gem::Specification.new do |s|
|
|
9
8
|
s.name = 'sproutcore'
|
|
@@ -14,17 +13,17 @@ Gem::Specification.new do |s|
|
|
|
14
13
|
s.summary = "SproutCore is a platform for building native look-and-feel applications on the web"
|
|
15
14
|
|
|
16
15
|
s.platform = 'java' if is_jruby
|
|
17
|
-
s.platform = 'x86-mingw32' if is_mingw
|
|
18
16
|
|
|
19
17
|
s.add_dependency 'rack', '~> 1.2'
|
|
20
18
|
s.add_dependency 'json_pure', "~> 1.4.6"
|
|
21
19
|
s.add_dependency 'extlib', "~> 0.9.15"
|
|
22
20
|
s.add_dependency 'erubis', "~> 2.6"
|
|
23
21
|
s.add_dependency 'thor', '~> 0.14.3'
|
|
24
|
-
s.add_dependency '
|
|
25
|
-
|
|
26
|
-
s.add_dependency 'compass', '~> 0.11.1'
|
|
22
|
+
s.add_dependency 'sass', '~> 3.1.3'
|
|
23
|
+
s.add_dependency 'haml', '~> 3.1.2'
|
|
27
24
|
|
|
25
|
+
s.add_dependency 'compass', '~> 0.11.3'
|
|
26
|
+
s.add_dependency 'chunky_png', '~> 1.2.0'
|
|
28
27
|
s.add_dependency 'em-http-request', '~> 1.0.0.beta'
|
|
29
28
|
|
|
30
29
|
if is_jruby
|
|
@@ -33,10 +32,6 @@ Gem::Specification.new do |s|
|
|
|
33
32
|
s.add_dependency 'thin', '~> 1.2.11'
|
|
34
33
|
end
|
|
35
34
|
|
|
36
|
-
if is_mingw
|
|
37
|
-
s.add_dependency 'eventmachine', '~> 1.0.0.beta'
|
|
38
|
-
end
|
|
39
|
-
|
|
40
35
|
s.add_development_dependency 'gemcutter', "~> 0.6.0"
|
|
41
36
|
s.add_development_dependency 'rspec', "~> 2.5.0"
|
|
42
37
|
s.add_development_dependency 'rake'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#
|
|
2
|
+
# The Chance factory.
|
|
3
|
+
# All methods require two parts: a key and a hash of options. The hash will be used in
|
|
4
|
+
# the case of a cache missed.
|
|
5
|
+
#
|
|
6
|
+
module Chance
|
|
7
|
+
module ChanceFactory
|
|
8
|
+
|
|
9
|
+
@instances = {}
|
|
10
|
+
@file_hashes = {}
|
|
11
|
+
class << self
|
|
12
|
+
def clear_instances
|
|
13
|
+
@file_hashes = {}
|
|
14
|
+
@instances = {}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def instance_for_key(key, opts)
|
|
18
|
+
if not @instances.include? key
|
|
19
|
+
@instances[key] = Chance::Instance.new(opts)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
return @instances[key]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Call with a hash mapping instance paths to absolute paths. This will compare with
|
|
26
|
+
# the last
|
|
27
|
+
def update_instance(key, opts, files)
|
|
28
|
+
instance = instance_for_key(key, opts)
|
|
29
|
+
last_hash = @file_hashes[key] || {}
|
|
30
|
+
|
|
31
|
+
# If they are not equal, we might as well throw everything. The biggest cost is from
|
|
32
|
+
# Chance re-running, and it will have to anyway.
|
|
33
|
+
if not last_hash.eql? files
|
|
34
|
+
instance.unmap_all
|
|
35
|
+
files.each {|path, identifier|
|
|
36
|
+
instance.map_file path, identifier
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@file_hashes[key] = files
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -23,11 +23,6 @@ module Chance
|
|
|
23
23
|
output += "\n-webkit-background-size: #{width}px #{height}px;"
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
# FOR IE < 8:
|
|
28
|
-
output += '*background-image: url("mhtml:chance-mhtml.txt!' + slice[:css_name] + '")'
|
|
29
|
-
output += "\n"
|
|
30
|
-
|
|
31
26
|
output
|
|
32
27
|
}
|
|
33
28
|
|
|
@@ -57,29 +52,5 @@ module Chance
|
|
|
57
52
|
end
|
|
58
53
|
end
|
|
59
54
|
|
|
60
|
-
def mhtml(opts)
|
|
61
|
-
# If there are no slices, ensure that we return an empty file.
|
|
62
|
-
return "" if @slices.length == 0
|
|
63
|
-
|
|
64
|
-
output = "Content-Type: multipart/related; boundary=\"CHANCE__\"\r\n"
|
|
65
|
-
|
|
66
|
-
@slices.each {|name, slice|
|
|
67
|
-
output += "\r\n--CHANCE__\r\n"
|
|
68
|
-
output += "Content-Location:" + slice[:css_name] + "\r\n"
|
|
69
|
-
output += "Content-Type:image/png\r\n"
|
|
70
|
-
output += "Content-Transfer-Encoding:base64\r\n\r\n"
|
|
71
|
-
|
|
72
|
-
base64Image = base64_for(slice)
|
|
73
|
-
output += base64Image.gsub("[^\r]\n", "\r\n")
|
|
74
|
-
|
|
75
|
-
output
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
output += "\r\n--CHANCE__--"
|
|
79
|
-
|
|
80
|
-
output
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
|
|
84
55
|
end
|
|
85
56
|
end
|
|
@@ -2,17 +2,57 @@ require "chance/perf"
|
|
|
2
2
|
|
|
3
3
|
module Chance
|
|
4
4
|
class Instance
|
|
5
|
-
|
|
6
5
|
# The Slicing module handles taking a collection of slice definitions to
|
|
7
6
|
# produce sliced images. It uses ChunkyPNG to perform the slicing, and
|
|
8
7
|
# stores the sliced image in the slice definition.
|
|
9
8
|
module Slicing
|
|
9
|
+
class << self
|
|
10
|
+
def add_canvas_to_cache(canvas, file, rect)
|
|
11
|
+
if @canvas_cache.nil?
|
|
12
|
+
@canvas_cache = {}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
left = rect[:left]
|
|
16
|
+
top = rect[:top]
|
|
17
|
+
width = rect[:width]
|
|
18
|
+
height = rect[:height]
|
|
19
|
+
|
|
20
|
+
key = "#{file[:path]}:#{left},#{top},#{width},#{height}"
|
|
21
|
+
@canvas_cache[key] = {
|
|
22
|
+
mtime: file[:mtime],
|
|
23
|
+
canvas: canvas
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_canvas_from_cache(file, rect)
|
|
28
|
+
if @canvas_cache.nil?
|
|
29
|
+
@canvas_cache = {}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
left = rect[:left]
|
|
33
|
+
top = rect[:top]
|
|
34
|
+
width = rect[:width]
|
|
35
|
+
height = rect[:height]
|
|
36
|
+
|
|
37
|
+
key = "#{file[:path]}:#{left},#{top},#{width},#{height}"
|
|
38
|
+
hash = @canvas_cache[key]
|
|
39
|
+
|
|
40
|
+
# Check to see if it is new enough
|
|
41
|
+
if not hash.nil? and hash[:mtime] == file[:mtime]
|
|
42
|
+
return hash[:canvas]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
@canvas_cache[key] = nil
|
|
46
|
+
nil
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
10
50
|
# performs the slicing indicated by each slice definition, and puts the resulting
|
|
11
51
|
# image in the slice definition's :image property.
|
|
12
52
|
#
|
|
13
53
|
# if x2 is supplied, this will assume it is a second pass to locate any @2x images
|
|
14
54
|
# and use them to replace the originals.
|
|
15
|
-
def slice_images(opts)
|
|
55
|
+
def slice_images(opts)
|
|
16
56
|
slices = @slices
|
|
17
57
|
output = ""
|
|
18
58
|
|
|
@@ -21,7 +61,7 @@ module Chance
|
|
|
21
61
|
# Otherwise, consumers will use slice[:file] [:canvas] or [:contents]
|
|
22
62
|
# to get the original data as needed.
|
|
23
63
|
slice[:canvas] = nil
|
|
24
|
-
|
|
64
|
+
|
|
25
65
|
# In any case, if there is one, we need to get the original file and canvas;
|
|
26
66
|
# this process also tells us if the slice is 2x, etc.
|
|
27
67
|
canvas = canvas_for slice, opts
|
|
@@ -53,7 +93,17 @@ module Chance
|
|
|
53
93
|
rect = slice_rect(slice, canvas_width / f, canvas_height / f)
|
|
54
94
|
|
|
55
95
|
if not rect.nil?
|
|
56
|
-
|
|
96
|
+
|
|
97
|
+
## CHECK CACHE ##
|
|
98
|
+
file = file_for(slice, opts)
|
|
99
|
+
cached_canvas = Chance::Instance::Slicing.get_canvas_from_cache(file, rect)
|
|
100
|
+
if cached_canvas
|
|
101
|
+
slice[:canvas] = cached_canvas
|
|
102
|
+
else
|
|
103
|
+
slice[:canvas] = canvas.crop(rect[:left] * f, rect[:top] * f, rect[:width] * f, rect[:height] * f)
|
|
104
|
+
Chance::Instance::Slicing.add_canvas_to_cache(slice[:canvas], file, rect)
|
|
105
|
+
end
|
|
106
|
+
|
|
57
107
|
canvas_width = rect[:height] * f
|
|
58
108
|
canvas_height = rect[:width] * f
|
|
59
109
|
end
|
|
@@ -62,8 +112,11 @@ module Chance
|
|
|
62
112
|
slice[:target_width] = canvas_width / f
|
|
63
113
|
slice[:target_height] = canvas_height / f
|
|
64
114
|
end
|
|
115
|
+
|
|
116
|
+
|
|
65
117
|
|
|
66
118
|
end
|
|
119
|
+
|
|
67
120
|
end
|
|
68
121
|
|
|
69
122
|
# Returns either a RMagick image or a ChunkyPNG canvas for a slice, as applicable.
|