sproutcore 1.0.1003 → 1.0.1008
Sign up to get free protection for your applications and to get access to all the features.
- data/Buildfile +15 -3
- data/Rakefile +3 -7
- data/VERSION.yml +2 -2
- data/buildtasks/manifest.rake +2 -0
- data/frameworks/sproutcore/Buildfile +2 -0
- data/frameworks/sproutcore/HISTORY +218 -203
- data/frameworks/sproutcore/README +47 -6
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
- data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
- data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
- data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
- data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
- data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
- data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
- data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
- data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
- data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
- data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
- data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
- data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
- data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
- data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
- data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
- data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
- data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
- data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
- data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
- data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
- data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
- data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
- data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
- data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
- data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
- data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
- data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
- data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
- data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
- data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
- data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
- data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
- data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
- data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
- data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
- data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
- data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
- data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
- data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
- data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
- data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
- data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
- data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
- data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
- data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
- data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
- data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
- data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
- data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
- data/frameworks/sproutcore/lib/index.rhtml +6 -20
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
- data/gen/data-source/Buildfile +18 -0
- data/gen/data-source/README +1 -0
- data/gen/data-source/USAGE +15 -0
- data/gen/data-source/templates/data_sources/@filename@.js +64 -0
- data/lib/sproutcore/builders/combine.rb +23 -0
- data/lib/sproutcore/builders/javascript.rb +27 -2
- data/lib/sproutcore/buildfile/task.rb +1 -1
- data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +79 -0
- data/lib/sproutcore/models/manifest.rb +2 -2
- data/lib/sproutcore/models/target.rb +1 -1
- data/lib/sproutcore/tools/build.rb +1 -1
- data/lib/sproutcore/tools/docs.rb +3 -3
- data/lib/sproutcore/tools/gen.rb +17 -15
- data/lib/sproutcore/tools/manifest.rb +9 -9
- data/lib/sproutcore/tools/server.rb +3 -3
- data/lib/sproutcore/tools.rb +259 -250
- data/lib/sproutcore.rb +9 -1
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
- data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
- data/spec/lib/models/manifest/find_entry.rb +12 -0
- data/spec/lib/tools/gen_spec.rb +1 -0
- data/spec/lib/tools/tools_spec.rb +1 -0
- data/sproutcore-abbot.gemspec +36 -44
- metadata +43 -44
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
- data/lib/thor/CHANGELOG.rdoc +0 -52
- data/lib/thor/LICENSE +0 -20
- data/lib/thor/README.markdown +0 -76
- data/lib/thor/Rakefile +0 -6
- data/lib/thor/Thorfile +0 -45
- data/lib/thor/bin/rake2thor +0 -83
- data/lib/thor/bin/thor +0 -7
- data/lib/thor/lib/thor/error.rb +0 -3
- data/lib/thor/lib/thor/options.rb +0 -267
- data/lib/thor/lib/thor/ordered_hash.rb +0 -64
- data/lib/thor/lib/thor/runner.rb +0 -305
- data/lib/thor/lib/thor/task.rb +0 -83
- data/lib/thor/lib/thor/task_hash.rb +0 -22
- data/lib/thor/lib/thor/tasks/package.rb +0 -18
- data/lib/thor/lib/thor/tasks.rb +0 -77
- data/lib/thor/lib/thor/util.rb +0 -75
- data/lib/thor/lib/thor.rb +0 -170
- data/lib/thor/script/destroy +0 -14
- data/lib/thor/script/generate +0 -14
- data/lib/thor/spec/fixtures/task.thor +0 -10
- data/lib/thor/spec/options_spec.rb +0 -271
- data/lib/thor/spec/ordered_hash_spec.rb +0 -84
- data/lib/thor/spec/spec.opts +0 -1
- data/lib/thor/spec/spec_helper.rb +0 -30
- data/lib/thor/spec/task_spec.rb +0 -11
- data/lib/thor/spec/tasks_spec.rb +0 -28
- data/lib/thor/spec/thor_runner_spec.rb +0 -194
- data/lib/thor/spec/thor_spec.rb +0 -206
- data/lib/thor/spec/util_spec.rb +0 -99
- data/lib/thor/task.thor +0 -15
- data/lib/thor/thor.gemspec +0 -29
data/lib/sproutcore/tools.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# and contributors
|
6
6
|
# ===========================================================================
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'thor'
|
9
9
|
|
10
10
|
module SC
|
11
11
|
|
@@ -25,314 +25,323 @@ module SC
|
|
25
25
|
#
|
26
26
|
class Tools < ::Thor
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
##
|
31
|
-
|
32
|
-
# Raise this type of exception when a fatal error occurs because the
|
33
|
-
# user did not pass the correct options. This will be caught and
|
34
|
-
# displayed at the top level before exiting. Note that if you raise
|
35
|
-
# an exception of some other type, then a backtrace may be displayed as
|
36
|
-
# well (Which is not preferred)
|
37
|
-
class FatalException < Exception
|
38
|
-
end
|
39
|
-
|
40
|
-
# Helper method. Call this when an acception occurs that is fatal due to
|
41
|
-
# a problem with the user.
|
42
|
-
def fatal!(description)
|
43
|
-
raise FatalException, description
|
44
|
-
end
|
45
|
-
|
46
|
-
# Helper method. Call this when you want to log an info message. Logs to
|
47
|
-
# the standard logger.
|
48
|
-
def info(description)
|
49
|
-
SC.logger.info(description)
|
28
|
+
def self.invoke(task_name)
|
29
|
+
start([task_name.to_s] + ARGV)
|
50
30
|
end
|
51
|
-
|
52
|
-
# Helper method. Call this when you want to log a debug message.
|
53
|
-
def debug(description)
|
54
|
-
SC.logger.debug(description)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Log this when you need to issue a warning.
|
58
|
-
def warn(description)
|
59
|
-
SC.logger.warn(description)
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
################################################
|
64
|
-
## GLOBAL OPTIONS
|
65
|
-
##
|
31
|
+
|
66
32
|
|
67
33
|
# All sproutcore tools can take some standard options. These are
|
68
34
|
# processed automatically when the tool is loaded
|
69
|
-
method_options({ '--project' => :
|
70
|
-
'--library' => :
|
71
|
-
'--mode' => :
|
72
|
-
'--environment' => :
|
73
|
-
'--logfile' => :
|
74
|
-
'--build' => :
|
35
|
+
method_options({ '--project' => :string,
|
36
|
+
'--library' => :string, # deprecated
|
37
|
+
'--mode' => :string,
|
38
|
+
'--environment' => :string, # deprecated
|
39
|
+
'--logfile' => :string,
|
40
|
+
'--build' => :string,
|
75
41
|
['--verbose', '-v'] => false,
|
76
42
|
['--very-verbose', '-V'] => false })
|
77
43
|
def initialize(options, *args)
|
78
44
|
super
|
79
45
|
end
|
46
|
+
|
47
|
+
no_tasks do
|
48
|
+
|
49
|
+
################################################
|
50
|
+
## EXCEPTIONS
|
51
|
+
##
|
80
52
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
53
|
+
# Raise this type of exception when a fatal error occurs because the
|
54
|
+
# user did not pass the correct options. This will be caught and
|
55
|
+
# displayed at the top level before exiting. Note that if you raise
|
56
|
+
# an exception of some other type, then a backtrace may be displayed as
|
57
|
+
# well (Which is not preferred)
|
58
|
+
class FatalException < Exception
|
59
|
+
end
|
60
|
+
|
61
|
+
# Helper method. Call this when an acception occurs that is fatal due
|
62
|
+
# to a problem with the user.
|
63
|
+
def fatal!(description)
|
64
|
+
raise FatalException, description
|
65
|
+
end
|
66
|
+
|
67
|
+
# Helper method. Call this when you want to log an info message. Logs
|
68
|
+
# to the standard logger.
|
69
|
+
def info(description)
|
70
|
+
SC.logger.info(description)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Helper method. Call this when you want to log a debug message.
|
74
|
+
def debug(description)
|
75
|
+
SC.logger.debug(description)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Log this when you need to issue a warning.
|
79
|
+
def warn(description)
|
80
|
+
SC.logger.warn(description)
|
81
|
+
end
|
82
|
+
|
83
|
+
################################################
|
84
|
+
## GLOBAL OPTIONS
|
85
|
+
##
|
86
|
+
|
87
|
+
# This is the core entry method used to run every tool. Extend this
|
88
|
+
# method with any standard preprocessing you want all tools to do before
|
89
|
+
# they do their specific thing.
|
90
|
+
def invoke(*args)
|
91
|
+
prepare_logger!
|
92
|
+
prepare_mode!
|
93
|
+
prepare_build_numbers!
|
94
|
+
super
|
95
|
+
end
|
90
96
|
|
91
|
-
|
92
|
-
|
93
|
-
|
97
|
+
# Make the options hash a HashStruct so that we can access each variable
|
98
|
+
# as a method
|
99
|
+
def options; @tool_options ||= HashStruct.new(super); end
|
94
100
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
# Configure the expected log level and log target. Handles the
|
102
|
+
# --verbose, --very-verbose and --logfile options
|
103
|
+
def prepare_logger!
|
104
|
+
SC.env.log_level = options['very-verbose'] ? :debug : (options.verbose ? :info : :warn)
|
105
|
+
SC.env.logfile = File.expand_path(options.logfile) if options.logfile
|
106
|
+
end
|
101
107
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
+
# Configure the current build mode. Handles the --mode and
|
109
|
+
# --environment options. (--environment is provided for backwards
|
110
|
+
# compatibility)
|
111
|
+
def prepare_mode!(preferred_mode = 'production')
|
112
|
+
build_mode = (options.mode || options.environment || preferred_mode).to_s.downcase.to_sym
|
113
|
+
SC.build_mode = build_mode
|
114
|
+
end
|
108
115
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
116
|
+
# Configure the current build numbers. Handles the --build option.
|
117
|
+
def prepare_build_numbers!
|
118
|
+
return unless (numbers = options.build)
|
119
|
+
numbers = numbers.split(',').map { |n| n.split(':') }
|
120
|
+
if numbers.size==1 && numbers.first.size==1
|
121
|
+
SC.env.build_number = numbers.first.first
|
122
|
+
else
|
123
|
+
hash = {}
|
124
|
+
numbers.each do |pair|
|
125
|
+
key = pair[0]
|
126
|
+
key = "/#{key}" if !(key =~ /^\//)
|
127
|
+
hash[key.to_sym] = pair[1]
|
128
|
+
end
|
121
129
|
end
|
122
130
|
end
|
123
|
-
end
|
124
131
|
|
125
|
-
|
126
|
-
|
127
|
-
|
132
|
+
################################################
|
133
|
+
## HELPER METHODS
|
134
|
+
##
|
128
135
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
136
|
+
# Set the current project. This is used mostly for unit testing.
|
137
|
+
def project=(a_project)
|
138
|
+
@project = a_project
|
139
|
+
end
|
133
140
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
141
|
+
# The current project. This is discovered based on the passed --project
|
142
|
+
# option or based on the current working directory. If no project can
|
143
|
+
# be found, this method will always return null.
|
144
|
+
def project
|
145
|
+
return @project if @discovered_project # cache - @project may be nil
|
146
|
+
@discovered_project = true
|
140
147
|
|
141
|
-
|
142
|
-
|
148
|
+
ret = nil
|
149
|
+
project_path = options.project || options.library
|
143
150
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
151
|
+
# if no project_path is named explicitly, attempt to autodiscover from
|
152
|
+
# working dir. If none is found, just set project to nil
|
153
|
+
unless project_path
|
154
|
+
debug "No project path specified. Searching for projects in #{Dir.pwd}"
|
155
|
+
ret = SC::Project.load_nearest_project Dir.pwd, :parent => SC.builtin_project
|
149
156
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
+
# if project path is specified, look there. If no project is found
|
158
|
+
# die with a fatal exception.
|
159
|
+
else
|
160
|
+
debug "Project path specified at #{project_path}"
|
161
|
+
ret = SC::Project.load File.expand_path(project_path), :parent => SC.builtin_project
|
162
|
+
if ret.nil?
|
163
|
+
fatal! "Could not load project at #{project_path}"
|
164
|
+
end
|
157
165
|
end
|
158
|
-
end
|
159
166
|
|
160
|
-
|
161
|
-
|
162
|
-
|
167
|
+
info "Loaded project at: #{ret.project_root}" unless ret.nil?
|
168
|
+
@project = ret
|
169
|
+
end
|
163
170
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
+
# Attempts to discover the current project. If no project can be found
|
172
|
+
# throws a fatal exception. Use this method at the top of your tool
|
173
|
+
# method if you require a project to run.
|
174
|
+
def requires_project!
|
175
|
+
ret = project
|
176
|
+
if ret.nil?
|
177
|
+
fatal!("You do not appear to be inside of a project. Try changing to your project directory or make sure your project as a Buildfile or sc-config")
|
178
|
+
end
|
179
|
+
return ret
|
171
180
|
end
|
172
|
-
return ret
|
173
|
-
end
|
174
181
|
|
175
|
-
|
176
|
-
|
177
|
-
|
182
|
+
# Find one or more targets with the passed target names in the current
|
183
|
+
# project. Requires a project to function.
|
184
|
+
def find_targets(*targets)
|
178
185
|
|
179
|
-
|
180
|
-
|
186
|
+
debug "finding targets with names: '#{targets * "','"}'"
|
187
|
+
requires_project!
|
181
188
|
|
182
|
-
|
183
|
-
|
184
|
-
|
189
|
+
# Filter out any empty target names. Sometimes this happens when
|
190
|
+
# processing arguments.
|
191
|
+
targets.reject! { |x| x.nil? || x.size == 0 }
|
185
192
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
193
|
+
# If targets are specified, find the targets project or parents...
|
194
|
+
if targets.size > 0
|
195
|
+
targets = targets.map do |target_name|
|
196
|
+
begin
|
197
|
+
ret = project.target_for(target_name)
|
198
|
+
rescue Exception => e
|
199
|
+
SC.logger.fatal("Exception when searching for target #{target_name}. Perhaps your Buildfile is configured wrong?")
|
200
|
+
raise e
|
201
|
+
end
|
195
202
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
203
|
+
if ret.nil?
|
204
|
+
fatal! "No target named #{target_name} could be found in PROJECT:#{project.project_root}"
|
205
|
+
else
|
206
|
+
debug "Found target '#{target_name}' at PROJECT:#{ret.source_root.sub(/^#{project.project_root}\//,'')}"
|
207
|
+
end
|
208
|
+
ret
|
200
209
|
end
|
201
|
-
ret
|
202
|
-
end
|
203
210
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
211
|
+
# IF no targets are specified, then just get all targets in project.
|
212
|
+
# If --all option was specified, include those that do not autobuild
|
213
|
+
else
|
214
|
+
targets = project.targets.values
|
215
|
+
unless options.all?
|
216
|
+
targets.reject! { |t| !t.config.autobuild? }
|
217
|
+
end
|
218
|
+
end
|
212
219
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
220
|
+
# If include required was specified, merge in all required bundles as
|
221
|
+
# well.
|
222
|
+
if options['include-required']
|
223
|
+
targets.each do |target|
|
224
|
+
targets += target.expand_required_targets :theme => true,
|
225
|
+
:debug => target.config.load_debug,
|
226
|
+
:tests => target.config.load_tests
|
227
|
+
end
|
221
228
|
|
222
|
-
|
223
|
-
|
229
|
+
targets = targets.flatten.uniq.compact
|
230
|
+
end
|
224
231
|
|
225
|
-
|
226
|
-
end
|
227
|
-
|
228
|
-
# Wraps around find_targets but raises an exception if no target is
|
229
|
-
# specified.
|
230
|
-
def requires_targets!(*target_names)
|
231
|
-
if target_names.size == 0
|
232
|
-
fatal! "You must specify a target with this command"
|
232
|
+
return targets
|
233
233
|
end
|
234
234
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
235
|
+
# Wraps around find_targets but raises an exception if no target is
|
236
|
+
# specified.
|
237
|
+
def requires_targets!(*target_names)
|
238
|
+
if target_names.size == 0
|
239
|
+
fatal! "You must specify a target with this command"
|
240
|
+
end
|
241
|
+
|
242
|
+
targets = find_targets(*target_names)
|
243
|
+
if targets.size == 0
|
244
|
+
fatal! "No targets matching #{target_names * ","} were found."
|
245
|
+
end
|
239
246
|
|
240
|
-
|
241
|
-
|
247
|
+
targets
|
248
|
+
end
|
242
249
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
250
|
+
# Requires exactly one target.
|
251
|
+
def requires_target!(*targets)
|
252
|
+
requires_targets!(*targets).first
|
253
|
+
end
|
247
254
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
255
|
+
# Discovers the languages requested by the user for a build. Uses the
|
256
|
+
# --languages command line option or disovers in targets.
|
257
|
+
def find_languages(*targets)
|
258
|
+
# Use passed languages. If none are specified, merge installed
|
259
|
+
# languages for all app targets.
|
260
|
+
unless (languages = options.languages)
|
261
|
+
languages = targets.map { |t| t.installed_languages }
|
262
|
+
else
|
263
|
+
languages = languages.split(',').map { |l| l.to_sym }
|
264
|
+
end
|
265
|
+
languages.flatten.uniq.compact
|
257
266
|
end
|
258
|
-
languages.flatten.uniq.compact
|
259
|
-
end
|
260
267
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
268
|
+
# Discovers build numbers requested for the build and sets them in the
|
269
|
+
# in the env if needed.
|
270
|
+
def find_build_numbers(*targets)
|
271
|
+
if options['build-numbers']
|
272
|
+
numbers = {}
|
273
|
+
options['build-numbers'].split(',').each do |pair|
|
274
|
+
pair = pair.split(':')
|
275
|
+
if pair.length < 2
|
276
|
+
fatal! "Could not parse build numbers! #{options['build-numbers']}"
|
277
|
+
end
|
278
|
+
numbers["/#{pair[0]}"] = pair[1]
|
270
279
|
end
|
271
|
-
|
280
|
+
SC.env.build_numbers = numbers
|
281
|
+
SC.logger.info "Using build numbers: #{numbers.map { |k,v| "#{k}: #{v}" }.join(',')}"
|
272
282
|
end
|
273
|
-
SC.env.build_numbers = numbers
|
274
|
-
SC.logger.info "Using build numbers: #{numbers.map { |k,v| "#{k}: #{v}" }.join(',')}"
|
275
283
|
end
|
276
|
-
end
|
277
284
|
|
278
|
-
|
279
|
-
|
280
|
-
|
285
|
+
# Core method to process command line options and then build a manifest.
|
286
|
+
# Shared by sc-manifest, sc-build and sc-docs commands.
|
287
|
+
def build_manifests(*targets)
|
281
288
|
|
282
|
-
|
283
|
-
|
289
|
+
# setup build numbers
|
290
|
+
find_build_numbers(*targets)
|
284
291
|
|
285
|
-
|
286
|
-
|
287
|
-
|
292
|
+
requires_project! # get project
|
293
|
+
targets = find_targets(*targets) # get targets
|
294
|
+
languages = find_languages(*targets) # get languages
|
288
295
|
|
289
|
-
|
290
|
-
|
291
|
-
|
296
|
+
# log output
|
297
|
+
SC.logger.info "Building targets: #{targets.map { |t| t.target_name } * ","}"
|
298
|
+
SC.logger.info "Building languages: #{ languages * "," }"
|
292
299
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
300
|
+
# Now fetch the manifests to build. One per target/language
|
301
|
+
manifests = targets.map do |target|
|
302
|
+
languages.map { |l| target.manifest_for :language => l }
|
303
|
+
end
|
304
|
+
manifests.flatten!
|
298
305
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
306
|
+
# Build'em
|
307
|
+
manifests.each do |manifest|
|
308
|
+
SC.logger.info "Building manifest for: #{manifest.target.target_name}:#{manifest.language}"
|
309
|
+
manifest.build!
|
310
|
+
end
|
304
311
|
|
305
|
-
|
306
|
-
|
312
|
+
return manifests
|
313
|
+
end
|
307
314
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
315
|
+
# Logs the contents of the passed file path to the logger
|
316
|
+
def log_file(path)
|
317
|
+
if !File.exists?(path)
|
318
|
+
warn "Could not display #{File.basename(path)} at #{File.dirname(path)} because it does not exist."
|
319
|
+
end
|
320
|
+
file_text = File.read(path)
|
321
|
+
SC.logger << file_text
|
322
|
+
SC.logger << "\n"
|
312
323
|
end
|
313
|
-
file_text = File.read(path)
|
314
|
-
SC.logger << file_text
|
315
|
-
SC.logger << "\n"
|
316
|
-
end
|
317
324
|
|
318
|
-
|
319
|
-
|
320
|
-
|
325
|
+
################################################
|
326
|
+
## MAIN ENTRYPOINT
|
327
|
+
##
|
321
328
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
329
|
+
# Fix start so that it treats command-name like command_name
|
330
|
+
def self.start(args = ARGV)
|
331
|
+
# manually check for verbose in case we don't get far enough in
|
332
|
+
# regular processing to actually set the verbose mode.
|
333
|
+
is_verbose = %w(-v -V --verbose --very-verbose).any? { |x| args.include?(x) }
|
334
|
+
begin
|
335
|
+
super(args)
|
336
|
+
rescue Exception => e
|
337
|
+
SC.logger.fatal(e)
|
338
|
+
if is_verbose && !e.kind_of?(FatalException)
|
339
|
+
SC.logger.fatal("BACKTRACE:\n#{e.backtrace.join("\n")}\n")
|
340
|
+
end
|
333
341
|
end
|
334
342
|
end
|
335
|
-
|
343
|
+
|
344
|
+
end # no_tasks
|
336
345
|
|
337
346
|
end
|
338
347
|
|
data/lib/sproutcore.rb
CHANGED
@@ -9,17 +9,25 @@ require 'logger'
|
|
9
9
|
require 'extlib'
|
10
10
|
require 'yaml'
|
11
11
|
|
12
|
+
# Ruby 1.8 Compatibility
|
12
13
|
if (RUBY_VERSION.match(/1\.8/))
|
13
14
|
$KCODE = 'u'
|
14
15
|
require 'jcode'
|
15
16
|
class String ; def valid_encoding? ; true ; end ; end
|
16
17
|
end
|
17
18
|
|
19
|
+
# Ruby 1.9 Compatibility
|
20
|
+
if (RUBY_VERSION.match(/1\.9/))
|
21
|
+
# Fix for Rack Ruby 1.9 incompatibility. This makes 404s render again.
|
22
|
+
class String
|
23
|
+
alias each each_line unless ''.respond_to?(:each)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
18
27
|
# Makes code more readable
|
19
28
|
YES = true
|
20
29
|
NO = false
|
21
30
|
|
22
|
-
|
23
31
|
module SproutCore
|
24
32
|
|
25
33
|
# :stopdoc:
|
@@ -180,7 +180,7 @@ describe "manifest:prepare_build_tasks:combine" do
|
|
180
180
|
@project = fixture_project :ordered_entries
|
181
181
|
end
|
182
182
|
|
183
|
-
it "orders entries as lproj/strings -> core -> utils -> others alphabetically without requires" do
|
183
|
+
it "orders entries as lproj/strings -> core -> utils -> others alphabetically without requires -> resources/*_page.js -> main.js}" do
|
184
184
|
|
185
185
|
@target = @project.target_for :no_requires
|
186
186
|
@buildfile = @target.buildfile
|
@@ -193,7 +193,7 @@ describe "manifest:prepare_build_tasks:combine" do
|
|
193
193
|
|
194
194
|
# get the expected set of ordered entries...based on contents of
|
195
195
|
# project...
|
196
|
-
expected = %w(bundle_info.js 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)
|
196
|
+
expected = %w(bundle_info.js 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)
|
197
197
|
|
198
198
|
entry.ordered_entries.should_not be_nil
|
199
199
|
filenames = entry.ordered_entries.map { |e| e.filename }
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
// main.js
|
@@ -0,0 +1 @@
|
|
1
|
+
// main_page.js
|
@@ -0,0 +1 @@
|
|
1
|
+
// t.js
|