motion-schemes 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +16 -0
- data/README.md +59 -0
- data/Rakefile +30 -0
- data/app/app_delegate.rb +5 -0
- data/lib/motion-schemes.rb +6 -0
- data/lib/motion/project/config.rb +33 -0
- data/lib/motion/project/schemes.rb +11 -0
- data/motion-schemes.gemspec +15 -0
- data/spec/main_spec.rb +9 -0
- metadata +81 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# motion-schemes
|
2
|
+
|
3
|
+
Expand RubyMotion build system to support building multiple apps from one project.
|
4
|
+
|
5
|
+
## Setup
|
6
|
+
|
7
|
+
Install the gem:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem install motion-schemes
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Require the gem in Rakefile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'rubygems'
|
19
|
+
require 'motion-schemes'
|
20
|
+
```
|
21
|
+
|
22
|
+
Specify your common build setting as you normally would. Use app.scheme to specify the current build scheme.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
Motion::Project::App.setup do |app|
|
26
|
+
app.name = 'motion-schemes'
|
27
|
+
app.scheme = :ipad
|
28
|
+
|
29
|
+
# Your regular shared app setup
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
Use Motion::Project::App.scheme to specify custom app settings for a scheme:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Motion::Project::App.scheme(:iphone) do |app|
|
37
|
+
app.device_family = :iphone
|
38
|
+
app.interface_orientations = [:portrait]
|
39
|
+
end
|
40
|
+
|
41
|
+
Motion::Project::App.scheme(:ipad) do |app|
|
42
|
+
app.device_family = :ipad
|
43
|
+
app.interface_orientations = [:portrait, :landscape_left, :landscape_right, :portrait_upside_down]
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
Run ```rake``` to build the app using selected scheme.
|
48
|
+
|
49
|
+
## License
|
50
|
+
|
51
|
+
```
|
52
|
+
Copyright (c) 2013, Francis Chong <francis@ignition.hk>
|
53
|
+
|
54
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
55
|
+
|
56
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
57
|
+
|
58
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
59
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift("/Library/RubyMotion/lib")
|
3
|
+
require 'motion/project'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler'
|
6
|
+
Bundler.require(:default)
|
7
|
+
|
8
|
+
require './lib/motion-schemes'
|
9
|
+
|
10
|
+
Motion::Project::App.setup do |app|
|
11
|
+
app.name = 'motion-schemes'
|
12
|
+
app.scheme = :ipad
|
13
|
+
end
|
14
|
+
|
15
|
+
Motion::Project::App.scheme(:iphone) do |app|
|
16
|
+
app.device_family = :iphone
|
17
|
+
app.interface_orientations = [:portrait]
|
18
|
+
end
|
19
|
+
|
20
|
+
Motion::Project::App.scheme(:ipad) do |app|
|
21
|
+
app.device_family = :ipad
|
22
|
+
app.interface_orientations = [:portrait, :landscape_left, :landscape_right, :portrait_upside_down]
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Build the gem"
|
26
|
+
task :gem do
|
27
|
+
sh "bundle exec gem build motion-schemes.gemspec"
|
28
|
+
sh "mkdir -p pkg"
|
29
|
+
sh "mv *.gem pkg/"
|
30
|
+
end
|
data/app/app_delegate.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Motion
|
2
|
+
module Project
|
3
|
+
class Config
|
4
|
+
variable :scheme
|
5
|
+
|
6
|
+
alias_method :setup_before_scheme, :setup
|
7
|
+
def setup
|
8
|
+
if schemes.size > 0
|
9
|
+
setup_before_scheme
|
10
|
+
|
11
|
+
current_scheme = scheme || schemes.keys.first
|
12
|
+
if current_scheme && schemes[current_scheme]
|
13
|
+
schemes[current_scheme].call(self)
|
14
|
+
validate
|
15
|
+
self
|
16
|
+
else
|
17
|
+
raise ArgumentError, "Invalid scheme: #{current_scheme}, scheme must be one of: #{schemes.keys}"
|
18
|
+
end
|
19
|
+
else
|
20
|
+
setup_before_scheme
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def schemes
|
25
|
+
@schemes ||= {}
|
26
|
+
end
|
27
|
+
|
28
|
+
def config_scheme(name, &block)
|
29
|
+
schemes[name] = block
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.authors = ["Francis Chong"]
|
3
|
+
gem.email = ["francis@ignition.hk"]
|
4
|
+
gem.description = "Expand RubyMotion build system to support building multiple apps from one project."
|
5
|
+
gem.summary = "Expand RubyMotion build system to support building multiple apps from one project."
|
6
|
+
gem.homepage = "https://github.com/siuying/motion-schemes"
|
7
|
+
|
8
|
+
gem.files = `git ls-files`.split($\)
|
9
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|lib_spec|features)/})
|
10
|
+
gem.name = "motion-schemes"
|
11
|
+
gem.require_paths = ["lib"]
|
12
|
+
gem.version = "0.0.1"
|
13
|
+
|
14
|
+
gem.add_development_dependency 'rake'
|
15
|
+
end
|
data/spec/main_spec.rb
ADDED
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-schemes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Francis Chong
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Expand RubyMotion build system to support building multiple apps from
|
31
|
+
one project.
|
32
|
+
email:
|
33
|
+
- francis@ignition.hk
|
34
|
+
executables: []
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- Gemfile.lock
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- app/app_delegate.rb
|
44
|
+
- lib/motion-schemes.rb
|
45
|
+
- lib/motion/project/config.rb
|
46
|
+
- lib/motion/project/schemes.rb
|
47
|
+
- motion-schemes.gemspec
|
48
|
+
- spec/main_spec.rb
|
49
|
+
homepage: https://github.com/siuying/motion-schemes
|
50
|
+
licenses: []
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
hash: -3469850448812175496
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
hash: -3469850448812175496
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.8.23
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: Expand RubyMotion build system to support building multiple apps from one
|
79
|
+
project.
|
80
|
+
test_files:
|
81
|
+
- spec/main_spec.rb
|