gym 0.8.5 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gym.rb +0 -1
- data/lib/gym/commands_generator.rb +5 -3
- data/lib/gym/detect_values.rb +2 -31
- data/lib/gym/options.rb +1 -1
- data/lib/gym/version.rb +1 -1
- metadata +4 -5
- data/lib/gym/project.rb +0 -155
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5e3ff1dbe1ecddac3e2dd4e1602d35d6811bdd
|
4
|
+
data.tar.gz: 92d74eb24a71df4fd13f26345dfb2f2cdd9cf444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ece0072e1dcb0283d3ddcc147db83a424d24becbaeeae9735e0d2d495a823dabd65c95a3960c2f8fa4ec69db847cb09a62c56f621d399a76b471ad0321b6275
|
7
|
+
data.tar.gz: ae7f91cc021f1cc4be8a09195d71a05687d012010d8846680acb440fe0ef4343df73484df2789326b538f0b9fa79c351994dc96a5bd8f1f4c5fce42b41917496
|
data/lib/gym.rb
CHANGED
@@ -46,10 +46,12 @@ module Gym
|
|
46
46
|
c.syntax = "gym init"
|
47
47
|
c.description = "Creates a new Gymfile for you"
|
48
48
|
c.action do |_args, options|
|
49
|
-
|
49
|
+
containing = (File.directory?("fastlane") ? 'fastlane' : '.')
|
50
|
+
path = File.join(containing, Gym.gymfile_name)
|
51
|
+
raise "Gymfile already exists" if File.exist?(path)
|
50
52
|
template = File.read("#{Helper.gem_path('gym')}/lib/assets/GymfileTemplate")
|
51
|
-
File.write(
|
52
|
-
Helper.log.info "Successfully created '#{
|
53
|
+
File.write(path, template)
|
54
|
+
Helper.log.info "Successfully created '#{path}'. Open the file using a code editor.".green
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
data/lib/gym/detect_values.rb
CHANGED
@@ -16,7 +16,7 @@ module Gym
|
|
16
16
|
raise "No project/workspace found in the current directory.".red
|
17
17
|
end
|
18
18
|
|
19
|
-
Gym.project = Project.new(config)
|
19
|
+
Gym.project = FastlaneCore::Project.new(config)
|
20
20
|
detect_provisioning_profile
|
21
21
|
|
22
22
|
# Go into the project's folder
|
@@ -106,36 +106,7 @@ module Gym
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def self.detect_scheme
|
109
|
-
|
110
|
-
proj_schemes = Gym.project.schemes
|
111
|
-
|
112
|
-
if config[:scheme].to_s.length > 0
|
113
|
-
# Verify the scheme is available
|
114
|
-
unless proj_schemes.include?(config[:scheme].to_s)
|
115
|
-
Helper.log.error "Couldn't find specified scheme '#{config[:scheme]}'.".red
|
116
|
-
config[:scheme] = nil
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
return if config[:scheme].to_s.length > 0
|
121
|
-
|
122
|
-
if proj_schemes.count == 1
|
123
|
-
config[:scheme] = proj_schemes.last
|
124
|
-
elsif proj_schemes.count > 1
|
125
|
-
if Helper.is_ci?
|
126
|
-
Helper.log.error "Multiple schemes found but you haven't specified one.".red
|
127
|
-
Helper.log.error "Since this is a CI, please pass one using the `scheme` option".red
|
128
|
-
raise "Multiple schemes found".red
|
129
|
-
else
|
130
|
-
puts "Select Scheme: "
|
131
|
-
config[:scheme] = choose(*(proj_schemes))
|
132
|
-
end
|
133
|
-
else
|
134
|
-
Helper.log.error "Couldn't find any schemes in this project, make sure that the scheme is shared if you are using a workspace".red
|
135
|
-
Helper.log.error "Open Xcode, click on `Manage Schemes` and check the `Shared` box for the schemes you want to use".red
|
136
|
-
|
137
|
-
raise "No Schemes found".red
|
138
|
-
end
|
109
|
+
Gym.project.select_scheme
|
139
110
|
end
|
140
111
|
|
141
112
|
# Is it an iOS device or a Mac?
|
data/lib/gym/options.rb
CHANGED
@@ -65,7 +65,7 @@ module Gym
|
|
65
65
|
FastlaneCore::ConfigItem.new(key: :buildlog_path,
|
66
66
|
short_option: "-l",
|
67
67
|
env_name: "GYM_BUILDLOG_PATH",
|
68
|
-
description: "The directory
|
68
|
+
description: "The directory where to store the build log",
|
69
69
|
default_value: "~/Library/Logs/gym"),
|
70
70
|
FastlaneCore::ConfigItem.new(key: :sdk,
|
71
71
|
short_option: "-k",
|
data/lib/gym/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.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-10-
|
11
|
+
date: 2015-10-11 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.
|
19
|
+
version: 0.20.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.
|
29
|
+
version: 0.20.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.0
|
@@ -240,7 +240,6 @@ files:
|
|
240
240
|
- lib/gym/generators/package_command_generator_xcode7.rb
|
241
241
|
- lib/gym/manager.rb
|
242
242
|
- lib/gym/options.rb
|
243
|
-
- lib/gym/project.rb
|
244
243
|
- lib/gym/runner.rb
|
245
244
|
- lib/gym/version.rb
|
246
245
|
- lib/gym/xcode.rb
|
data/lib/gym/project.rb
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
module Gym
|
2
|
-
# Represents the Xcode project/workspace
|
3
|
-
class Project
|
4
|
-
# Path to the project/workspace
|
5
|
-
attr_accessor :path
|
6
|
-
|
7
|
-
attr_accessor :is_workspace
|
8
|
-
|
9
|
-
def initialize(options)
|
10
|
-
self.path = File.expand_path(options[:workspace] || options[:project])
|
11
|
-
self.is_workspace = (options[:workspace].to_s.length > 0)
|
12
|
-
|
13
|
-
if !path or !File.directory? path
|
14
|
-
raise "Could not find project at path '#{path}'".red
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def workspace?
|
19
|
-
self.is_workspace
|
20
|
-
end
|
21
|
-
|
22
|
-
# Get all available schemes in an array
|
23
|
-
def schemes
|
24
|
-
results = []
|
25
|
-
output = raw_info.split("Schemes:").last.split(":").first
|
26
|
-
|
27
|
-
if raw_info.include?("There are no schemes in workspace") or raw_info.include?("This project contains no schemes")
|
28
|
-
return results
|
29
|
-
end
|
30
|
-
|
31
|
-
output.split("\n").each do |current|
|
32
|
-
current = current.strip
|
33
|
-
|
34
|
-
next if current.length == 0
|
35
|
-
results << current
|
36
|
-
end
|
37
|
-
|
38
|
-
results
|
39
|
-
end
|
40
|
-
|
41
|
-
# Get all available configurations in an array
|
42
|
-
def configurations
|
43
|
-
results = []
|
44
|
-
splitted = raw_info.split("Configurations:")
|
45
|
-
return [] if splitted.count != 2 # probably a CocoaPods project
|
46
|
-
|
47
|
-
output = splitted.last.split(":").first
|
48
|
-
output.split("\n").each_with_index do |current, index|
|
49
|
-
current = current.strip
|
50
|
-
|
51
|
-
if current.length == 0
|
52
|
-
next if index == 0
|
53
|
-
break # as we want to break on the empty line
|
54
|
-
end
|
55
|
-
|
56
|
-
results << current
|
57
|
-
end
|
58
|
-
|
59
|
-
results
|
60
|
-
end
|
61
|
-
|
62
|
-
def app_name
|
63
|
-
# WRAPPER_NAME: Example.app
|
64
|
-
# WRAPPER_SUFFIX: .app
|
65
|
-
name = build_settings(key: "WRAPPER_NAME")
|
66
|
-
|
67
|
-
return name.gsub(build_settings(key: "WRAPPER_SUFFIX"), "") if name
|
68
|
-
return "App" # default value
|
69
|
-
end
|
70
|
-
|
71
|
-
def mac?
|
72
|
-
# Some projects have different values... we have to look for all of them
|
73
|
-
return true if build_settings(key: "PLATFORM_NAME") == "macosx"
|
74
|
-
return true if build_settings(key: "PLATFORM_DISPLAY_NAME") == "OS X"
|
75
|
-
false
|
76
|
-
end
|
77
|
-
|
78
|
-
def ios?
|
79
|
-
!mac?
|
80
|
-
end
|
81
|
-
|
82
|
-
#####################################################
|
83
|
-
# @!group Raw Access
|
84
|
-
#####################################################
|
85
|
-
|
86
|
-
# Get the build settings for our project
|
87
|
-
# this is used to properly get the DerivedData folder
|
88
|
-
# @param [String] The key of which we want the value for (e.g. "PRODUCT_NAME")
|
89
|
-
def build_settings(key: nil, optional: true)
|
90
|
-
unless @build_settings
|
91
|
-
# We also need to pass the workspace and scheme to this command
|
92
|
-
command = "xcrun xcodebuild -showBuildSettings #{BuildCommandGenerator.project_path_array.join(' ')}"
|
93
|
-
Helper.log.info command.yellow unless Gym.config[:silent]
|
94
|
-
@build_settings = `#{command}`
|
95
|
-
end
|
96
|
-
|
97
|
-
begin
|
98
|
-
result = @build_settings.split("\n").find { |c| c.include? key }
|
99
|
-
return result.split(" = ").last
|
100
|
-
rescue => ex
|
101
|
-
return nil if optional # an optional value, we really don't care if something goes wrong
|
102
|
-
|
103
|
-
Helper.log.error caller.join("\n\t")
|
104
|
-
Helper.log.error "Could not fetch #{key} from project file: #{ex}"
|
105
|
-
end
|
106
|
-
|
107
|
-
nil
|
108
|
-
end
|
109
|
-
|
110
|
-
def raw_info
|
111
|
-
# Examples:
|
112
|
-
|
113
|
-
# Standard:
|
114
|
-
#
|
115
|
-
# Information about project "Example":
|
116
|
-
# Targets:
|
117
|
-
# Example
|
118
|
-
# ExampleUITests
|
119
|
-
#
|
120
|
-
# Build Configurations:
|
121
|
-
# Debug
|
122
|
-
# Release
|
123
|
-
#
|
124
|
-
# If no build configuration is specified and -scheme is not passed then "Release" is used.
|
125
|
-
#
|
126
|
-
# Schemes:
|
127
|
-
# Example
|
128
|
-
# ExampleUITests
|
129
|
-
|
130
|
-
# CococaPods
|
131
|
-
#
|
132
|
-
# Example.xcworkspace
|
133
|
-
# Information about workspace "Example":
|
134
|
-
# Schemes:
|
135
|
-
# Example
|
136
|
-
# HexColors
|
137
|
-
# Pods-Example
|
138
|
-
|
139
|
-
return @raw if @raw
|
140
|
-
|
141
|
-
# Unfortunately since we pass the workspace we also get all the
|
142
|
-
# schemes generated by CocoaPods
|
143
|
-
|
144
|
-
options = BuildCommandGenerator.project_path_array.delete_if { |a| a.to_s.include? "scheme" }
|
145
|
-
command = "xcrun xcodebuild -list #{options.join(' ')}"
|
146
|
-
Helper.log.info command.yellow unless Gym.config[:silent]
|
147
|
-
|
148
|
-
@raw = `#{command}`.to_s
|
149
|
-
|
150
|
-
raise "Error parsing xcode file using `#{command}`".red if @raw.length == 0
|
151
|
-
|
152
|
-
return @raw
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|