fastlane-plugin-approved 0.1.0 → 0.2.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
  SHA256:
3
- metadata.gz: fec89ae8217275deee679f3eadcbe96cfab97290abd87d0ecb13f03514d323a2
4
- data.tar.gz: 1c575c9b5ddf50895c7b3cdb3d64306313d76ce54c3a3fec79b9eb849800528a
3
+ metadata.gz: 07f6872c458a5f49b5a1c7a835f9909370504f5e7f3a32d0a9329e72f16ae116
4
+ data.tar.gz: 6a00e2d1f00fb2f99de85d62f03a4dab7de41652047c8940a63ea76f4c8ed9c0
5
5
  SHA512:
6
- metadata.gz: faf712476b621366af2cbc1abcc3e78a5495c2e6135240e994ec1821a0dbb4676e12b952c8f9288167fa94eea81a0163bd790fd068a02e9bd694a4db0765291f
7
- data.tar.gz: 6d5984433d489ede641805a4951c56eca837bcbdcfa943b6c3bb72733827a03186c48d6c72c0f5bd341974ba0b0b551101bd2979b720671b3f5678075ede9781
6
+ metadata.gz: 8222aa92d8868e3566ed048c584e65c82c6e990bde2bb0d816282f604bafe8c5b78102cb5c8b1d02740753f39b9d38e635575fe3d678d6b980eb9ccba5ffcbbc
7
+ data.tar.gz: d42c4825dff3154cd14b6532502fa28d5d45930c129c7ddb438e49693936d7f8d5dafe34a5db8a924c44cd99d13e8af00abffc02462c20ab91a86b16fdd534d1
@@ -8,9 +8,8 @@ module Fastlane
8
8
  require 'pathname'
9
9
  repo_path = Dir.getwd
10
10
  repo_pathname = Pathname.new(repo_path)
11
- UI.message("Performing Approved Pre-check!")
12
11
  other_action.approved_precheck
13
- UI.message("Good. Approved Pre-check passed!!!")
12
+
14
13
  head = Actions.sh("git -C #{repo_path} rev-parse HEAD").strip
15
14
 
16
15
  approved_file_path = params[:approval_file_path]
@@ -19,15 +18,20 @@ module Fastlane
19
18
  File.expand_path(File.join(repo_pathname, approved_file_absolute_path))
20
19
 
21
20
  File.open(approved_file_absolute_path, "w") { |f| f.write "#{head}" }
22
- # then create a commit with a message
23
- Actions.sh("git -C #{repo_path} add #{approved_file_absolute_path}")
24
- begin
25
- commit_message = "Approved commit #{head}"
26
- Actions.sh("git -C #{repo_path} commit -m '#{commit_message}'")
27
- UI.success("Committed \"#{commit_message}\" 💾.")
28
- rescue => ex
29
- UI.error(ex)
30
- UI.important("Didn't commit any changes.")
21
+
22
+ if params[:no_commit]
23
+ UI.success("Approved! Your approval file has been updated!")
24
+ else
25
+ # then create a commit with a message
26
+ Actions.sh("git -C #{repo_path} add #{approved_file_absolute_path}")
27
+ begin
28
+ commit_message = "Approved commit #{head}"
29
+ Actions.sh("git -C #{repo_path} commit -m '#{commit_message}'")
30
+ UI.success("Committed \"#{commit_message}\" 💾.")
31
+ rescue => ex
32
+ UI.error(ex)
33
+ UI.important("Didn't commit any changes.")
34
+ end
31
35
  end
32
36
  end
33
37
 
@@ -52,10 +56,16 @@ module Fastlane
52
56
  [
53
57
  FastlaneCore::ConfigItem.new(key: :approval_file_path,
54
58
  env_name: "APPROVED_FILE_PATH",
55
- description: "Path to aproval file",
56
- optional: false,
59
+ description: "Path to approval file",
60
+ optional: true,
57
61
  type: String,
58
- default_value: ".approved")
62
+ default_value: ".approved"),
63
+ FastlaneCore::ConfigItem.new(key: :no_commit,
64
+ env_name: "APPROVED_NO_COMMIT",
65
+ description: "Update approval file but don't commit",
66
+ optional: true,
67
+ type: Boolean,
68
+ default_value: false)
59
69
  ]
60
70
  end
61
71
 
@@ -7,7 +7,7 @@ module Fastlane
7
7
  def self.run(params)
8
8
  repo_path = Dir.getwd
9
9
  repo_pathname = Pathname.new(repo_path)
10
- UI.message("The approved plugin is working! #{repo_path}")
10
+ UI.message("Performing Approved Pre-check!")
11
11
  git_dirty_files = Actions.sh("git -C #{repo_path} diff --name-only HEAD").split("\n") + Actions.sh("git -C #{repo_path} ls-files --other --exclude-standard").split("\n")
12
12
 
13
13
  approved_file_path = params[:approval_file_path]
@@ -20,9 +20,9 @@ module Fastlane
20
20
  "Found the following uncommitted files:",
21
21
  " #{git_dirty_files.join("\n ")}",
22
22
  ]
23
- UI.user_error!("#{error.join("\n")}")
23
+ UI.user_error!("#{error.join("\n")}")
24
24
  end
25
-
25
+ UI.message("Good. Approved Pre-check passed!!!")
26
26
  end
27
27
 
28
28
  def self.description
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Approved
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-approved
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chalermpong Satayavibul