ib 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +74 -0
- data/Guardfile +11 -0
- data/ib.gemspec +7 -5
- data/lib/ib/project.rb +77 -29
- data/lib/ib/version.rb +1 -1
- data/spec/lib/ib/project_spec.rb +97 -14
- metadata +42 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b75eb6cb59e35f8e2da35efcb3924af929fcfbea
|
4
|
+
data.tar.gz: df494cb83f25698ffc1d8e2f7115e1b43c0b1824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 386d5f7606d8891d11c51e9a22bb5111eca748f9c2b78dbe369c268435ad895fbd7a8f326bacca3777e0e1809dd66b94e574c5ab38864fed5254df9f59d2357e
|
7
|
+
data.tar.gz: 236695bec33e3437f71c71e4588e0ff7fc8bd2ec82d47a5d0644b5a8c224bdea63b95065699811bb4ccf939a84e11b34ba909ad3eeb7a2abc2c089c2ac534950
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ib (0.4.4)
|
5
|
+
thor (~> 0.15.4)
|
6
|
+
tilt (~> 1.4.1)
|
7
|
+
xcodeproj (~> 0.16.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (3.2.17)
|
13
|
+
i18n (~> 0.6, >= 0.6.4)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
coderay (1.1.0)
|
16
|
+
colored (1.2)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
ffi (1.9.3)
|
19
|
+
formatador (0.2.4)
|
20
|
+
guard (1.8.3)
|
21
|
+
formatador (>= 0.2.4)
|
22
|
+
listen (~> 1.3)
|
23
|
+
lumberjack (>= 1.0.2)
|
24
|
+
pry (>= 0.9.10)
|
25
|
+
thor (>= 0.14.6)
|
26
|
+
guard-bundler (1.0.0)
|
27
|
+
bundler (~> 1.0)
|
28
|
+
guard (~> 1.1)
|
29
|
+
guard-rspec (3.1.0)
|
30
|
+
guard (>= 1.8)
|
31
|
+
rspec (~> 2.13)
|
32
|
+
i18n (0.6.9)
|
33
|
+
listen (1.3.1)
|
34
|
+
rb-fsevent (>= 0.9.3)
|
35
|
+
rb-inotify (>= 0.9)
|
36
|
+
rb-kqueue (>= 0.2)
|
37
|
+
lumberjack (1.0.5)
|
38
|
+
method_source (0.8.2)
|
39
|
+
multi_json (1.9.2)
|
40
|
+
pry (0.9.12.6)
|
41
|
+
coderay (~> 1.0)
|
42
|
+
method_source (~> 0.8)
|
43
|
+
slop (~> 3.4)
|
44
|
+
rake (10.2.2)
|
45
|
+
rb-fsevent (0.9.4)
|
46
|
+
rb-inotify (0.9.3)
|
47
|
+
ffi (>= 0.5.0)
|
48
|
+
rb-kqueue (0.2.2)
|
49
|
+
ffi (>= 0.5.0)
|
50
|
+
rspec (2.14.1)
|
51
|
+
rspec-core (~> 2.14.0)
|
52
|
+
rspec-expectations (~> 2.14.0)
|
53
|
+
rspec-mocks (~> 2.14.0)
|
54
|
+
rspec-core (2.14.8)
|
55
|
+
rspec-expectations (2.14.5)
|
56
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
57
|
+
rspec-mocks (2.14.6)
|
58
|
+
slop (3.5.0)
|
59
|
+
thor (0.15.4)
|
60
|
+
tilt (1.4.1)
|
61
|
+
xcodeproj (0.16.0)
|
62
|
+
activesupport (~> 3.0)
|
63
|
+
colored (~> 1.2)
|
64
|
+
|
65
|
+
PLATFORMS
|
66
|
+
ruby
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
bundler
|
70
|
+
guard-bundler
|
71
|
+
guard-rspec
|
72
|
+
ib!
|
73
|
+
rake
|
74
|
+
rspec (~> 2.0)
|
data/Guardfile
ADDED
data/ib.gemspec
CHANGED
@@ -15,10 +15,12 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = IB::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency
|
19
|
-
gem.add_dependency
|
20
|
-
gem.add_dependency
|
18
|
+
gem.add_dependency 'xcodeproj', '~> 0.16.0'
|
19
|
+
gem.add_dependency 'thor', '~> 0.15.4'
|
20
|
+
gem.add_dependency 'tilt', '~> 1.4.1'
|
21
21
|
|
22
|
-
gem.add_development_dependency
|
23
|
-
gem.add_development_dependency
|
22
|
+
gem.add_development_dependency 'rspec', '~> 2.0'
|
23
|
+
gem.add_development_dependency 'rake'
|
24
|
+
gem.add_development_dependency 'guard-rspec'
|
25
|
+
gem.add_development_dependency 'guard-bundler'
|
24
26
|
end
|
data/lib/ib/project.rb
CHANGED
@@ -1,22 +1,70 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
class IB::Project
|
3
|
-
attr_accessor :platform
|
3
|
+
attr_accessor :platform
|
4
|
+
attr_accessor :project_path
|
5
|
+
|
6
|
+
IB_PROJECT_NAME = 'ib.xcodeproj'
|
7
|
+
DEFAULT_FRAMEWORKS = %W{QuartzCore CoreGraphics CoreData}
|
8
|
+
RESOURCE_EXTENSIONS = %W{xcdatamodeld png jpg jpeg storyboard xib lproj}
|
4
9
|
|
5
10
|
def initialize options={}
|
6
|
-
@platform
|
7
|
-
@project_path
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
@platform = options[:platform] || detect_platform
|
12
|
+
@project_path = options[:project_path] || Dir.pwd
|
13
|
+
end
|
14
|
+
|
15
|
+
# Writes a new ib.xcodeproj to the provided `#project_path`.
|
16
|
+
# The following steps will occur
|
17
|
+
#
|
18
|
+
# * `setup_paths` - This step sets up the paths to your project's 'resources',
|
19
|
+
# 'pods' and 'supporting files'.
|
20
|
+
# * `generate_stub_files` - generates stub files and adds it to the build
|
21
|
+
# * `add_resources` - Adds all resources from your RubyMotion project
|
22
|
+
# * `add_pods` - Adds pods (if any) to ib.xcodeproj
|
23
|
+
# * `add_frameworks` - Adds standard frameworks to your project
|
24
|
+
# * project will then be saved
|
25
|
+
def write
|
26
|
+
setup_paths
|
27
|
+
|
28
|
+
generate_stub_files
|
29
|
+
add_resources
|
30
|
+
add_pods
|
31
|
+
add_frameworks
|
32
|
+
|
33
|
+
project.save
|
34
|
+
end
|
35
|
+
|
36
|
+
def project
|
37
|
+
@project ||= Xcodeproj::Project.new(ib_project_path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def target
|
41
|
+
@target ||= project.new_target(:static_library, 'ib', platform)
|
42
|
+
end
|
43
|
+
|
44
|
+
def generator
|
45
|
+
@generator ||= IB::Generator.new(detect_platform)
|
46
|
+
end
|
47
|
+
|
48
|
+
def resources
|
49
|
+
@resources ||= project.new_group("Resources")
|
50
|
+
end
|
51
|
+
|
52
|
+
def support_files
|
53
|
+
@support_files ||= project.new_group("Supporting Files")
|
54
|
+
end
|
55
|
+
|
56
|
+
def pods
|
57
|
+
@pods ||= project.new_group("Pods")
|
11
58
|
end
|
12
59
|
|
13
60
|
def detect_platform
|
14
61
|
# TODO: find a better way to detect platform
|
15
62
|
if defined?(Motion::Project::Config)
|
16
63
|
if Motion::Project::App.config.respond_to?(:platforms)
|
17
|
-
Motion::Project::App.config.platforms[0] == 'MacOSX' ? :osx : :ios
|
64
|
+
return Motion::Project::App.config.platforms[0] == 'MacOSX' ? :osx : :ios
|
18
65
|
end
|
19
66
|
end
|
67
|
+
return :ios
|
20
68
|
end
|
21
69
|
|
22
70
|
def app_files
|
@@ -25,40 +73,40 @@ class IB::Project
|
|
25
73
|
end
|
26
74
|
end
|
27
75
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
resources = project.new_group("Resources")
|
34
|
-
resources.path = resources_path
|
35
|
-
|
36
|
-
support = project.new_group("Supporting Files")
|
37
|
-
support.path = ib_project
|
38
|
-
|
39
|
-
pods = project.new_group("Pods")
|
40
|
-
pods.path = pods_headers_path
|
76
|
+
def setup_paths
|
77
|
+
resources.path = File.join(project_path, 'resources')
|
78
|
+
support_files.path = File.join(project_path, IB_PROJECT_NAME)
|
79
|
+
pods.path = File.join(project_path, 'vendor/Pods/Headers')
|
80
|
+
end
|
41
81
|
|
42
|
-
|
43
|
-
generator.write(app_files,
|
82
|
+
def generate_stub_files
|
83
|
+
generator.write(app_files, ib_project_path)
|
44
84
|
|
45
|
-
|
46
|
-
file =
|
85
|
+
support_files.new_file File.join(ib_project_path, 'Stubs.h')
|
86
|
+
file = support_files.new_file File.join(ib_project_path, 'Stubs.m')
|
47
87
|
target.add_file_references([ file ])
|
88
|
+
end
|
48
89
|
|
49
|
-
|
50
|
-
Dir.glob("#{
|
90
|
+
def add_resources
|
91
|
+
Dir.glob("#{resources.path}/**/*.{#{RESOURCE_EXTENSIONS.join(",")}}") do |file|
|
51
92
|
resources.new_reference(file)
|
52
93
|
end
|
94
|
+
end
|
53
95
|
|
54
|
-
|
96
|
+
def add_pods
|
97
|
+
Dir.glob("#{pods.path}/**/*.h") do |file|
|
55
98
|
pods.new_reference(file)
|
56
99
|
end
|
100
|
+
end
|
57
101
|
|
58
|
-
|
102
|
+
def add_frameworks
|
103
|
+
DEFAULT_FRAMEWORKS.each do |framework|
|
59
104
|
target.add_system_framework framework
|
60
105
|
end
|
106
|
+
end
|
61
107
|
|
62
|
-
|
108
|
+
def ib_project_path
|
109
|
+
File.join(project_path, IB_PROJECT_NAME)
|
63
110
|
end
|
111
|
+
|
64
112
|
end
|
data/lib/ib/version.rb
CHANGED
data/spec/lib/ib/project_spec.rb
CHANGED
@@ -3,21 +3,104 @@ require "spec_helper"
|
|
3
3
|
require "ib/project"
|
4
4
|
|
5
5
|
describe IB::Project do
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
context 'structure' do
|
8
|
+
let(:project) { described_class.new(project_path: 'spec/fixtures/common')}
|
9
|
+
|
10
|
+
it "defines #write" do
|
11
|
+
expect(project).to respond_to :write
|
12
|
+
end
|
13
|
+
|
14
|
+
it "defines #project" do
|
15
|
+
expect(project).to respond_to :project
|
16
|
+
end
|
17
|
+
|
18
|
+
it "defines #target" do
|
19
|
+
expect(project).to respond_to :target
|
20
|
+
end
|
21
|
+
|
22
|
+
it "defines #generator and is an IB::Generator" do
|
23
|
+
expect(project).to respond_to :generator
|
24
|
+
expect(project.generator).to be_kind_of IB::Generator
|
25
|
+
end
|
26
|
+
|
27
|
+
it "defines #resources" do
|
28
|
+
expect(project).to respond_to :resources
|
29
|
+
end
|
30
|
+
|
31
|
+
it "defines #support_files" do
|
32
|
+
expect(project).to respond_to :support_files
|
33
|
+
end
|
34
|
+
|
35
|
+
it "defines #pods" do
|
36
|
+
expect(project).to respond_to :pods
|
37
|
+
end
|
38
|
+
|
39
|
+
it "defines #detect_platform" do
|
40
|
+
expect(project).to respond_to :detect_platform
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#initialize' do
|
45
|
+
it "sets right path for xcode project" do
|
46
|
+
project = described_class.new(project_path: 'spec/fixtures/common')
|
47
|
+
expect(project.ib_project_path).to eq 'spec/fixtures/common/ib.xcodeproj'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'creating groups' do
|
52
|
+
let(:project) { described_class.new }
|
53
|
+
|
54
|
+
describe '#resources' do
|
55
|
+
it 'creates a group called Resources' do
|
56
|
+
expect(project.resources.name).to eq 'Resources'
|
57
|
+
end
|
58
|
+
it 'does not create multiple group records' do
|
59
|
+
project.resources
|
60
|
+
project.resources
|
61
|
+
resources = project.project.groups.select { |g| g.name == 'Resources'}
|
62
|
+
expect(resources.length).to be 1
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#support_files' do
|
67
|
+
it 'creates a group called Support Files' do
|
68
|
+
expect(project.support_files.name).to eq 'Supporting Files'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#pods' do
|
73
|
+
it 'creates a group called Pods' do
|
74
|
+
expect(project.pods.name).to eq 'Pods'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#detect_platform' do
|
80
|
+
it 'defaults to ios' do
|
81
|
+
project = described_class.new
|
82
|
+
expect(project.platform).to eq :ios
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can be set from parameter' do
|
86
|
+
project = described_class.new platform: :osx
|
87
|
+
expect(project.platform).to eq :osx
|
88
|
+
end
|
8
89
|
end
|
9
90
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
91
|
+
describe '#app_files' do
|
92
|
+
before do
|
93
|
+
Motion::Project::App.config.stub('files').and_return(
|
94
|
+
[
|
95
|
+
'/usr/local/xxx/gems/xxx/lib/xxxx.rb',
|
96
|
+
'User/xxx/gems/xxx/lib/motion/xxxx.rb',
|
97
|
+
'./app/aaa.rb',
|
98
|
+
'./app/controllers/bbb.rb',
|
99
|
+
]
|
100
|
+
)
|
101
|
+
end
|
102
|
+
it "returns a list of files under app directory of the project" do
|
103
|
+
expect(IB::Project.new.app_files).to eq ['./app/aaa.rb', './app/controllers/bbb.rb']
|
104
|
+
end
|
22
105
|
end
|
23
106
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Korolev
|
@@ -9,62 +9,62 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xcodeproj
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.16.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.16.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: thor
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 0.15.4
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.15.4
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: tilt
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 1.4.1
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.4.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '2.0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '2.0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
@@ -81,6 +81,34 @@ dependencies:
|
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: guard-rspec
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: guard-bundler
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
84
112
|
description: Magic rubymotion ib outlets support
|
85
113
|
email:
|
86
114
|
- yury.korolev@gmail.com
|
@@ -94,6 +122,8 @@ files:
|
|
94
122
|
- ".rspec"
|
95
123
|
- ".travis.yml"
|
96
124
|
- Gemfile
|
125
|
+
- Gemfile.lock
|
126
|
+
- Guardfile
|
97
127
|
- LICENSE
|
98
128
|
- README.md
|
99
129
|
- Rakefile
|