match 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: c3331622bdfb12e51b9a0108c54d6c3447daafe7
4
- data.tar.gz: 436dc1400d5ba67b84b6f809e970bfafd190b464
3
+ metadata.gz: 72a69112e9b7d60968bf6ad15e377d17d4b817cb
4
+ data.tar.gz: 5024ebfeb8af33d9c669b2c22138be0fd8c638a5
5
5
  SHA512:
6
- metadata.gz: bd0ec61a08238e00d7740ae0fedaa3641f69f89522de04d317d00fcccb62277741f0b7445bc33f7c0a1ef3a479e8e1b716837f62384069bf022009b8bb487a40
7
- data.tar.gz: 462bcc66bad561c3c4f79878791d36f4db9ec72e752c8caf3b1c8bb4c6ced2227f499f70c8723fef691e9d63bfa2fc352ea860bc71aa26285002dd643089123e
6
+ metadata.gz: c97d430de5290209b29ebac27a657586866979d53c0f32f73bbcb3d7ebe6d0bed85c24c8e22e183b1785940bf143cad2a01645fc4656b38c09f18aa58c95dba1
7
+ data.tar.gz: 82741376245582fa2387127368a0c1f5cbcedca124a60e4c924d652cd917d808c46e964bb15ecb9f0b926c9d08ceef20e113ae029c178d512e24cc2dfe3cff44
data/README.md CHANGED
@@ -49,7 +49,7 @@ A new approach to iOS code signing: Share one code signing identity across your
49
49
 
50
50
  -------
51
51
 
52
- <h5 align="center"><code>match</code> is part of <a href="https://fastlane.tools">fastlane</a>: connect all deployment tools into one streamlined workflow.</h5>
52
+ <h5 align="center"><code>match</code> is part of <a href="https://fastlane.tools">fastlane</a>: The easiest way to automate building and releasing your iOS and Android apps.</h5>
53
53
 
54
54
  ## Why match?
55
55
 
@@ -128,9 +128,9 @@ app_identifier "tools.fastlane.app"
128
128
  username "user@fastlane.tools"
129
129
  ```
130
130
 
131
- #### Important: Use one git repo per team
131
+ #### Important: Use one git branch per team
132
132
 
133
- `match` was designed to have one git repository per Apple account. If you work in multiple teams, please create one repo for each of them. More information on [codesigning.guide](https://codesigning.guide)
133
+ `match` was designed to use a separate git branch per Apple account. If you work in multiple teams, make sure to set the `git_branch` parameter to a unique value per team. From there, `match` will automatically create and use the specified branch for you. More information on [codesigning.guide](https://codesigning.guide)
134
134
 
135
135
  ### Run
136
136
 
@@ -373,7 +373,7 @@ Because of the potentially dangerous nature of In-House profiles we decided to n
373
373
 
374
374
  ## [`fastlane`](https://fastlane.tools) Toolchain
375
375
 
376
- - [`fastlane`](https://fastlane.tools): Connect all deployment tools into one streamlined workflow
376
+ - [`fastlane`](https://fastlane.tools): The easiest way to automate building and releasing your iOS and Android apps
377
377
  - [`deliver`](https://github.com/fastlane/fastlane/tree/master/deliver): Upload screenshots, metadata and your app to the App Store
378
378
  - [`snapshot`](https://github.com/fastlane/fastlane/tree/master/snapshot): Automate taking localized screenshots of your iOS app on every device
379
379
  - [`frameit`](https://github.com/fastlane/fastlane/tree/master/frameit): Quickly put your screenshots into the right device frames
data/bin/match CHANGED
@@ -1,129 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  $:.push File.expand_path("../../lib", __FILE__)
4
3
 
5
4
  require 'match'
6
- require 'commander'
7
-
8
- HighLine.track_eof = false
9
-
10
- class MatchApplication
11
- include Commander::Methods
12
- UI = FastlaneCore::UI
13
-
14
- # rubocop:disable Metrics/MethodLength
15
- # rubocop:disable Metrics/AbcSize
16
- def run
17
- program :version, Match::VERSION
18
- program :description, Match::DESCRIPTION
19
- program :help, 'Author', 'Felix Krause <match@krausefx.com>'
20
- program :help, 'Website', 'https://fastlane.tools'
21
- program :help, 'GitHub', 'https://github.com/fastlane/match'
22
- program :help_formatter, :compact
23
-
24
- global_option('--verbose') { $verbose = true }
25
-
26
- FastlaneCore::CommanderGenerator.new.generate(Match::Options.available_options)
27
-
28
- command :run do |c|
29
- c.syntax = 'match'
30
- c.description = Match::DESCRIPTION
31
-
32
- c.action do |args, options|
33
- if args.count > 0
34
- FastlaneCore::UI.user_error!("Please run `match [type]`, allowed values: development, adhoc or appstore")
35
- end
36
-
37
- params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
38
- params.load_configuration_file("Matchfile")
39
- Match::Runner.new.run(params)
40
- end
41
- end
42
-
43
- Match.environments.each do |type|
44
- command type do |c|
45
- c.syntax = "match #{type}"
46
- c.description = "Run match for a #{type} provisioning profile"
47
-
48
- c.action do |args, options|
49
- params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
50
- params.load_configuration_file("Matchfile") # this has to be done *before* overwriting the value
51
- params[:type] = type.to_s
52
- Match::Runner.new.run(params)
53
- end
54
- end
55
- end
56
-
57
- command :init do |c|
58
- c.syntax = 'match init'
59
- c.description = 'Create the Matchfile for you'
60
- c.action do |args, options|
61
- containing = (File.directory?("fastlane") ? 'fastlane' : '.')
62
- path = File.join(containing, "Matchfile")
63
-
64
- if File.exist?(path)
65
- FastlaneCore::UI.user_error!("You already got a Matchfile in this directory")
66
- return 0
67
- end
68
-
69
- Match::Setup.new.run(path)
70
- end
71
- end
72
-
73
- command :change_password do |c|
74
- c.syntax = 'match change_password'
75
- c.description = 'Re-encrypt all files with a different password'
76
- c.action do |args, options|
77
- params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
78
- params.load_configuration_file("Matchfile")
79
-
80
- Match::ChangePassword.update(params: params)
81
- UI.success "Successfully changed the password. Make sure to update the password on all your clients and servers"
82
- end
83
- end
84
-
85
- command :decrypt do |c|
86
- c.syntax = "match decrypt"
87
- c.description = "Decrypts the repository and keeps it on the filesystem"
88
- c.action do |args, options|
89
- params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
90
- params.load_configuration_file("Matchfile")
91
- decrypted_repo = Match::GitHelper.clone(params[:git_url], params[:shallow_clone])
92
- UI.success "Repo is at: '#{decrypted_repo}'"
93
- end
94
- end
95
- command "nuke" do |c|
96
- # We have this empty command here, since otherwise the normal `match` command will be executed
97
- c.syntax = "match nuke"
98
- c.description = "Delete all certificates and provisioning profiles from the Apple Dev Portal"
99
- c.action do |args, options|
100
- FastlaneCore::UI.user_error!("Please run `match nuke [type], allowed values: distribution and development")
101
- end
102
- end
103
-
104
- ["development", "distribution"].each do |type|
105
- command "nuke #{type}" do |c|
106
- c.syntax = "match nuke #{type}"
107
- c.description = "Delete all certificates and provisioning profiles from the Apple Dev Portal of the type #{type}"
108
- c.action do |args, options|
109
- params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
110
- params.load_configuration_file("Matchfile")
111
- Match::Nuke.new.run(params, type: type.to_s)
112
- end
113
- end
114
- end
115
-
116
- default_command :run
117
-
118
- run!
119
- end
120
- # rubocop:enable Metrics/MethodLength
121
- # rubocop:enable Metrics/AbcSize
122
- end
123
-
124
- begin
125
- FastlaneCore::UpdateChecker.start_looking_for_update('match')
126
- MatchApplication.new.run
127
- ensure
128
- FastlaneCore::UpdateChecker.show_update_status('match', Match::VERSION)
129
- end
5
+ require 'match/commands_generator'
6
+ Match::CommandsGenerator.start
@@ -1,4 +1,4 @@
1
- ## [fastlane match](https://github.com/fastlane/fastlane/tree/master/match)
1
+ ## [fastlane match](https://github.com/fastlane/fastlane/tree/master/match#readme)
2
2
 
3
3
  This repository contains all your certificates and provisioning profiles needed to build and sign your applications. They are encrypted using OpenSSL via a passphrase.
4
4
 
@@ -6,7 +6,7 @@ This repository contains all your certificates and provisioning profiles needed
6
6
 
7
7
  Do not modify this file, as it gets overwritten every time you run `match`.
8
8
 
9
- ### Install [fastlane match](https://github.com/fastlane/fastlane/tree/master/match)
9
+ ### Install [fastlane match](https://github.com/fastlane/fastlane/tree/master/match#readme)
10
10
 
11
11
  ```
12
12
  sudo gem install match
@@ -32,7 +32,7 @@ match adhoc
32
32
  match development
33
33
  ```
34
34
 
35
- For more information open [fastlane match git repo](https://github.com/fastlane/fastlane/tree/master/match)
35
+ For more information open [fastlane match git repo](https://github.com/fastlane/fastlane/tree/master/match#readme)
36
36
 
37
37
  ### Content
38
38
 
@@ -46,4 +46,4 @@ This directory contains all provisioning profiles
46
46
 
47
47
  ------------------------------------
48
48
 
49
- For more information open [fastlane match git repo](https://github.com/fastlane/fastlane/tree/master/match)
49
+ For more information open [fastlane match git repo](https://github.com/fastlane/fastlane/tree/master/match#readme)
@@ -4,12 +4,12 @@ module Match
4
4
  to ||= ChangePassword.ask_password(message: "New passphrase for Git Repo: ", confirm: false)
5
5
  from ||= ChangePassword.ask_password(message: "Old passphrase for Git Repo: ", confirm: true)
6
6
  GitHelper.clear_changes
7
- workspace = GitHelper.clone(params[:git_url], params[:shallow_clone], manual_password: from, skip_docs: params[:skip_docs])
7
+ workspace = GitHelper.clone(params[:git_url], params[:shallow_clone], manual_password: from, skip_docs: params[:skip_docs], branch: params[:git_branch])
8
8
  Encrypt.new.clear_password(params[:git_url])
9
9
  Encrypt.new.store_password(params[:git_url], to)
10
10
 
11
11
  message = "[fastlane] Changed passphrase"
12
- GitHelper.commit_changes(workspace, message, params[:git_url])
12
+ GitHelper.commit_changes(workspace, message, params[:git_url], params[:git_branch])
13
13
  end
14
14
 
15
15
  def self.ask_password(message: "Passphrase for Git Repo: ", confirm: true)
@@ -0,0 +1,126 @@
1
+ require 'commander'
2
+
3
+ HighLine.track_eof = false
4
+
5
+ module Match
6
+ class CommandsGenerator
7
+ include Commander::Methods
8
+ UI = FastlaneCore::UI
9
+
10
+ def self.start
11
+ FastlaneCore::UpdateChecker.start_looking_for_update('match')
12
+ self.new.run
13
+ ensure
14
+ FastlaneCore::UpdateChecker.show_update_status('match', Match::VERSION)
15
+ end
16
+
17
+ # rubocop:disable Metrics/MethodLength
18
+ # rubocop:disable Metrics/AbcSize
19
+ def run
20
+ program :version, Match::VERSION
21
+ program :description, Match::DESCRIPTION
22
+ program :help, 'Author', 'Felix Krause <match@krausefx.com>'
23
+ program :help, 'Website', 'https://fastlane.tools'
24
+ program :help, 'GitHub', 'https://github.com/fastlane/match'
25
+ program :help_formatter, :compact
26
+
27
+ global_option('--verbose') { $verbose = true }
28
+
29
+ FastlaneCore::CommanderGenerator.new.generate(Match::Options.available_options)
30
+
31
+ command :run do |c|
32
+ c.syntax = 'match'
33
+ c.description = Match::DESCRIPTION
34
+
35
+ c.action do |args, options|
36
+ if args.count > 0
37
+ FastlaneCore::UI.user_error!("Please run `match [type]`, allowed values: development, adhoc or appstore")
38
+ end
39
+
40
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
41
+ params.load_configuration_file("Matchfile")
42
+ Match::Runner.new.run(params)
43
+ end
44
+ end
45
+
46
+ Match.environments.each do |type|
47
+ command type do |c|
48
+ c.syntax = "match #{type}"
49
+ c.description = "Run match for a #{type} provisioning profile"
50
+
51
+ c.action do |args, options|
52
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
53
+ params.load_configuration_file("Matchfile") # this has to be done *before* overwriting the value
54
+ params[:type] = type.to_s
55
+ Match::Runner.new.run(params)
56
+ end
57
+ end
58
+ end
59
+
60
+ command :init do |c|
61
+ c.syntax = 'match init'
62
+ c.description = 'Create the Matchfile for you'
63
+ c.action do |args, options|
64
+ containing = (File.directory?("fastlane") ? 'fastlane' : '.')
65
+ path = File.join(containing, "Matchfile")
66
+
67
+ if File.exist?(path)
68
+ FastlaneCore::UI.user_error!("You already got a Matchfile in this directory")
69
+ return 0
70
+ end
71
+
72
+ Match::Setup.new.run(path)
73
+ end
74
+ end
75
+
76
+ command :change_password do |c|
77
+ c.syntax = 'match change_password'
78
+ c.description = 'Re-encrypt all files with a different password'
79
+ c.action do |args, options|
80
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
81
+ params.load_configuration_file("Matchfile")
82
+
83
+ Match::ChangePassword.update(params: params)
84
+ UI.success "Successfully changed the password. Make sure to update the password on all your clients and servers"
85
+ end
86
+ end
87
+
88
+ command :decrypt do |c|
89
+ c.syntax = "match decrypt"
90
+ c.description = "Decrypts the repository and keeps it on the filesystem"
91
+ c.action do |args, options|
92
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
93
+ params.load_configuration_file("Matchfile")
94
+ decrypted_repo = Match::GitHelper.clone(params[:git_url], params[:shallow_clone], branch: params[:git_branch])
95
+ UI.success "Repo is at: '#{decrypted_repo}'"
96
+ end
97
+ end
98
+ command "nuke" do |c|
99
+ # We have this empty command here, since otherwise the normal `match` command will be executed
100
+ c.syntax = "match nuke"
101
+ c.description = "Delete all certificates and provisioning profiles from the Apple Dev Portal"
102
+ c.action do |args, options|
103
+ FastlaneCore::UI.user_error!("Please run `match nuke [type], allowed values: distribution and development. For the 'adhoc' type, please use 'distribution' instead.")
104
+ end
105
+ end
106
+
107
+ ["development", "distribution"].each do |type|
108
+ command "nuke #{type}" do |c|
109
+ c.syntax = "match nuke #{type}"
110
+ c.description = "Delete all certificates and provisioning profiles from the Apple Dev Portal of the type #{type}"
111
+ c.action do |args, options|
112
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
113
+ params.load_configuration_file("Matchfile")
114
+ Match::Nuke.new.run(params, type: type.to_s)
115
+ end
116
+ end
117
+ end
118
+
119
+ default_command :run
120
+
121
+ run!
122
+ end
123
+ # rubocop:enable Metrics/MethodLength
124
+ # rubocop:enable Metrics/AbcSize
125
+ end
126
+ end
@@ -1,6 +1,6 @@
1
1
  module Match
2
2
  class GitHelper
3
- def self.clone(git_url, shallow_clone, manual_password: nil, skip_docs: false)
3
+ def self.clone(git_url, shallow_clone, manual_password: nil, skip_docs: false, branch: "master")
4
4
  return @dir if @dir
5
5
 
6
6
  @dir = Dir.mktmpdir
@@ -14,6 +14,8 @@ module Match
14
14
 
15
15
  UI.user_error!("Error cloning repo, make sure you have access to it '#{git_url}'") unless File.directory?(@dir)
16
16
 
17
+ checkout_branch(branch) unless branch == "master"
18
+
17
19
  if !Helper.test? and GitHelper.match_version(@dir).nil? and manual_password.nil? and File.exist?(File.join(@dir, "README.md"))
18
20
  UI.important "Migrating to new match..."
19
21
  ChangePassword.update(params: { git_url: git_url,
@@ -47,7 +49,7 @@ module Match
47
49
  end
48
50
  end
49
51
 
50
- def self.commit_changes(path, message, git_url)
52
+ def self.commit_changes(path, message, git_url, branch = "master")
51
53
  Dir.chdir(path) do
52
54
  return if `git status`.include?("nothing to commit")
53
55
 
@@ -56,8 +58,8 @@ module Match
56
58
 
57
59
  commands = []
58
60
  commands << "git add -A"
59
- commands << "git commit -m '#{message}'"
60
- commands << "git push origin master"
61
+ commands << "git commit -m #{message.shellescape}"
62
+ commands << "git push origin #{branch.shellescape}"
61
63
 
62
64
  UI.message "Pushing changes to remote git repo..."
63
65
 
@@ -79,6 +81,44 @@ module Match
79
81
  @dir = nil
80
82
  end
81
83
 
84
+ # Create and checkout an specific branch in the git repo
85
+ def self.checkout_branch(branch)
86
+ return unless @dir
87
+
88
+ commands = []
89
+ if branch_exists?(branch)
90
+ # Checkout the branch if it already exists
91
+ commands << "git checkout #{branch.shellescape}"
92
+ else
93
+ # If a new branch is being created, we create it as an 'orphan' to not inherit changes from the master branch.
94
+ commands << "git checkout --orphan #{branch.shellescape}"
95
+ # We also need to reset the working directory to not transfer any uncommitted changes to the new branch.
96
+ commands << "git reset --hard"
97
+ end
98
+
99
+ UI.message "Checking out branch #{branch}..."
100
+
101
+ Dir.chdir(@dir) do
102
+ commands.each do |command|
103
+ FastlaneCore::CommandExecutor.execute(command: command,
104
+ print_all: $verbose,
105
+ print_command: $verbose)
106
+ end
107
+ end
108
+ end
109
+
110
+ # Checks if a specific branch exists in the git repo
111
+ def self.branch_exists?(branch)
112
+ return unless @dir
113
+
114
+ result = Dir.chdir(@dir) do
115
+ FastlaneCore::CommandExecutor.execute(command: "git branch --list origin/#{branch.shellescape} --no-color -r",
116
+ print_all: $verbose,
117
+ print_command: $verbose)
118
+ end
119
+ return !result.empty?
120
+ end
121
+
82
122
  # Copies the README.md into the git repo
83
123
  def self.copy_readme(directory)
84
124
  template = File.read("#{Helper.gem_path('match')}/lib/assets/READMETemplate.md")
@@ -11,7 +11,7 @@ module Match
11
11
  self.params = params
12
12
  self.type = type
13
13
 
14
- params[:workspace] = GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs])
14
+ params[:workspace] = GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs], branch: params[:git_branch])
15
15
 
16
16
  had_app_identifier = self.params[:app_identifier]
17
17
  self.params[:app_identifier] = '' # we don't really need a value here
@@ -142,7 +142,7 @@ module Match
142
142
 
143
143
  # Now we need to commit and push all this too
144
144
  message = ["[fastlane]", "Nuked", "files", "for", type.to_s].join(" ")
145
- GitHelper.commit_changes(params[:workspace], message, self.params[:git_url])
145
+ GitHelper.commit_changes(params[:workspace], message, self.params[:git_url], params[:git_branch])
146
146
  end
147
147
 
148
148
  private
@@ -13,6 +13,10 @@ module Match
13
13
  description: "URL to the git repo containing all the certificates",
14
14
  optional: false,
15
15
  short_option: "-r"),
16
+ FastlaneCore::ConfigItem.new(key: :git_branch,
17
+ env_name: "MATCH_GIT_BRANCH",
18
+ description: "Specific git branch to use",
19
+ default_value: 'master'),
16
20
  FastlaneCore::ConfigItem.new(key: :type,
17
21
  env_name: "MATCH_TYPE",
18
22
  description: "Create a development certificate instead of a distribution one",
@@ -7,7 +7,7 @@ module Match
7
7
  hide_keys: [:workspace],
8
8
  title: "Summary for match #{Match::VERSION}")
9
9
 
10
- params[:workspace] = GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs])
10
+ params[:workspace] = GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs], branch: params[:git_branch])
11
11
  spaceship = SpaceshipEnsure.new(params[:username]) unless params[:readonly]
12
12
 
13
13
  # Verify the App ID (as we don't want 'match' to fail at a later point)
@@ -25,7 +25,7 @@ module Match
25
25
  # Done
26
26
  if self.changes_to_commit and !params[:readonly]
27
27
  message = GitHelper.generate_commit_message(params)
28
- GitHelper.commit_changes(params[:workspace], message, params[:git_url])
28
+ GitHelper.commit_changes(params[:workspace], message, params[:git_url], params[:git_branch])
29
29
  end
30
30
 
31
31
  TablePrinter.print_summary(params, uuid)
@@ -1,4 +1,4 @@
1
1
  module Match
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  DESCRIPTION = "Easily sync your certificates and profiles across your team using git"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: match
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: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: security
@@ -279,6 +279,7 @@ files:
279
279
  - lib/assets/READMETemplate.md
280
280
  - lib/match.rb
281
281
  - lib/match/change_password.rb
282
+ - lib/match/commands_generator.rb
282
283
  - lib/match/encrypt.rb
283
284
  - lib/match/generator.rb
284
285
  - lib/match/git_helper.rb
@@ -310,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
311
  version: '0'
311
312
  requirements: []
312
313
  rubyforge_project:
313
- rubygems_version: 2.4.5.1
314
+ rubygems_version: 2.4.0
314
315
  signing_key:
315
316
  specification_version: 4
316
317
  summary: Easily sync your certificates and profiles across your team using git