xcody 0.4.2 → 0.4.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8054352ae369555ebbaabed1c579e87dfecc16ab
4
- data.tar.gz: 6ca0da7879e1b048128312867e07b74f1dba2984
3
+ metadata.gz: 913cd3c45104ffe09284c8eb93d62e64309d390b
4
+ data.tar.gz: 7588ff817fe323c5d82dfe51d153233f50b5bb95
5
5
  SHA512:
6
- metadata.gz: 60105a619652463c1e67d6ab20876ca7b7b63252392b9a0830d28821897358328d4810cf6d625c66b6b13dbf1618d7a411642c11a070f1629a002a71dcd68235
7
- data.tar.gz: 4aa7385a1d15f5f2ecc3e86be00a0877e9b249ddb3614b7e691ca017308382c7061c36ee6300d6b92c18a683591d1e4af77af5cf737ea5056fd5a8c42e56b5fa
6
+ metadata.gz: f12812d6c082a04adb275d05ed1ed271945070e15bf34d2a0b876394ef5bc8eb12a2f759887d3a72654c13d8544d1c05fbd5f42dd08d1048d2794e6d0e17ef24
7
+ data.tar.gz: 77286876bb05290d97658f1288f75bc5fb9903150d7176548e9d339d028f0114e1d08192a37cd0e3537ccfadda24e21e2e7a00ff066555fb6f1d1d1133a3f73c
data/Rakefile CHANGED
@@ -1,2 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
2
3
 
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -1,26 +1,28 @@
1
1
  require "xcody/version"
2
2
  require "pathname"
3
3
  require "fileutils"
4
- require "Open3"
4
+ require "open3"
5
5
 
6
6
  class Xcody
7
+ attr_reader :xcode_build_cmd
8
+
7
9
  def initialize
8
10
  xcode = `xcode-select -v`
9
11
  fail "Should install xcode commands from Apple Developer Center." if xcode.include?("command not found")
10
- @xcode_build_cmd = ""
12
+ @xcode_build_cmd = []
11
13
  end
12
14
 
13
15
  def xcode_build
14
- @xcode_build_cmd.concat(Pathname.new(xcode_path).join("Contents", "Developer", "usr", "bin", "xcodebuild").to_s)
16
+ @xcode_build_cmd.push(Pathname.new(xcode_path).join("Contents", "Developer", "usr", "bin", "xcodebuild").to_s)
15
17
  self
16
18
  end
17
19
 
18
20
  def project(project_path)
19
21
  case File.extname(project_path)
20
22
  when ".xcodeproj"
21
- @xcode_build_cmd.concat(%( -project "#{project_path}"))
23
+ @xcode_build_cmd.push("-project", project_path)
22
24
  when ".xcworkspace"
23
- @xcode_build_cmd.concat(%( -workspace "#{project_path}"))
25
+ @xcode_build_cmd.push("-workspace", project_path)
24
26
  else
25
27
  fail "#{project_path} has no project."
26
28
  end
@@ -28,153 +30,162 @@ class Xcody
28
30
  end
29
31
 
30
32
  def target(name)
31
- @xcode_build_cmd.concat(%( -target "#{name}"))
33
+ @xcode_build_cmd.push("-target", name)
32
34
  self
33
35
  end
34
36
 
35
37
  def alltargets
36
- @xcode_build_cmd.concat(%( -alltargets))
38
+ @xcode_build_cmd.push("-alltargets")
37
39
  self
38
40
  end
39
41
 
40
42
  def arch(architecture)
41
- @xcode_build_cmd.concat(%( -arch "#{architecture}"))
43
+ @xcode_build_cmd.push("-arch", architecture)
42
44
  self
43
45
  end
44
46
 
45
47
  def scheme(scheme)
46
- @xcode_build_cmd.concat(%( -scheme "#{scheme}"))
48
+ @xcode_build_cmd.push("-scheme", scheme)
47
49
  self
48
50
  end
49
51
 
50
52
  def sdk(sdk_name)
51
- @xcode_build_cmd.concat(%( -sdk "#{sdk_name}"))
53
+ @xcode_build_cmd.push("-sdk", sdk_name)
52
54
  self
53
55
  end
54
56
 
55
57
  def destination(destination)
56
- @xcode_build_cmd.concat(%( -destination "#{destination}"))
58
+ @xcode_build_cmd.push("-destination", destination)
57
59
  self
58
60
  end
59
61
 
60
62
  def configuration(config)
61
- @xcode_build_cmd.concat(%( -configuration "#{config}"))
63
+ @xcode_build_cmd.push("-configuration", config)
62
64
  self
63
65
  end
64
66
 
65
67
  def derive_data_path(data_path)
66
- @xcode_build_cmd.concat(%( -derivedDataPath "#{data_path}"))
68
+ @xcode_build_cmd.push("-derivedDataPath", data_path)
67
69
  self
68
70
  end
69
71
 
70
72
  def result_bundle_path(path)
71
- @xcode_build_cmd.concat(%( -resultBundlePath "#{path}"))
73
+ @xcode_build_cmd.push("-resultBundlePath", path)
72
74
  self
73
75
  end
74
76
 
75
77
  def export_archive
76
- @xcode_build_cmd.concat(%( -exportArchive))
78
+ @xcode_build_cmd.push("-exportArchive")
77
79
  self
78
80
  end
79
81
 
80
82
  def export_format(format)
81
- @xcode_build_cmd.concat(%( -exportFormat "#{format}"))
83
+ @xcode_build_cmd.push("-exportFormat", format)
82
84
  self
83
85
  end
84
86
 
85
87
  def archive_path(xcarchivepath)
86
- @xcode_build_cmd.concat(%( -archivePath "#{xcarchivepath}"))
88
+ @xcode_build_cmd.push("-archivePath", xcarchivepath)
87
89
  self
88
90
  end
89
91
 
90
92
  def export_path(destinationpath)
91
- @xcode_build_cmd.concat(%( -exportPath "#{destinationpath}"))
93
+ @xcode_build_cmd.push("-exportPath", destinationpath)
92
94
  self
93
95
  end
94
96
 
95
97
  def export_provisioning_profile(profilename)
96
- @xcode_build_cmd.concat(%( -exportProvisioningProfile "#{profilename}"))
98
+ @xcode_build_cmd.push("-exportProvisioningProfile", profilename)
97
99
  self
98
100
  end
99
101
 
100
102
  def export_signing_identity(identityname)
101
- @xcode_build_cmd.concat(%( -exportSigningIdentity "#{identityname}"))
103
+ @xcode_build_cmd.push("-exportSigningIdentity", identityname)
102
104
  self
103
105
  end
104
106
 
105
107
  def export_installer_identity(identityname)
106
- @xcode_build_cmd.concat(%( -exportInstallerIdentity "#{identityname}"))
108
+ @xcode_build_cmd.push("-exportInstallerIdentity", identityname)
107
109
  self
108
110
  end
109
111
 
110
112
  def exportWith_original_signing_identity
111
- @xcode_build_cmd.concat(%( -exportWithOriginalSigningIdentity))
113
+ @xcode_build_cmd.push("-exportWithOriginalSigningIdentity")
112
114
  self
113
115
  end
114
116
 
115
117
  def skip_unavailable_actions
116
- @xcode_build_cmd.concat(%( -skipUnavailableActions))
118
+ @xcode_build_cmd.push("-skipUnavailableActions")
117
119
  self
118
120
  end
119
121
 
120
122
  def xcconfig(filename)
121
- @xcode_build_cmd.concat(%( -xcconfig #{filename}))
123
+ @xcode_build_cmd.push("-xcconfig", filename)
122
124
  self
123
125
  end
124
126
 
125
127
  # Build actions
126
128
 
127
129
  def clean
128
- @xcode_build_cmd.concat(%( clean))
130
+ @xcode_build_cmd.push("clean")
129
131
  self
130
132
  end
131
133
 
132
134
  def analyze
133
- @xcode_build_cmd.concat(%( analyze))
135
+ @xcode_build_cmd.push("analyze")
134
136
  self
135
137
  end
136
138
 
137
139
  def archive
138
- @xcode_build_cmd.concat(%( archive))
140
+ @xcode_build_cmd.push("archive")
139
141
  self
140
142
  end
141
143
 
144
+ def external_attributes(attributes)
145
+ @xcode_build_cmd.push(attributes)
146
+ end
147
+
142
148
  def test
143
- @xcode_build_cmd.concat(%( test))
149
+ @xcode_build_cmd.push("test")
144
150
  self
145
151
  end
146
152
 
147
153
  def installsrc
148
- @xcode_build_cmd.concat(%( installsrc))
154
+ @xcode_build_cmd.push("installsrc")
149
155
  self
150
156
  end
151
157
 
152
158
  def install
153
- @xcode_build_cmd.concat(%( install))
159
+ @xcode_build_cmd.push("install")
154
160
  self
155
161
  end
156
162
 
157
163
  # @return [String] xcode build command
158
164
  def build
159
- @xcode_build_cmd.concat(%( build))
165
+ @xcode_build_cmd.push("build")
160
166
  self
161
167
  end
162
168
 
163
169
  def clear_cmd
164
- @xcode_build_cmd = ""
170
+ @xcode_build_cmd = []
171
+ end
172
+
173
+ def command
174
+ @xcode_build_cmd.join(" ")
165
175
  end
166
176
 
167
177
  def run(log_file = "./tmp/build_log.txt", verb = false)
168
- puts "running with #{@xcode_build_cmd.inspect}"
178
+ cmd = command
179
+ puts "running with #{cmd.inspect}"
169
180
 
170
- run_command @xcode_build_cmd, log_file, verb
181
+ run_command cmd, log_file, verb
171
182
  end
172
183
 
173
184
  def xcpretty(log_file = "./tmp/build_log.txt", option = [], verb = false)
174
- command = @xcode_build_cmd.concat(%( | xcpretty )).concat(option.join(" "))
175
- puts "running with #{command}"
185
+ cmd = command.concat(%( | xcpretty )).concat(option.join(" "))
186
+ puts "running with #{cmd}"
176
187
 
177
- run_command command, log_file, verb
188
+ run_command cmd, log_file, verb
178
189
  end
179
190
 
180
191
  private
@@ -1,3 +1,3 @@
1
1
  class Xcody
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'minitest'
2
+ require 'minitest/unit'
3
+ require 'minitest/autorun'
4
+
5
+ require './lib/xcody'
6
+
7
+ class XcodyTest < Minitest::Test
8
+ def setup
9
+ @xcody = Xcody.new
10
+ end
11
+
12
+ def test_with_default
13
+ assert_equal [], @xcody.xcode_build_cmd
14
+ end
15
+
16
+ def test_with_some_values
17
+ @xcody.xcode_build.project("project.xcworkspace").target("target").build
18
+ assert_equal %(/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace project.xcworkspace -target target build), @xcody.command
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcody
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2016-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcpretty
@@ -33,12 +33,12 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - ".gitignore"
35
35
  - Gemfile
36
- - Gemfile.lock
37
36
  - LICENSE.txt
38
37
  - README.md
39
38
  - Rakefile
40
39
  - lib/xcody.rb
41
40
  - lib/xcody/version.rb
41
+ - test/xcody_test.rb
42
42
  - xcody.gemspec
43
43
  homepage: https://github.com/KazuCocoa/xcody
44
44
  licenses:
@@ -64,4 +64,5 @@ rubygems_version: 2.6.6
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: Simple Xcode command wrapper
67
- test_files: []
67
+ test_files:
68
+ - test/xcody_test.rb