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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8250635e01fb42bfbdc5e3d780d5d75826ec66d5
4
- data.tar.gz: 12abe2936386aea20d68beb00e574f711a808131
3
+ metadata.gz: b75eb6cb59e35f8e2da35efcb3924af929fcfbea
4
+ data.tar.gz: df494cb83f25698ffc1d8e2f7115e1b43c0b1824
5
5
  SHA512:
6
- metadata.gz: cdab0db80169d886231f0a209378f86cd06ac1b3fda1110fe561078686041e2526cb6cffb6fbe0b35270c9cabb488d19f0ae12ab330dd0339a8850a679916853
7
- data.tar.gz: 5cc5dd020469989678337d1a5748bf920575a825085f1825647ce86734dbf6dd1b1b6d42dc5ad059007648daaa716960d4096a77133746a381fcb981c8359466
6
+ metadata.gz: 386d5f7606d8891d11c51e9a22bb5111eca748f9c2b78dbe369c268435ad895fbd7a8f326bacca3777e0e1809dd66b94e574c5ab38864fed5254df9f59d2357e
7
+ data.tar.gz: 236695bec33e3437f71c71e4588e0ff7fc8bd2ec82d47a5d0644b5a8c224bdea63b95065699811bb4ccf939a84e11b34ba909ad3eeb7a2abc2c089c2ac534950
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
@@ -17,3 +16,5 @@ test/version_tmp
17
16
  tmp
18
17
  ui.xcodeproj
19
18
  ib.xcodeproj
19
+ .ruby-version
20
+ .rbenv-version
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
@@ -0,0 +1,11 @@
1
+ guard 'bundler' do
2
+ watch('Gemfile')
3
+ watch(/^.+\.gemspec/)
4
+ end
5
+
6
+ guard :rspec do
7
+ watch(%r{^spec/.+_spec\.rb$})
8
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
+ watch('spec/spec_helper.rb') { "spec" }
10
+ end
11
+
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 "xcodeproj", ">= 0.11.1"
19
- gem.add_dependency "thor", ">= 0.15.4"
20
- gem.add_dependency "tilt", ">= 1.4.1"
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 "rspec", ">= 2.0"
23
- gem.add_development_dependency "rake"
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, :app_path, :resources_path, :pods_headers_path, :project_path
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 = options[:platform] || detect_platform || :ios
7
- @project_path = options[:project_path] || Dir.pwd
8
- @app_path = options[:app_path] || "#{project_path}/app"
9
- @resources_path = options[:resources_path] || "#{project_path}/resources"
10
- @pods_headers_path = options[:pods_headers_path] || "#{project_path}/vendor/Pods/Headers"
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 write
29
- ib_project = "ib.xcodeproj"
30
- project = Xcodeproj::Project.new(ib_project)
31
- target = project.new_target(:static_library, 'ib', platform)
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
- generator = IB::Generator.new(detect_platform)
43
- generator.write(app_files, ib_project)
82
+ def generate_stub_files
83
+ generator.write(app_files, ib_project_path)
44
84
 
45
- support.new_file "ib.xcodeproj/Stubs.h"
46
- file = support.new_file "ib.xcodeproj/Stubs.m"
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
- resource_exts = %W{xcdatamodeld png jpg jpeg storyboard xib lproj}
50
- Dir.glob("#{resources_path}/**/*.{#{resource_exts.join(",")}}") do |file|
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
- Dir.glob("#{pods_headers_path}/**/*.h") do |file|
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
- %W{QuartzCore CoreGraphics CoreData}.each do |framework|
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
- project.save(ib_project)
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
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module IB
3
- VERSION = '0.4.4'
3
+ VERSION = '0.4.5'
4
4
  end
@@ -3,21 +3,104 @@ require "spec_helper"
3
3
  require "ib/project"
4
4
 
5
5
  describe IB::Project do
6
- it "generates xcode project" do
7
- IB::Project.new(app_path:"spec/fixtures/common").write()
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
- it "app_files" do
11
- Motion::Project::App.config.stub('files').and_return(
12
- [
13
- '/usr/local/xxx/gems/xxx/lib/xxxx.rb',
14
- 'User/xxx/gems/xxx/lib/motion/xxxx.rb',
15
- './app/aaa.rb',
16
- './app/controllers/bbb.rb',
17
- ]
18
- )
19
- expect(IB::Project.new(app_path:"spec/fixtures/common").app_files).to eq(
20
- ['./app/aaa.rb', './app/controllers/bbb.rb',]
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
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-02 00:00:00.000000000 Z
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.11.1
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.11.1
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