ib 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -123,7 +123,7 @@ Here is [sample app](https://github.com/yury/ibsample)
123
123
  3. run `rake ib:open` to change story board
124
124
  4. run `rake` to run app in simulator
125
125
 
126
- **Note** : this app is build for iOS 6.0 beta 2
126
+ **Note** : this app is build for iOS 6.0
127
127
 
128
128
  ## Contributing
129
129
 
data/ib.gemspec CHANGED
@@ -15,8 +15,8 @@ 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.2.3"
19
- gem.add_dependency "thor", "~> 0.15.4"
18
+ gem.add_dependency "xcodeproj", ">= 0.4.0"
19
+ gem.add_dependency "thor", ">= 0.15.4"
20
20
 
21
21
  gem.add_development_dependency "rspec", ">= 2.0"
22
22
  end
data/lib/ib/generator.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class IB::Generator
2
- def write src, dest
3
- files = IB::Parser.new.find_all(src)
2
+ def write files, dest
3
+ files = IB::Parser.new.find_all(files)
4
4
 
5
5
  FileUtils.mkpath dest
6
6
 
data/lib/ib/parser.rb CHANGED
@@ -7,9 +7,12 @@ class IB::Parser
7
7
  METHOD_DEF_REGEX = /^[ \t]+(def)[ \t](#{NAME_REGEX})([ \t(]+)?(#{NAME_REGEX})?([ \t)]*)(#.*)?$/
8
8
  ACTION_REGEX = Regexp.union METHOD_DEF_REGEX, METHOD_REF_REGEX
9
9
 
10
- def find_all(dir)
10
+ def find_all(dir_or_files)
11
11
  all = {}
12
- Dir.glob("#{dir}/**/*.rb") do |file|
12
+ files = dir_or_files
13
+ files = Dir.glob("#{dir_or_files}/**/*.rb").to_a if dir_or_files.class == String
14
+
15
+ files.each do |file|
13
16
  if info = find(file)
14
17
  all[file] = info
15
18
  end
data/lib/ib/project.rb CHANGED
@@ -1,45 +1,43 @@
1
1
  class IB::Project
2
2
  def write app_path = "app", resources_path = "resources", pods_headers_path = "vendor/Pods/Headers"
3
3
  project = Xcodeproj::Project.new
4
- target = project.targets.new_static_library(:ios, 'ui')
4
+ target = project.new_target(:static_library, 'ib', :ios)
5
5
 
6
- resources = project.groups.new('path' => resources_path, 'name' => 'Resources')
7
- support = project.groups.new('name' => 'Supporting Files', 'path' => 'ib.xcodeproj')
8
- pods = project.groups.new('name' => 'Pods')
6
+ resources = project.new_group("Resources")
7
+ resources.path = resources_path
9
8
 
10
- IB::Generator.new.write(app_path, "ib.xcodeproj")
11
- support.files.new 'path' => 'Stubs.h', 'sourceTree' => '<group>'
9
+ support = project.new_group("Supporting Files")
10
+ support.path = "ib.xcodeproj"
12
11
 
13
- path = Pathname.new("Stubs.m")
14
- desc = Xcodeproj::Project::PBXNativeTarget::SourceFileDescription.new(path, nil, nil)
15
- file = target.add_source_files([desc]).first
16
- file.source_tree = '<group>'
17
- support.files << file
12
+ pods = project.new_group("Pods")
13
+ pods.path = pods_headers_path
14
+
15
+ IB::Generator.new.write(Motion::Project::App.config.files, "ib.xcodeproj")
16
+
17
+ support.new_file "ib.xcodeproj/Stubs.h"
18
+ file = support.new_file "ib.xcodeproj/Stubs.m"
19
+ target.add_file_references([ file ])
18
20
 
19
21
  resource_exts = %W{xcdatamodeld png jpg jpeg storyboard xib lproj}
20
22
  Dir.glob("#{resources_path}/**/*.{#{resource_exts.join(",")}}") do |file|
21
- file = file.gsub(/^#{resources_path}\//, '')
22
23
  if file.end_with? ".xcdatamodeld"
23
- obj = resources.groups.new('isa' => 'XCVersionGroup', 'path' => file, 'sourceTree' => '<group>', 'versionGroupType' => 'wrapper.xcdatamodel')
24
- file = obj.files.new('path' => file.gsub(/xcdatamodeld$/, 'xcdatamodel'), 'sourceTree' => '<group>', 'lastKnownFileType' => 'wrapper.xcdatamodel')
25
- obj.attributes['currentVersion'] = file.uuid
24
+ relative_file_path = file.split("/").last
25
+ obj = resources.new_xcdatamodel_group(relative_file_path)
26
+ internal_file = obj.files.first
27
+ internal_file.path = relative_file_path.gsub(/xcdatamodeld$/, 'xcdatamodel')
28
+ internal_file.source_tree = "<group>"
29
+ resources.children << obj
26
30
  else
27
- resources.files.new('path' => file, 'sourceTree' => '<group>')
31
+ resources.new_file(file)
28
32
  end
29
33
  end
30
34
 
31
35
  Dir.glob("#{pods_headers_path}/**/*.h") do |file|
32
- pods.files.new('path' => file)
36
+ pods.new_file(file)
33
37
  end
34
38
 
35
- # Add Basic System Frameworks
36
- # frameworks = ["UIKit", "QuartzCore", "CoreGraphics", "CoreData"]
37
- # doesn't work with UIKit
38
-
39
- frameworks = ["QuartzCore", "CoreGraphics", "CoreData"]
40
- frameworks.each do |framework|
41
- file = project.add_system_framework framework
42
- target.frameworks_build_phases.first << file
39
+ %W{QuartzCore CoreGraphics CoreData}.each do |framework|
40
+ project.add_system_framework framework
43
41
  end
44
42
 
45
43
  project.save_as("ib.xcodeproj")
data/lib/ib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IB
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,22 @@
5
5
 
6
6
  require 'ib'
7
7
 
8
+ module Motion
9
+ class Config
10
+ def self.files
11
+ []
12
+ end
13
+ end
14
+
15
+ module Project
16
+ class App
17
+ def self.config
18
+ Motion::Config
19
+ end
20
+ end
21
+ end
22
+ end
23
+
8
24
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
9
25
  RSpec.configure do |config|
10
26
  config.treat_symbols_as_metadata_keys_with_true_values = true
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
4
  prerelease:
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Yury Korolev
@@ -10,56 +10,56 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-16 00:00:00.000000000 Z
13
+ date: 2012-12-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.4.0
21
+ none: false
22
+ prerelease: false
16
23
  name: xcodeproj
17
24
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
25
  requirements:
20
26
  - - ! '>='
21
27
  - !ruby/object:Gem::Version
22
- version: 0.2.3
28
+ version: 0.4.0
29
+ none: false
23
30
  type: :runtime
24
- prerelease: false
31
+ - !ruby/object:Gem::Dependency
25
32
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
33
  requirements:
28
34
  - - ! '>='
29
35
  - !ruby/object:Gem::Version
30
- version: 0.2.3
31
- - !ruby/object:Gem::Dependency
36
+ version: 0.15.4
37
+ none: false
38
+ prerelease: false
32
39
  name: thor
33
40
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
41
  requirements:
36
- - - ~>
42
+ - - ! '>='
37
43
  - !ruby/object:Gem::Version
38
44
  version: 0.15.4
39
- type: :runtime
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
45
  none: false
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: 0.15.4
46
+ type: :runtime
47
47
  - !ruby/object:Gem::Dependency
48
- name: rspec
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
48
+ version_requirements: !ruby/object:Gem::Requirement
51
49
  requirements:
52
50
  - - ! '>='
53
51
  - !ruby/object:Gem::Version
54
52
  version: '2.0'
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
53
  none: false
54
+ prerelease: false
55
+ name: rspec
56
+ requirement: !ruby/object:Gem::Requirement
59
57
  requirements:
60
58
  - - ! '>='
61
59
  - !ruby/object:Gem::Version
62
60
  version: '2.0'
61
+ none: false
62
+ type: :development
63
63
  description: Magic rubymotion ib outlets support
64
64
  email:
65
65
  - yury.korolev@gmail.com
@@ -101,23 +101,23 @@ rdoc_options: []
101
101
  require_paths:
102
102
  - lib
103
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
104
  requirements:
106
105
  - - ! '>='
107
106
  - !ruby/object:Gem::Version
108
107
  version: '0'
109
108
  segments:
110
109
  - 0
111
- hash: -1617517942573083833
112
- required_rubygems_version: !ruby/object:Gem::Requirement
110
+ hash: -2351586432581253994
113
111
  none: false
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
113
  requirements:
115
114
  - - ! '>='
116
115
  - !ruby/object:Gem::Version
117
116
  version: '0'
118
117
  segments:
119
118
  - 0
120
- hash: -1617517942573083833
119
+ hash: -2351586432581253994
120
+ none: false
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 1.8.24