gym 0.5.0 → 0.6.0

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: 0c76a24f7879f86175a8a39ce9679116e669d9c5
4
- data.tar.gz: ad0f0ce1ff3e9da26eea7a1e17754f6c6e4c1963
3
+ metadata.gz: 30a7b849f783846aa81e20f82a41ba031c9aabef
4
+ data.tar.gz: bcdf8bb5946c5bad1f28c104d5f739674d6bda8a
5
5
  SHA512:
6
- metadata.gz: 04f9486f03e74325e53c66a3fcc21a2d60d4650e2eb530a28cd7592e2dcdc5573fe4c74fffd6b747617a516277279cae82d450db56010c50d04a12642c2b446a
7
- data.tar.gz: 9f36f4679516d67dcf4fe49488bf58760ba226b1369fe13731c817cbf1f67092deee928d82c12e83e7c3bffd4d32e02c09d043084a2494c6f1db92c786ffb03f
6
+ metadata.gz: 70ef804df96c4bdae6d005ba422c2cc7676998c9a8573427038473fe67d8ea4f44a50f3b4eb55227763ad78e4742834dbafe81ff4f6ac0f027b76e845fde1c3a
7
+ data.tar.gz: edca9aacc075e79583f7642c6277bfb10b71cd95b1223aa4a5fa9af3df99b86c5f2459e5cbfd6d7efe31eb3059c26655b05e4e65691cf4d088f3bd2c65a5ae8b
data/README.md CHANGED
@@ -116,6 +116,10 @@ That's all you need to build your application. If you want more control, here ar
116
116
 
117
117
  gym --workspace "Example.xcworkspace" --scheme "AppName" --clean
118
118
 
119
+ If you need to use a different xcode install, use xcode-select or define DEVELOPER_DIR:
120
+
121
+ DEVELOPER_DIR="/Applications/Xcode6.2.app" gym
122
+
119
123
  For a list of all available parameters use
120
124
 
121
125
  gym --help
@@ -125,6 +129,11 @@ If you run into any issues, use the `verbose` mode to get more information
125
129
 
126
130
  gym --verbose
127
131
 
132
+ To pass boolean parameters make sure to use `gym` like this:
133
+
134
+ gym --upload_bitcode true --upload_symbols true
135
+
136
+
128
137
  # Gymfile
129
138
 
130
139
  Since you might want to manually trigger a new build but don't want to specify all the parameters every time, you can store your defaults in a so called `Gymfile`.
@@ -9,6 +9,6 @@
9
9
 
10
10
  # scheme "Example"
11
11
 
12
- # sdk "9.0"
12
+ # sdk "iphoneos9.0"
13
13
 
14
14
  output_directory "./"
data/lib/gym.rb CHANGED
@@ -2,17 +2,13 @@ require 'json'
2
2
  require 'gym/version'
3
3
  require 'gym/manager'
4
4
  require 'gym/project'
5
- require 'gym/build_command_generator'
6
- require 'gym/package_command_generator'
5
+ require 'gym/generators/build_command_generator'
6
+ require 'gym/generators/package_command_generator'
7
7
  require 'gym/runner'
8
8
  require 'gym/error_handler'
9
9
  require 'gym/options'
10
10
  require 'gym/detect_values'
11
-
12
- # Import all the fixes
13
- require 'gym/xcodebuild_fixes/swift_fix'
14
- require 'gym/xcodebuild_fixes/watchkit_fix'
15
- require 'gym/xcodebuild_fixes/package_application_fix'
11
+ require 'gym/xcode'
16
12
 
17
13
  require 'fastlane_core'
18
14
  require 'terminal-table'
@@ -32,10 +28,16 @@ module Gym
32
28
  "Gymfile"
33
29
  end
34
30
 
35
- def xcode_path
36
- @path ||= `xcode-select --print-path`.strip
31
+ def init_libs
32
+ return unless Xcode.pre_7?
33
+ # Import all the fixes
34
+ require 'gym/xcodebuild_fixes/swift_fix'
35
+ require 'gym/xcodebuild_fixes/watchkit_fix'
36
+ require 'gym/xcodebuild_fixes/package_application_fix'
37
37
  end
38
38
  end
39
39
 
40
40
  Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
41
+
42
+ Gym.init_libs
41
43
  end
@@ -0,0 +1 @@
1
+ All the classes that generate commands we want to execute
@@ -0,0 +1,34 @@
1
+ require 'shellwords'
2
+
3
+ # The concrete implementations
4
+ require 'gym/generators/package_command_generator_legacy'
5
+ require 'gym/generators/package_command_generator_xcode7'
6
+
7
+ module Gym
8
+ class PackageCommandGenerator
9
+ class << self
10
+ def generate
11
+ generator.generate
12
+ end
13
+
14
+ def appfile_path
15
+ generator.appfile_path
16
+ end
17
+
18
+ def ipa_path
19
+ generator.ipa_path
20
+ end
21
+
22
+ def dsym_path
23
+ generator.dsym_path
24
+ end
25
+
26
+ private
27
+
28
+ # The generator we need to use for the currently used Xcode version
29
+ def generator
30
+ Xcode.pre_7? ? PackageCommandGeneratorLegacy : PackageCommandGeneratorXcode7
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,11 +1,9 @@
1
- require 'shellwords'
2
-
3
1
  module Gym
4
- # Responsible for building the fully working xcodebuild command
2
+ # Responsible for building the fully working xcodebuild command on Xcode < 7
5
3
  #
6
4
  # Because of a known bug in PackageApplication Perl script used by Xcode the packaging process is performed with
7
5
  # a patched version of the script.
8
- class PackageCommandGenerator
6
+ class PackageCommandGeneratorLegacy
9
7
  class << self
10
8
  def generate
11
9
  parts = ["/usr/bin/xcrun #{XcodebuildFixes.patch_package_application} -v"]
@@ -0,0 +1,64 @@
1
+ module Gym
2
+ # Responsible for building the fully working xcodebuild command
3
+ class PackageCommandGeneratorXcode7
4
+ class << self
5
+ def generate
6
+ if Gym.config[:provisioning_profile_path]
7
+ Helper.log.info "You're using Xcode 7, the `provisioning_profile_path` value will be ignored".yellow
8
+ Helper.log.info "Please follow the Code Signing Guide: https://github.com/KrauseFx/fastlane/blob/master/docs/CodeSigning.md".yellow
9
+ end
10
+
11
+ parts = ["/usr/bin/xcrun xcodebuild -exportArchive"]
12
+ parts += options
13
+ parts += pipe
14
+
15
+ File.write(config_path, config_content) # overwrite everytime. Could be optimized
16
+
17
+ parts
18
+ end
19
+
20
+ def options
21
+ options = []
22
+
23
+ options << "-exportOptionsPlist '#{config_path}'"
24
+ options << "-archivePath '#{BuildCommandGenerator.archive_path}'"
25
+ options << "-exportPath '#{BuildCommandGenerator.build_path}'" # we move it once the binary is finished
26
+
27
+ options
28
+ end
29
+
30
+ def pipe
31
+ [""]
32
+ end
33
+
34
+ def ipa_path
35
+ File.join(BuildCommandGenerator.build_path, "#{Gym.config[:output_name]}.ipa")
36
+ end
37
+
38
+ # The path the the dsym file for this app. Might be nil
39
+ def dsym_path
40
+ Dir[BuildCommandGenerator.archive_path + "/**/*.app.dSYM"].last
41
+ end
42
+
43
+ # The path the config file we use to sign our app
44
+ def config_path
45
+ @config_path ||= "/tmp/gym_config_#{Time.now.to_i}.plist"
46
+ return @config_path
47
+ end
48
+
49
+ private
50
+
51
+ def config_content
52
+ require 'plist'
53
+ symbols = (Gym.config[:upload_symbols] ? true : false)
54
+ bitcode = (Gym.config[:upload_bitcode] ? true : false)
55
+
56
+ {
57
+ method: 'app-store',
58
+ uploadSymbols: symbols,
59
+ uploadBitcode: bitcode
60
+ }.to_plist
61
+ end
62
+ end
63
+ end
64
+ end
data/lib/gym/manager.rb CHANGED
@@ -19,7 +19,7 @@ module Gym
19
19
  rows << ["Configuration", config[:configuration]] if config[:configuration]
20
20
  rows << ["Archive Path", config[:archive_path]] if config[:archive_path]
21
21
  rows << ["Platform", Gym.project.ios? ? "iOS" : "Mac"]
22
- rows << ["Xcode Path", Gym.xcode_path.gsub("/Contents/Developer", "")]
22
+ rows << ["Xcode Path", Xcode.xcode_path.gsub("/Contents/Developer", "")]
23
23
 
24
24
  puts ""
25
25
  puts Terminal::Table.new(
data/lib/gym/options.rb CHANGED
@@ -101,6 +101,16 @@ module Gym
101
101
  verify_block: proc do |value|
102
102
  raise "File not found at path '#{File.expand_path(value)}'".red unless File.exist?(value)
103
103
  end),
104
+ FastlaneCore::ConfigItem.new(key: :upload_symbols,
105
+ short_option: "-m",
106
+ env_name: "GYM_UPLOAD_SYMBOLS",
107
+ description: "Should the ipa file include symbols?",
108
+ default_value: true),
109
+ FastlaneCore::ConfigItem.new(key: :upload_bitcode,
110
+ short_option: "-z",
111
+ env_name: "GYM_UPLOAD_BITCODE",
112
+ description: "Should the ipa include bitcode?",
113
+ default_value: false),
104
114
  FastlaneCore::ConfigItem.new(key: :provisioning_profile_path,
105
115
  short_option: "-e",
106
116
  env_name: "GYM_PROVISIONING_PROFILE_PATH",
data/lib/gym/runner.rb CHANGED
@@ -14,10 +14,7 @@ module Gym
14
14
 
15
15
  if Gym.project.ios?
16
16
  package_app
17
- Gym::XcodebuildFixes.swift_library_fix
18
- Gym::XcodebuildFixes.watchkit_fix
19
- Gym::XcodebuildFixes.clear_patched_package_application
20
-
17
+ fix_package
21
18
  compress_and_move_dsym
22
19
  move_ipa
23
20
  elsif Gym.project.mac?
@@ -60,11 +57,19 @@ module Gym
60
57
  #####################################################
61
58
 
62
59
  def clear_old_files
63
- if File.exist? PackageCommandGenerator.ipa_path
60
+ return unless Xcode.pre_7?
61
+ if File.exist?(PackageCommandGenerator.ipa_path)
64
62
  File.delete(PackageCommandGenerator.ipa_path)
65
63
  end
66
64
  end
67
65
 
66
+ def fix_package
67
+ return unless Xcode.pre_7?
68
+ Gym::XcodebuildFixes.swift_library_fix
69
+ Gym::XcodebuildFixes.watchkit_fix
70
+ Gym::XcodebuildFixes.clear_patched_package_application
71
+ end
72
+
68
73
  # Builds the app and prepares the archive
69
74
  def build_app
70
75
  command = BuildCommandGenerator.generate
@@ -114,7 +119,7 @@ module Gym
114
119
 
115
120
  puts "" # new line
116
121
 
117
- Helper.log.info "Successfully exported and compressed dSYM file.".green
122
+ Helper.log.info "Successfully exported and compressed dSYM file".green
118
123
  end
119
124
 
120
125
  # Moves over the binary and dsym file to the output directory
@@ -141,5 +146,15 @@ module Gym
141
146
  Helper.log.info app_path
142
147
  app_path
143
148
  end
149
+
150
+ private
151
+
152
+ def find_archive_path
153
+ if Xcode.pre_7?
154
+ BuildCommandGenerator.archive_path
155
+ else
156
+ Dir.glob(File.join(BuildCommandGenerator.build_path, "*.ipa")).last
157
+ end
158
+ end
144
159
  end
145
160
  end
data/lib/gym/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Gym
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  DESCRIPTION = "Building your iOS apps has never been easier"
4
4
  end
data/lib/gym/xcode.rb ADDED
@@ -0,0 +1,20 @@
1
+ module Gym
2
+ class Xcode
3
+ class << self
4
+ def xcode_path
5
+ Helper.xcode_path
6
+ end
7
+
8
+ def xcode_version
9
+ Helper.xcode_version
10
+ end
11
+
12
+ # Below Xcode 7 (which offers a new nice API to sign the app)
13
+ def pre_7?
14
+ v = xcode_version
15
+ is_pre = v.split('.')[0].to_i < 7
16
+ is_pre
17
+ end
18
+ end
19
+ end
20
+ end
@@ -18,7 +18,7 @@ module Gym
18
18
  expected_md5 = File.read(path)
19
19
 
20
20
  # If that location changes, search it using xcrun --sdk iphoneos -f PackageApplication
21
- package_application_path = "#{Gym.xcode_path}/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication"
21
+ package_application_path = "#{Xcode.xcode_path}/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication"
22
22
 
23
23
  raise "Unable to patch the `PackageApplication` script bundled in XCode. This is not supported." unless expected_md5 == Digest::MD5.file(package_application_path).hexdigest
24
24
 
@@ -1,3 +1,7 @@
1
+ # encoding: utf-8
2
+ # from http://stackoverflow.com/a/9857493/445598
3
+ # because of
4
+ # `incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) (Encoding::CompatibilityError)`
1
5
  require 'zip'
2
6
 
3
7
  module Gym
@@ -23,7 +27,7 @@ module Gym
23
27
  ipa_swift_frameworks.each do |path|
24
28
  framework = File.basename(path)
25
29
 
26
- FileUtils.copy_file("#{Gym.xcode_path}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/#{framework}", File.join(swift_support, framework))
30
+ FileUtils.copy_file("#{Xcode.xcode_path}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/#{framework}", File.join(swift_support, framework))
27
31
  end
28
32
 
29
33
  # Add "SwiftSupport" to the .ipa archive
@@ -13,7 +13,7 @@ module Gym
13
13
  Dir.mkdir(watchkit_support)
14
14
 
15
15
  # Copy WK from Xcode into WatchKitSupport
16
- FileUtils.copy_file("#{Gym.xcode_path}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/WK", File.join(watchkit_support, "WK"))
16
+ FileUtils.copy_file("#{Xcode.xcode_path}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/WK", File.join(watchkit_support, "WK"))
17
17
 
18
18
  # Add "WatchKitSupport" to the .ipa archive
19
19
  Dir.chdir(tmpdir) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gym
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2015-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.1
19
+ version: 0.17.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 1.0.0
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.16.1
29
+ version: 0.17.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.0
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: plist
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: rubyzip
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -216,16 +230,20 @@ files:
216
230
  - lib/assets/package_application_patches/0002_no_strict_parameter_patch.diff
217
231
  - lib/assets/package_application_patches/PackageApplication_MD5
218
232
  - lib/gym.rb
219
- - lib/gym/build_command_generator.rb
220
233
  - lib/gym/commands_generator.rb
221
234
  - lib/gym/detect_values.rb
222
235
  - lib/gym/error_handler.rb
236
+ - lib/gym/generators/README.md
237
+ - lib/gym/generators/build_command_generator.rb
238
+ - lib/gym/generators/package_command_generator.rb
239
+ - lib/gym/generators/package_command_generator_legacy.rb
240
+ - lib/gym/generators/package_command_generator_xcode7.rb
223
241
  - lib/gym/manager.rb
224
242
  - lib/gym/options.rb
225
- - lib/gym/package_command_generator.rb
226
243
  - lib/gym/project.rb
227
244
  - lib/gym/runner.rb
228
245
  - lib/gym/version.rb
246
+ - lib/gym/xcode.rb
229
247
  - lib/gym/xcodebuild_fixes/README.md
230
248
  - lib/gym/xcodebuild_fixes/package_application_fix.rb
231
249
  - lib/gym/xcodebuild_fixes/swift_fix.rb