shenzhen 0.2.1 → 0.2.2

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shenzhen (0.2.1)
4
+ shenzhen (0.2.2)
5
5
  commander (~> 4.1.2)
6
6
  faraday (~> 0.8.0)
7
7
  faraday_middleware (~> 0.8.7)
@@ -1,5 +1,5 @@
1
1
  module Shenzhen
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
4
4
 
5
5
  require 'shenzhen/agvtool'
@@ -14,24 +14,18 @@ command :build do |c|
14
14
  c.action do |args, options|
15
15
  validate_xcode_version!
16
16
 
17
- @xcodebuild_info = Shenzhen::XcodeBuild.info
18
-
19
17
  @workspace = options.workspace
20
- @project = options.project
18
+ @project = options.project unless @workspace
19
+
20
+ @xcodebuild_info = Shenzhen::XcodeBuild.info(:workspace => @workspace, :project => @project)
21
+
21
22
  @scheme = options.scheme
22
23
  @configuration = options.configuration
23
24
 
24
25
  determine_workspace_or_project! unless @workspace || @project
25
26
 
26
- if @workspace
27
- unless @configuration
28
- say_warning "Configuration was not passed, defaulting to Debug" unless @configuration
29
- @configuration = "Debug"
30
- end
31
- else
32
- determine_configuration! unless @configuration
33
- say_error "Configuration #{@configuration} not found" and abort unless @xcodebuild_info.build_configurations.include?(@configuration)
34
- end
27
+ determine_configuration! unless @configuration
28
+ say_error "Configuration #{@configuration} not found" and abort unless @xcodebuild_info.build_configurations.include?(@configuration)
35
29
 
36
30
  determine_scheme! unless @scheme
37
31
  say_error "Scheme #{@scheme} not found" and abort unless @xcodebuild_info.schemes.include?(@scheme)
@@ -55,7 +49,9 @@ command :build do |c|
55
49
  ENV['CC'] = nil # Fix for RVM
56
50
  abort unless system %{xcodebuild #{flags.join(' ')} #{actions.join(' ')} 1> /dev/null}
57
51
 
58
- @xcodebuild_settings = Shenzhen::XcodeBuild.settings(flags)
52
+ @target, @xcodebuild_settings = Shenzhen::XcodeBuild.settings(*flags).detect{|target, settings| settings['WRAPPER_EXTENSION'] == "app"}
53
+ say_error "App settings could not be found." and abort unless @xcodebuild_settings
54
+
59
55
  @app_path = File.join(@xcodebuild_settings['BUILT_PRODUCTS_DIR'], @xcodebuild_settings['PRODUCT_NAME']) + ".app"
60
56
  @dsym_path = @app_path + ".dSYM"
61
57
  @dsym_filename = "#{@xcodebuild_settings['PRODUCT_NAME']}.app.dSYM"
@@ -108,10 +104,17 @@ command :build do |c|
108
104
  end
109
105
 
110
106
  def determine_configuration!
111
- if @xcodebuild_info.build_configurations.length == 1
112
- @configuration = @xcodebuild_info.build_configurations.first
107
+ configurations = @xcodebuild_info.build_configurations
108
+ if configurations.include?("Debug")
109
+ @configuration = "Debug"
110
+ elsif configurations.length == 1
111
+ @configuration = configurations.first
112
+ end
113
+
114
+ if @configuration
115
+ say_warning "Configuration was not passed, defaulting to #{@configuration}"
113
116
  else
114
- @configuration = choose "Select a configuration:", *@xcodebuild_info.build_configurations
117
+ @configuration = choose "Select a configuration:", *configurations
115
118
  end
116
119
  end
117
120
  end
@@ -1,63 +1,97 @@
1
1
  require 'ostruct'
2
+ require 'shellwords'
2
3
 
3
4
  module Shenzhen::XcodeBuild
4
5
  class Info < OpenStruct; end
6
+ class Settings < OpenStruct
7
+ include Enumerable
5
8
 
9
+ def initialize(hash = {})
10
+ super
11
+ self.targets = hash.keys
12
+ end
13
+
14
+ def members
15
+ self.targets
16
+ end
17
+
18
+ def each
19
+ members.each do |target|
20
+ yield target, send(target)
21
+ end
22
+
23
+ self
24
+ end
25
+ end
26
+
6
27
  class Error < StandardError; end
7
28
  class NilOutputError < Error; end
8
29
 
9
30
  class << self
10
- def info
11
- output = `xcodebuild -list 2> /dev/null`
31
+ def info(*args)
32
+ options = args.last.is_a?(Hash) ? args.pop : {}
33
+ output = `xcodebuild -list #{Shellwords.join(args + args_from_options(options))} 2>&1`
12
34
  raise Error.new $1 if /^xcodebuild\: error\: (.+)$/ === output
13
35
  raise NilOutputError unless /\S/ === output
14
36
 
15
37
  lines = output.split(/\n/)
16
- hash = {}
17
- group = nil
38
+ info, group = {}, nil
18
39
 
19
- hash[:project] = lines.shift.match(/\"(.+)\"\:/)[1]
40
+ info[:project] = lines.shift.match(/\"(.+)\"\:/)[1]
20
41
 
21
42
  lines.each do |line|
22
43
  if /\:$/ === line
23
44
  group = line.strip[0...-1].downcase.gsub(/\s+/, '_')
24
- hash[group] = []
45
+ info[group] = []
25
46
  next
26
47
  end
27
48
 
28
49
  unless group.nil? or /\.$/ === line
29
- hash[group] << line.strip
50
+ info[group] << line.strip
30
51
  end
31
52
  end
32
53
 
33
- hash.each do |group, values|
54
+ info.each do |group, values|
34
55
  next unless Array === values
35
56
  values.delete("") and values.uniq!
36
57
  end
37
58
 
38
- Info.new(hash)
59
+ Info.new(info)
39
60
  end
40
61
 
41
- def settings(flags = [])
42
- output = `xcodebuild #{flags.join(' ')} -showBuildSettings 2> /dev/null`
62
+ def settings(*args)
63
+ options = args.last.is_a?(Hash) ? args.pop : {}
64
+ output = `xcodebuild #{(args + args_from_options(options)).join(" ")} -showBuildSettings 2> /dev/null`
43
65
  raise Error.new $1 if /^xcodebuild\: error\: (.+)$/ === output
44
66
  raise NilOutputError unless /\S/ === output
45
67
 
46
68
  lines = output.split(/\n/)
47
69
  lines.shift
48
70
 
49
- hash = {}
71
+ settings, target = {}, nil
50
72
  lines.each do |line|
51
- key, value = line.split(/\=/).collect(&:strip)
52
- hash[key] = value
73
+ case line
74
+ when /Build settings for action build and target (\w+)/
75
+ target = $1
76
+ settings[target] = {}
77
+ else
78
+ key, value = line.split(/\=/).collect(&:strip)
79
+ settings[target][key] = value if target
80
+ end
53
81
  end
54
82
 
55
- hash
83
+ Settings.new(settings)
56
84
  end
57
85
 
58
86
  def version
59
87
  output = `xcodebuild -version`
60
- output.scan(/([\d\.?]+)/).flatten.first rescue nil
88
+ output.scan(/([\d+\.?]+)/).flatten.first rescue nil
89
+ end
90
+
91
+ private
92
+
93
+ def args_from_options(options = {})
94
+ options.reject{|key, value| value.nil?}.collect{|key, value| "-#{key} #{value}"}
61
95
  end
62
96
  end
63
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shenzhen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-12 00:00:00.000000000Z
12
+ date: 2012-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70347826429040 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.6.1
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70347826429040
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.6.1
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &70347826428160 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 0.9.2
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70347826428160
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.9.2
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: commander
38
- requirement: &70347826426800 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 4.1.2
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70347826426800
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 4.1.2
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: json
49
- requirement: &70347826426200 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 1.7.3
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70347826426200
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.7.3
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: faraday
60
- requirement: &70347826425360 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: 0.8.0
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *70347826425360
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.8.0
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: faraday_middleware
71
- requirement: &70347826424640 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,7 +101,12 @@ dependencies:
76
101
  version: 0.8.7
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *70347826424640
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.8.7
80
110
  description: CLI for Building & Distributing iOS Apps (.ipa Files)
81
111
  email: m@mattt.me
82
112
  executables:
@@ -97,8 +127,6 @@ files:
97
127
  - ./LICENSE
98
128
  - ./Rakefile
99
129
  - ./README.md
100
- - ./shenzhen-0.1.0.gem
101
- - ./shenzhen-0.2.0.gem
102
130
  - ./shenzhen.gemspec
103
131
  - bin/ipa
104
132
  homepage: http://github.com/mattt/shenzhen
@@ -115,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
143
  version: '0'
116
144
  segments:
117
145
  - 0
118
- hash: 706871174290220069
146
+ hash: -365862781933133346
119
147
  required_rubygems_version: !ruby/object:Gem::Requirement
120
148
  none: false
121
149
  requirements:
@@ -124,10 +152,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
152
  version: '0'
125
153
  segments:
126
154
  - 0
127
- hash: 706871174290220069
155
+ hash: -365862781933133346
128
156
  requirements: []
129
157
  rubyforge_project:
130
- rubygems_version: 1.8.15
158
+ rubygems_version: 1.8.24
131
159
  signing_key:
132
160
  specification_version: 3
133
161
  summary: Shenzhen
Binary file
Binary file