sugarcube 2.12.3 → 3.0.0
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/all/sugarcube-repl/repl.rb +191 -0
- data/lib/all/sugarcube/log.rb +2 -2
- data/lib/android/sugarcube-repl/repl.rb +42 -0
- data/lib/android/sugarcube/log.rb +8 -0
- data/lib/cocoa/sugarcube-repl/repl.rb +48 -214
- data/lib/cocoa/sugarcube/log.rb +1 -1
- data/lib/ios/sugarcube-568/uiimage.rb +3 -0
- data/lib/ios/sugarcube-repl/repl.rb +27 -30
- data/lib/osx/sugarcube-repl/repl.rb +14 -25
- data/lib/sugarcube-568.rb +2 -9
- data/lib/sugarcube-animations.rb +2 -12
- data/lib/sugarcube-anonymous.rb +2 -9
- data/lib/sugarcube-appkit.rb +3 -12
- data/lib/sugarcube-attributedstring.rb +3 -12
- data/lib/sugarcube-awesome.rb +2 -9
- data/lib/sugarcube-color.rb +2 -9
- data/lib/sugarcube-constants.rb +2 -9
- data/lib/sugarcube-coregraphics.rb +3 -9
- data/lib/sugarcube-corelocation.rb +6 -9
- data/lib/sugarcube-events.rb +2 -9
- data/lib/sugarcube-factories.rb +2 -9
- data/lib/sugarcube-files.rb +2 -9
- data/lib/sugarcube-foundation.rb +3 -9
- data/lib/sugarcube-gestures.rb +2 -9
- data/lib/sugarcube-image.rb +2 -9
- data/lib/sugarcube-indexpath.rb +2 -9
- data/lib/sugarcube-legacy.rb +2 -18
- data/lib/sugarcube-localized.rb +2 -9
- data/lib/sugarcube-modal.rb +2 -9
- data/lib/sugarcube-notifications.rb +2 -9
- data/lib/sugarcube-nscoder.rb +3 -9
- data/lib/sugarcube-nsdata.rb +3 -12
- data/lib/sugarcube-nsdate.rb +3 -14
- data/lib/sugarcube-nsuserdefaults.rb +3 -9
- data/lib/sugarcube-numbers.rb +2 -15
- data/lib/sugarcube-pipes.rb +2 -9
- data/lib/sugarcube-pointer.rb +2 -9
- data/lib/sugarcube-repl.rb +2 -16
- data/lib/sugarcube-spritekit.rb +6 -12
- data/lib/sugarcube-timer.rb +2 -14
- data/lib/sugarcube-to_s.rb +2 -15
- data/lib/sugarcube-uikit.rb +3 -12
- data/lib/sugarcube-unholy.rb +2 -9
- data/lib/sugarcube.rb +33 -19
- data/lib/sugarcube_pre_setup.rb +44 -0
- data/lib/version.rb +1 -1
- data/spec/cocoa/nsindexpath_spec.rb +12 -0
- metadata +9 -6
- data/lib/ios/sugarcube/sugarcube_cleanup.rb +0 -16
data/lib/sugarcube-gestures.rb
CHANGED
@@ -6,13 +6,6 @@ end
|
|
6
6
|
require 'sugarcube'
|
7
7
|
SugarCube.ios_only!('gestures')
|
8
8
|
|
9
|
-
Motion::Project::App.
|
10
|
-
|
11
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
12
|
-
# the end of the list
|
13
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
14
|
-
|
15
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'ios/sugarcube-gestures/**/*.rb')).reverse.each do |file|
|
16
|
-
app.files.insert(insert_point, file)
|
17
|
-
end
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-gestures')
|
18
11
|
end
|
data/lib/sugarcube-image.rb
CHANGED
@@ -5,13 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), SugarCube.platform, 'sugarcube-image/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-image')
|
17
10
|
end
|
data/lib/sugarcube-indexpath.rb
CHANGED
@@ -5,13 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-indexpath/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-indexpath')
|
17
10
|
end
|
data/lib/sugarcube-legacy.rb
CHANGED
@@ -5,22 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
if SugarCube.ios?
|
15
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'ios/sugarcube/**/*.rb')).reverse.each do |file|
|
16
|
-
app.files.insert(insert_point, file)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-legacy/**/*.rb')).reverse.each do |file|
|
21
|
-
app.files.insert(insert_point, file)
|
22
|
-
end
|
23
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'all/sugarcube-legacy/**/*.rb')).reverse.each do |file|
|
24
|
-
app.files.insert(insert_point, file)
|
25
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-legacy')
|
26
10
|
end
|
data/lib/sugarcube-localized.rb
CHANGED
@@ -5,13 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-localized/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-localized')
|
17
10
|
end
|
data/lib/sugarcube-modal.rb
CHANGED
@@ -6,13 +6,6 @@ end
|
|
6
6
|
require 'sugarcube'
|
7
7
|
SugarCube.ios_only!('modal')
|
8
8
|
|
9
|
-
Motion::Project::App.
|
10
|
-
|
11
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
12
|
-
# the end of the list
|
13
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
14
|
-
|
15
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'ios/sugarcube-modal/**/*.rb')).reverse.each do |file|
|
16
|
-
app.files.insert(insert_point, file)
|
17
|
-
end
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-modal')
|
18
11
|
end
|
@@ -5,13 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-notifications/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-notifications')
|
17
10
|
end
|
data/lib/sugarcube-nscoder.rb
CHANGED
@@ -4,14 +4,8 @@ end
|
|
4
4
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
|
+
SugarCube.cocoa_only!('nscoder')
|
7
8
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-nscoder/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-nscoder')
|
17
11
|
end
|
data/lib/sugarcube-nsdata.rb
CHANGED
@@ -4,17 +4,8 @@ end
|
|
4
4
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
|
+
SugarCube.cocoa_only!('nsdata')
|
7
8
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), SugarCube.platform, 'sugarcube-nsdata/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
17
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-nsdata/**/*.rb')).reverse.each do |file|
|
18
|
-
app.files.insert(insert_point, file)
|
19
|
-
end
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-nsdata')
|
20
11
|
end
|
data/lib/sugarcube-nsdate.rb
CHANGED
@@ -4,19 +4,8 @@ end
|
|
4
4
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
|
+
SugarCube.cocoa_only!('nsdate')
|
7
8
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-nsdate/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
17
|
-
|
18
|
-
time_rb = File.join(File.dirname(__FILE__), 'all/sugarcube-numbers/time.rb')
|
19
|
-
unless app.files.include?(time_rb)
|
20
|
-
app.files.insert(insert_point, time_rb)
|
21
|
-
end
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-nsdate')
|
22
11
|
end
|
@@ -4,14 +4,8 @@ end
|
|
4
4
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
|
+
SugarCube.cocoa_only!('nsuserdefaults')
|
7
8
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-nsuserdefaults/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-nsuserdefaults')
|
17
11
|
end
|
data/lib/sugarcube-numbers.rb
CHANGED
@@ -5,19 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), SugarCube.platform, 'sugarcube-numbers/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
17
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-numbers/**/*.rb')).reverse.each do |file|
|
18
|
-
app.files.insert(insert_point, file)
|
19
|
-
end
|
20
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'all/sugarcube-numbers/**/*.rb')).reverse.each do |file|
|
21
|
-
app.files.insert(insert_point, file)
|
22
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-numbers')
|
23
10
|
end
|
data/lib/sugarcube-pipes.rb
CHANGED
@@ -5,13 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), SugarCube.platform, 'sugarcube-pipes/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-pipes')
|
17
10
|
end
|
data/lib/sugarcube-pointer.rb
CHANGED
@@ -5,13 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-pointer/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-pointer')
|
17
10
|
end
|
data/lib/sugarcube-repl.rb
CHANGED
@@ -5,22 +5,8 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
# This package is only available in development
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
10
9
|
app.development do
|
11
|
-
|
12
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
13
|
-
# the end of the list
|
14
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
15
|
-
|
16
|
-
Dir.glob(File.join(File.dirname(__FILE__), SugarCube.platform, 'sugarcube-repl/**/*.rb')).reverse.each do |file|
|
17
|
-
app.files.insert(insert_point, file)
|
18
|
-
end
|
19
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-repl/**/*.rb')).reverse.each do |file|
|
20
|
-
app.files.insert(insert_point, file)
|
21
|
-
end
|
22
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'all/sugarcube-repl/**/*.rb')).reverse.each do |file|
|
23
|
-
app.files.insert(insert_point, file)
|
24
|
-
end
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-repl')
|
25
11
|
end
|
26
12
|
end
|
data/lib/sugarcube-spritekit.rb
CHANGED
@@ -4,19 +4,13 @@ end
|
|
4
4
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
|
+
SugarCube.cocoa_only!('spritekit')
|
7
8
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-spritekit')
|
11
|
+
end
|
13
12
|
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), SugarCube.platform, '/sugarcube-spritekit/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
17
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-spritekit/**/*.rb')).reverse.each do |file|
|
18
|
-
app.files.insert(insert_point, file)
|
19
|
-
end
|
20
13
|
|
21
|
-
|
14
|
+
Motion::Project::App.post_setup do |app|
|
15
|
+
app.frameworks += %w{SpriteKit}
|
22
16
|
end
|
data/lib/sugarcube-timer.rb
CHANGED
@@ -5,18 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-timer/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
17
|
-
|
18
|
-
time_rb = File.join(File.dirname(__FILE__), 'all/sugarcube-numbers/time.rb')
|
19
|
-
unless app.files.include?(time_rb)
|
20
|
-
app.files.insert(insert_point, time_rb)
|
21
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-timer')
|
22
10
|
end
|
data/lib/sugarcube-to_s.rb
CHANGED
@@ -5,19 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), SugarCube.platform, 'sugarcube-to_s/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
17
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-to_s/**/*.rb')).reverse.each do |file|
|
18
|
-
app.files.insert(insert_point, file)
|
19
|
-
end
|
20
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'all/sugarcube-to_s/**/*.rb')).reverse.each do |file|
|
21
|
-
app.files.insert(insert_point, file)
|
22
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-to_s')
|
23
10
|
end
|
data/lib/sugarcube-uikit.rb
CHANGED
@@ -6,16 +6,7 @@ end
|
|
6
6
|
require 'sugarcube'
|
7
7
|
SugarCube.ios_only!('uikit')
|
8
8
|
|
9
|
-
Motion::Project::App.
|
10
|
-
|
11
|
-
|
12
|
-
# the end of the list
|
13
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
14
|
-
|
15
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'ios/sugarcube-uikit/**/*.rb')).reverse.each do |file|
|
16
|
-
app.files.insert(insert_point, file)
|
17
|
-
end
|
18
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube-cocoakit/**/*.rb')).reverse.each do |file|
|
19
|
-
app.files.insert(insert_point, file)
|
20
|
-
end
|
9
|
+
Motion::Project::App.pre_setup do |app|
|
10
|
+
SugarCube.add_app_files(app, 'sugarcube-cocoakit')
|
11
|
+
SugarCube.add_app_files(app, 'sugarcube-uikit')
|
21
12
|
end
|
data/lib/sugarcube-unholy.rb
CHANGED
@@ -5,13 +5,6 @@ end
|
|
5
5
|
|
6
6
|
require 'sugarcube'
|
7
7
|
|
8
|
-
Motion::Project::App.
|
9
|
-
|
10
|
-
# if found, it inserts just before those files, otherwise it will insert to
|
11
|
-
# the end of the list
|
12
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
13
|
-
|
14
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'all/sugarcube-unholy/**/*.rb')).reverse.each do |file|
|
15
|
-
app.files.insert(insert_point, file)
|
16
|
-
end
|
8
|
+
Motion::Project::App.pre_setup do |app|
|
9
|
+
SugarCube.add_app_files(app, 'sugarcube-unholy')
|
17
10
|
end
|
data/lib/sugarcube.rb
CHANGED
@@ -24,16 +24,22 @@ module SugarCube
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def android_only!(package)
|
28
|
+
unless android?
|
29
|
+
raise "The '\033[0;1msugarcube-#{package}\033[0m' package is only available on Android."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
27
33
|
def ios?
|
28
|
-
App.template.to_s =~ /
|
34
|
+
App.template.to_s =~ /\bios\b/
|
29
35
|
end
|
30
36
|
|
31
37
|
def osx?
|
32
|
-
App.template.to_s =~ /
|
38
|
+
App.template.to_s =~ /\bosx\b/
|
33
39
|
end
|
34
40
|
|
35
41
|
def android?
|
36
|
-
App.template.to_s =~ /
|
42
|
+
App.template.to_s =~ /\bandroid\b/
|
37
43
|
end
|
38
44
|
|
39
45
|
def cocoa?
|
@@ -52,25 +58,33 @@ module SugarCube
|
|
52
58
|
end
|
53
59
|
end
|
54
60
|
|
61
|
+
def add_app_files(app, package_name)
|
62
|
+
# scans app.files until it finds app/ (the default)
|
63
|
+
# if found, it inserts just before those files, otherwise it will insert to
|
64
|
+
# the end of the list
|
65
|
+
platforms = ['all']
|
66
|
+
if SugarCube.cocoa?
|
67
|
+
platforms << 'cocoa'
|
68
|
+
end
|
69
|
+
platforms << SugarCube.platform # ios, osx, or android specific files
|
70
|
+
|
71
|
+
platforms.each do |platform|
|
72
|
+
Dir.glob(File.join(File.dirname(__FILE__), platform, package_name, '**/*.rb')).each do |file|
|
73
|
+
app.files << file
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
55
78
|
end
|
56
79
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
# the end of the list
|
61
|
-
insert_point = app.files.find_index { |file| file =~ /^(?:\.\/)?app\// } || 0
|
80
|
+
if ! App.respond_to?(:pre_setup)
|
81
|
+
require 'sugarcube_pre_setup'
|
82
|
+
end
|
62
83
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'cocoa/sugarcube/**/*.rb')).reverse.each do |file|
|
68
|
-
app.files.insert(insert_point, file)
|
69
|
-
end
|
70
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'all/sugarcube/**/*.rb')).reverse.each do |file|
|
71
|
-
app.files.insert(insert_point, file)
|
72
|
-
end
|
84
|
+
Motion::Project::App.pre_setup do |app|
|
85
|
+
app.files << File.join(File.dirname(__FILE__), 'version.rb')
|
86
|
+
|
87
|
+
SugarCube.add_app_files(app, 'sugarcube')
|
73
88
|
end
|
74
89
|
|
75
|
-
require File.join(File.dirname(__FILE__), 'sugarcube-coregraphics.rb')
|
76
90
|
require File.join(File.dirname(__FILE__), 'sugarcube-to_s.rb')
|