fastlane 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2b562d1fafbac12f67b12cc30b13728f7ab0e37
4
- data.tar.gz: 3617c1e228aad25ba9c2b785bea9d1405a603338
3
+ metadata.gz: 04596998fa46152b86981296ddddea92a7ef472e
4
+ data.tar.gz: 613ebe717ae9897d7e1ee01db394a51a24c77b08
5
5
  SHA512:
6
- metadata.gz: b7b1513521bfd4f508c6acc18cc9e49bf192cc1974222c5da1c192a29d6d043b05a49baebb2758363d9c0ad738a8bdbce0c31b9154a1493c6a1df7d8cf9eee48
7
- data.tar.gz: ea70445ede668df8b1515af734e89d1589deebf0ba3cfa7ee0723e0676f83dafa6997b73dd1ceda27fcc357c82593e38c7e95e1d1144177c3767b866bb61957f
6
+ metadata.gz: c4c44a73cc339613bd3beca3f2b9e18843169d7de3c5d73e985161b1d3f75960c13c767c31ef4d9368579f69ecee91fff24fefcff804e55e6e2ac073b790d108
7
+ data.tar.gz: a27ff89089022503a16f41e63639464ef082fb95bc3b651e1195527cb178bf73225918352ce510406263904725f0a7ad7dcff94b0448828b924b962d6dfb1e3e
data/README.md CHANGED
@@ -54,11 +54,25 @@ Get in contact with the developer on Twitter: [@KrauseFx](https://twitter.com/Kr
54
54
  - Saves you **hours** of preparing app submission, uploading screenshots and deploying the app for each update
55
55
  - Very flexible configuration using a fully customizable `Fastfile`
56
56
  - Once up and running, you have a fully working **Continuous Deployment** process. Just trigger ```fastlane``` and you're good to go.
57
+ - Over 30 built-in integrations available
57
58
 
58
59
  ##### Take a look at the [fastlane website](https://fastlane.tools) for more information about why and when to use `fastlane`.
59
60
 
60
61
  ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
61
62
 
63
+ # Special Thanks
64
+
65
+ Thanks to all sponsors and contributors for extending and improving the `fastlane` suite:
66
+ - [Detroit Labs](http://www.detroitlabs.com/)
67
+ - Josh Holtz ([@joshdholtz](https://twitter.com/joshdholtz))
68
+ - Dan Trenz ([@dtrenz](https://twitter.com/dtrenz))
69
+ - Luka Mirosevic ([@lmirosevic](https://twitter.com/lmirosevic))
70
+ - Almas Sapargali ([@almassapargali](https://twitter.com/almassapargali))
71
+ - Manuel Wallner ([@milch](https://github.com/milch))
72
+ - Pawel Dudek ([@eldudi](https://twitter.com/eldudi))
73
+
74
+ Check out the project pages of the other tools for more sponsors and contributors.
75
+
62
76
  # Installation
63
77
 
64
78
  I recommend following the [fastlane guide](https://github.com/KrauseFx/fastlane/blob/master/GUIDE.md) to get started.
@@ -5,6 +5,10 @@
5
5
 
6
6
  # All lines starting with a # are ignored when running `fastlane`
7
7
 
8
+ # This is the minimum version number required.
9
+ # Update this, if you use features of a newer version
10
+ fastlane_version "[[FASTLANE_VERSION]]"
11
+
8
12
  before_all do
9
13
  # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
10
14
 
@@ -91,7 +91,7 @@ module Fastlane
91
91
 
92
92
  file_name = File.basename(file).gsub('.rb', '')
93
93
 
94
- class_name = file_name.classify + 'Action'
94
+ class_name = file_name.fastlane_class + 'Action'
95
95
  class_ref = nil
96
96
  begin
97
97
  class_ref = Fastlane::Actions.const_get(class_name)
@@ -16,7 +16,7 @@ module Fastlane
16
16
  repo_path = `git rev-parse --show-toplevel`.strip
17
17
 
18
18
  # find an xcodeproj (ignoreing the Cocoapods one)
19
- xcodeproj_paths = Dir[File.expand_path(File.join(repo_path, '**/*.xcodeproj'))].reject { |path| /.*Pods.xcodeproj/ =~ path }
19
+ xcodeproj_paths = Dir[File.expand_path(File.join(repo_path, '**/*.xcodeproj'))].reject { |path| /Pods\/.*.xcodeproj/ =~ path }
20
20
 
21
21
  raise 'Could not find a .xcodeproj in the current repository\'s working directory.'.red if xcodeproj_paths.count == 0
22
22
  raise 'Found multiple .xcodeproj projects in the current repository\'s working directory. This tool only support project folders with a single .xcodeproj.'.red if xcodeproj_paths.count > 1
@@ -13,15 +13,24 @@ module Fastlane
13
13
 
14
14
  params = params.first
15
15
 
16
- crashlytics_path = params[:crashlytics_path]
17
- api_token = params[:api_token]
18
- build_secret = params[:build_secret]
16
+ crashlytics_path = params[:crashlytics_path] || ENV["CRASHLYTICS_FRAMEWORK_PATH"]
17
+ api_token = params[:api_token] || ENV["CRASHLYTICS_API_TOKEN"]
18
+ build_secret = params[:build_secret] || ENV["CRASHLYTICS_BUILD_SECRET"]
19
19
  ipa_path = params[:ipa_path] || Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
20
20
  notes_path = params[:notes_path]
21
21
  emails = params[:emails]
22
- groups = params[:groups]
23
22
  notifications = params[:notifications]
24
23
 
24
+ # can pass groups param either as an Array or a String
25
+ case params[:groups]
26
+ when NilClass
27
+ groups = nil
28
+ when Array
29
+ groups = params[:groups].join(',')
30
+ when String
31
+ groups = params[:groups]
32
+ end
33
+
25
34
  assert_valid_params!(crashlytics_path, api_token, build_secret, ipa_path)
26
35
 
27
36
  Helper.log.info 'Uploading the IPA to Crashlytics. Go for a coffee ☕️.'.green
@@ -0,0 +1,24 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+
5
+ end
6
+
7
+ class FastlaneVersionAction
8
+ def self.run(params)
9
+ defined_version = ((Gem::Version.new(params.first) if params.first) rescue nil)
10
+ raise "Please pass minimum fastlane version as parameter to fastlane_version".red unless defined_version
11
+
12
+ if Gem::Version.new(Fastlane::VERSION) < defined_version
13
+ raise "The Fastfile requires a fastlane version of >= #{defined_version}. You are on #{Fastlane::VERSION}. Please update using `sudo gem update fastlane`.".red
14
+ end
15
+
16
+ Helper.log.info "fastlane version valid"
17
+ end
18
+
19
+ def self.step_text
20
+ "Verifying required fastlane version"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -5,20 +5,39 @@ module Fastlane
5
5
  end
6
6
 
7
7
  class IncrementBuildNumberAction
8
+ require 'shellwords'
9
+
8
10
  def self.run(params)
9
11
  # More information about how to set up your project and how it works:
10
12
  # https://developer.apple.com/library/ios/qa/qa1827/_index.html
11
13
  # Attention: This is NOT the version number - but the build number
12
14
 
13
15
  begin
14
- custom_number = (params.first rescue nil)
15
-
16
- command = nil
17
- if custom_number
18
- command = "agvtool new-version -all #{custom_number}"
19
- else
20
- command = 'agvtool next-version -all'
16
+ first_param = (params.first rescue nil)
17
+
18
+ case first_param
19
+ when NilClass
20
+ custom_number = nil
21
+ folder = '.'
22
+ when Fixnum
23
+ custom_number = first_param
24
+ folder = '.'
25
+ when Hash
26
+ custom_number = first_param[:build_number]
27
+ folder = first_param[:xcodeproj] ? File.join('.', first_param[:xcodeproj], '..') : '.'
21
28
  end
29
+
30
+ command_prefix = [
31
+ 'cd',
32
+ File.expand_path(folder).shellescape,
33
+ '&&'
34
+ ].join(' ')
35
+
36
+ command = [
37
+ command_prefix,
38
+ 'agvtool',
39
+ custom_number ? "new-version -all #{custom_number}" : 'next-version -all'
40
+ ].join(' ')
22
41
 
23
42
  if Helper.test?
24
43
  Actions.lane_context[SharedValues::BUILD_NUMBER] = command
@@ -27,10 +46,9 @@ module Fastlane
27
46
  Actions.sh command
28
47
 
29
48
  # Store the new number in the shared hash
30
- build_number = `agvtool what-version`.split("\n").last.to_i
49
+ build_number = `#{command_prefix} agvtool what-version`.split("\n").last.to_i
31
50
 
32
51
  Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number
33
-
34
52
  end
35
53
  rescue => ex
36
54
  Helper.log.error 'Make sure to to follow the steps to setup your Xcode project: https://developer.apple.com/library/ios/qa/qa1827/_index.html'.yellow
@@ -29,14 +29,15 @@ module Fastlane
29
29
  def self.run(params)
30
30
  options = { message: '',
31
31
  success: true,
32
- channel: nil
32
+ channel: nil,
33
+ payload: {}
33
34
  }.merge(params.first || {})
34
35
 
35
36
  require 'slack-notifier'
36
37
 
37
38
  color = (options[:success] ? 'good' : 'danger')
38
39
  options[:message] = options[:message].to_s
39
-
40
+
40
41
  options[:message] = Slack::Notifier::LinkFormatter.format(options[:message])
41
42
 
42
43
  url = ENV['SLACK_URL']
@@ -53,37 +54,57 @@ module Fastlane
53
54
  notifier.channel = ('#' + notifier.channel) unless ['#', '@'].include?(notifier.channel[0]) # send message to channel by default
54
55
  end
55
56
 
56
- test_result = {
57
+ should_add_payload = ->(payload_name) { options[:default_payloads].nil? || options[:default_payloads].include?(payload_name) }
58
+
59
+ slack_attachment = {
57
60
  fallback: options[:message],
58
61
  text: options[:message],
59
62
  color: color,
60
- fields: [
61
- {
62
- title: 'Lane',
63
- value: Actions.lane_context[Actions::SharedValues::LANE_NAME],
64
- short: true
65
- },
66
- {
67
- title: 'Test Result',
68
- value: (options[:success] ? 'Success' : 'Error'),
69
- short: true
70
- }
71
- ]
63
+ fields: []
72
64
  }
73
65
 
74
- if git_branch
75
- test_result[:fields] << {
66
+ # custom user payloads
67
+ slack_attachment[:fields] += options[:payload].map do |k, v|
68
+ {
69
+ title: k.to_s,
70
+ value: v.to_s,
71
+ short: false
72
+ }
73
+ end
74
+
75
+ # lane
76
+ if should_add_payload[:lane]
77
+ slack_attachment[:fields] << {
78
+ title: 'Lane',
79
+ value: Actions.lane_context[Actions::SharedValues::LANE_NAME],
80
+ short: true
81
+ }
82
+ end
83
+
84
+ # test_result
85
+ if should_add_payload[:test_result]
86
+ slack_attachment[:fields] << {
87
+ title: 'Test Result',
88
+ value: (options[:success] ? 'Success' : 'Error'),
89
+ short: true
90
+ }
91
+ end
92
+
93
+ # git branch
94
+ if git_branch && should_add_payload[:git_branch]
95
+ slack_attachment[:fields] << {
76
96
  title: 'Git Branch',
77
97
  value: git_branch,
78
98
  short: true
79
99
  }
80
100
  end
81
101
 
82
- if git_author
83
- if ENV['FASTLANE_SLACK_HIDE_AUTHOR_ON_SUCCESS'] and options[:success]
102
+ # git_author
103
+ if git_author && should_add_payload[:git_author]
104
+ if ENV['FASTLANE_SLACK_HIDE_AUTHOR_ON_SUCCESS'] && options[:success]
84
105
  # We only show the git author if the build failed
85
106
  else
86
- test_result[:fields] << {
107
+ slack_attachment[:fields] << {
87
108
  title: 'Git Author',
88
109
  value: git_author,
89
110
  short: true
@@ -91,8 +112,9 @@ module Fastlane
91
112
  end
92
113
  end
93
114
 
94
- if last_git_commit
95
- test_result[:fields] << {
115
+ # last_git_commit
116
+ if last_git_commit && should_add_payload[:last_git_commit]
117
+ slack_attachment[:fields] << {
96
118
  title: 'Git Commit',
97
119
  value: last_git_commit,
98
120
  short: false
@@ -101,7 +123,7 @@ module Fastlane
101
123
 
102
124
  result = notifier.ping '',
103
125
  icon_url: 'https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png',
104
- attachments: [test_result]
126
+ attachments: [slack_attachment]
105
127
 
106
128
  unless result.code.to_i == 200
107
129
  Helper.log.debug result
@@ -48,19 +48,20 @@ module Fastlane
48
48
  end
49
49
 
50
50
  # The args we will build with
51
- cli_args = Array[]
51
+ xcodebuild_args = Array[]
52
52
 
53
53
  # Supported ENV vars
54
- build_path = ENV["BUILD_PATH"] || ""
55
- scheme = ENV["SCHEME"]
56
- workspace = ENV["WORKSPACE"]
57
- project = ENV["PROJECT"]
54
+ build_path = ENV["XCODE_BUILD_PATH"] || nil
55
+ scheme = ENV["XCODE_SCHEME"]
56
+ workspace = ENV["XCODE_WORKSPACE"]
57
+ project = ENV["XCODE_PROJECT"]
58
58
 
59
59
  # Append slash to build path, if needed
60
- unless build_path.end_with? "/"
60
+ if build_path && !build_path.end_with?("/")
61
61
  build_path += "/"
62
62
  end
63
63
 
64
+
64
65
  if params = params.first
65
66
  # Operation bools
66
67
  archiving = params.key? :archive
@@ -84,6 +85,12 @@ module Fastlane
84
85
  params[:scheme] ||= scheme
85
86
  params[:workspace] ||= workspace
86
87
  params[:project] ||= project
88
+
89
+ # If no project or workspace was passed in or set as an environment
90
+ # variable, attempt to autodetect the workspace.
91
+ if params[:project].to_s.empty? && params[:workspace].to_s.empty?
92
+ params[:workspace] = detect_workspace
93
+ end
87
94
  end
88
95
 
89
96
  if archiving
@@ -95,20 +102,53 @@ module Fastlane
95
102
  end
96
103
 
97
104
  # Maps parameter hash to CLI args
98
- if hash_args = hash_to_cli_args(params)
99
- cli_args += hash_args
105
+ if hash_args = hash_to_args(params)
106
+ xcodebuild_args += hash_args
100
107
  end
101
108
  end
102
109
 
103
110
  # Joins args into space delimited string
104
- cli_args = cli_args.join(" ")
111
+ xcodebuild_args = xcodebuild_args.join(" ")
112
+
113
+ # Default args
114
+ xcpretty_args = [ "--color" ]
115
+
116
+ # Stdout format
117
+ if testing && !archiving
118
+ xcpretty_args.push "--test"
119
+ else
120
+ xcpretty_args.push "--simple"
121
+ end
122
+
123
+ if testing
124
+ # Test report file format
125
+ if params[:report_formats]
126
+ report_formats = params[:report_formats].map do |format|
127
+ "--report #{format}"
128
+ end.sort().join(" ")
129
+
130
+ xcpretty_args.push report_formats
131
+
132
+ # Test report file path
133
+ if params[:report_path]
134
+ xcpretty_args.push "--output \"#{params[:report_path]}\""
135
+ elsif build_path
136
+ xcpretty_args.push "--output \"#{build_path}report\""
137
+ end
138
+
139
+ # Save screenshots flag
140
+ if params[:report_formats].include?("html") && params[:report_screenshots]
141
+ xcpretty_args.push "--screenshots"
142
+ end
143
+ end
144
+ end
105
145
 
106
- output_format = testing && !archiving ? "--test" : "--simple"
146
+ xcpretty_args = xcpretty_args.sort.join(" ")
107
147
 
108
- Actions.sh "xcodebuild #{cli_args} | xcpretty #{output_format} --color"
148
+ Actions.sh "set -o pipefail && xcodebuild #{xcodebuild_args} | xcpretty #{xcpretty_args}"
109
149
  end
110
150
 
111
- def self.hash_to_cli_args(hash)
151
+ def self.hash_to_args(hash)
112
152
  # Remove nil value params
113
153
  hash = hash.delete_if { |_, v| v.nil? }
114
154
 
@@ -118,12 +158,30 @@ module Fastlane
118
158
  if arg = ARGS_MAP[k]
119
159
  value = (v != true && v.to_s.length > 0 ? "\"#{v}\"" : "")
120
160
  "#{arg} #{value}".strip
161
+ elsif k == :build_settings
162
+ v.map{|setting,value| "#{setting}=\"#{value}\""}.join(' ')
121
163
  elsif k == :keychain && v.to_s.length > 0
122
164
  # If keychain is specified, append as OTHER_CODE_SIGN_FLAGS
123
165
  "OTHER_CODE_SIGN_FLAGS=\"--keychain #{v}\""
124
166
  end
125
167
  end.compact.sort
126
168
  end
169
+
170
+ def self.detect_workspace
171
+ workspace = nil
172
+ workspaces = Dir.glob("*.xcworkspace")
173
+
174
+ if workspaces.length > 1
175
+ Helper.log.warn "Multiple workspaces detected."
176
+ end
177
+
178
+ if !workspaces.empty?
179
+ workspace = workspaces.first
180
+ Helper.log.warn "Using workspace \"#{workspace}\""
181
+ end
182
+
183
+ return workspace
184
+ end
127
185
  end
128
186
 
129
187
  class XcarchiveAction
@@ -166,4 +224,4 @@ module Fastlane
166
224
  end
167
225
  end
168
226
  end
169
- end
227
+ end
@@ -1,5 +1,5 @@
1
1
  class String
2
- def classify
2
+ def fastlane_class
3
3
  split('_').collect!(&:capitalize).join
4
4
  end
5
- end
5
+ end
@@ -63,7 +63,7 @@ module Fastlane
63
63
  def method_missing(method_sym, *arguments, &_block)
64
64
  # First, check if there is a predefined method in the actions folder
65
65
 
66
- class_name = method_sym.to_s.classify + 'Action'
66
+ class_name = method_sym.to_s.fastlane_class + 'Action'
67
67
  class_ref = nil
68
68
  begin
69
69
  class_ref = Fastlane::Actions.const_get(class_name)
@@ -73,10 +73,9 @@ module Fastlane
73
73
  end
74
74
 
75
75
  if class_ref && class_ref.respond_to?(:run)
76
- line = "----------" + ("-" * method_sym.to_s.length) + "----"
77
- Helper.log.info line.green
78
- Helper.log.info "--- Step: #{method_sym.to_s} ---".green
79
- Helper.log.info line.green
76
+ step_name = class_ref.step_text rescue nil
77
+ step_name = method_sym.to_s unless step_name
78
+ Helper.log_alert("Step: " + step_name)
80
79
 
81
80
  Dir.chdir('..') do # go up from the fastlane folder, to the project folder
82
81
  Actions.execute_action(method_sym) do
@@ -21,7 +21,7 @@ module Fastlane
21
21
  template = File.read("#{Helper.gem_path('fastlane')}/lib/assets/custom_action_template.rb")
22
22
  template.gsub!('[[NAME]]', name)
23
23
  template.gsub!('[[NAME_UP]]', name.upcase)
24
- template.gsub!('[[NAME_CLASS]]', name.classify + 'Action')
24
+ template.gsub!('[[NAME_CLASS]]', name.fastlane_class + 'Action')
25
25
 
26
26
  actions_path = File.join((FastlaneFolder.path || Dir.pwd), 'actions')
27
27
  FileUtils.mkdir_p(actions_path) unless File.directory?(actions_path)
@@ -112,6 +112,7 @@ module Fastlane
112
112
  template.gsub!('sigh', '# sigh') unless @tools[:sigh]
113
113
  template.gsub!('xctool', '# xctool') unless @tools[:xctool]
114
114
  template.gsub!('cocoapods', '# cocoapods') unless @tools[:cocoapods]
115
+ template.gsub!('[[FASTLANE_VERSION]]', Fastlane::VERSION)
115
116
 
116
117
  @tools.each do |key, value|
117
118
  Helper.log.info "'#{key}' enabled.".magenta if value
@@ -1,3 +1,3 @@
1
1
  module Fastlane
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.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-03-10 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - '>='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.2.1
103
+ version: 0.3.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.2.1
110
+ version: 0.3.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: deliver
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -359,6 +359,7 @@ files:
359
359
  - lib/fastlane/actions/deliver.rb
360
360
  - lib/fastlane/actions/deploygate.rb
361
361
  - lib/fastlane/actions/ensure_git_status_clean.rb
362
+ - lib/fastlane/actions/fastlane_version.rb
362
363
  - lib/fastlane/actions/frameit.rb
363
364
  - lib/fastlane/actions/gcovr.rb
364
365
  - lib/fastlane/actions/hipchat.rb