fastlane-plugin-cryptex 0.1.2 → 0.1.3

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: 8a44567a02dfc2b75f73bfdab6e86ea0b686b233
4
- data.tar.gz: 563247fa143a6b9d14ceb9328e77a01de2701959
3
+ metadata.gz: 19b7da7f87da959bbe1ad86774aedf5d3ac0e85f
4
+ data.tar.gz: 5e5ce005d472a170bd0af367767fe8f05394acfc
5
5
  SHA512:
6
- metadata.gz: a80a6d6999f856ef4ace87dca1d28cab81bae9dd8622232f858f0a4fcf9ac99f570d16dbd2c2e9c88655b3ea85edc0209a6789f3cbd2f54e573a4366bfcb41be
7
- data.tar.gz: 93094435b4eb45cd49ab55c45ef900d8212fed56bcff84299f635a7cfded0aec959eb48a3c0361c32f932ad3dc0fb33d45de78ea0ae63a065216faf3bc0df93b
6
+ metadata.gz: df4193e9cc83064d4d118eb4552406682b39ce481943007c82fb32fba40ed4651985adad3ce0622c80369f698ae1c440e3a0147054a4b32c06f2cea2f7bb2abf
7
+ data.tar.gz: 504cc4e6cb6e326997222f0a83a51ebfdde0b05ebbaf1a62083703ef49a4113602112ee80d81e96f3ff4f0fb4109317d1a45137f0ee4f97c31d86b3d3f7e8ae4
@@ -59,7 +59,7 @@ module Fastlane
59
59
  short_option: "-s",
60
60
  env_name: "CRYPTEX_TYPE",
61
61
  description: "Sub-Action Type (export, import, decrypt)",
62
- default_value: "export"),
62
+ default_value: "export"),
63
63
  FastlaneCore::ConfigItem.new(key: :verbose,
64
64
  env_name: "CRYPTEX_VERBOSE",
65
65
  description: "Print out extra information and all commands",
@@ -4,13 +4,32 @@ module Fastlane
4
4
  attr_accessor :git_changed
5
5
 
6
6
  def import_env(params)
7
+ UI.user_error!("No input hash supplied") if params[:hash].to_s.length.zero?
8
+ UI.user_error!("No key file supplied") if params[:key].to_s.length.zero?
9
+
7
10
  env_world_file = "#{params[:workspace]}/#{params[:key]}_env_world.crypt"
8
- File.write(env_world_file, params[:hash].to_json)
11
+ if params[:hash].kind_of?(String)
12
+ begin
13
+ params[:hash] = JSON.parse(params[:hash])
14
+ rescue
15
+ # might contain sensitive informatio
16
+ UI.user_error!("Supplied :hash isn't in json format")
17
+ end
18
+ end
19
+ if params[:hash].kind_of?(Hash)
20
+ json = params[:hash].to_json
21
+ else
22
+ UI.user_error!("Not really sure what to do with :hash param of type #{params[:hash].class}")
23
+ end
24
+ File.write(env_world_file, json)
9
25
  @git_changed = true
10
26
  end
11
27
 
12
28
  def export_env(params)
29
+ UI.user_error!("No key file supplied") if params[:key].to_s.length.zero?
13
30
  env_world_file = "#{params[:workspace]}/#{params[:key]}_env_world.crypt"
31
+ UI.user_error!("Wrong key file supplied.") unless File.exist? env_world_file
32
+
14
33
  world_data = File.read(env_world_file)
15
34
  world_data_parsed = JSON.parse(world_data)
16
35
  ret_json = {}
@@ -26,18 +45,33 @@ module Fastlane
26
45
  end
27
46
 
28
47
  def import_file(params)
29
- File.write("#{params[:workspace]}/#{params[:key]}.crypt", File.read(File.expand_path(params[:in])))
48
+ UI.user_error!("No input file supplied") if params[:in].to_s.length.zero?
49
+ in_path = File.expand_path(params[:in])
50
+ UI.user_error!("File to import at `#{in_path}` not found") unless File.exist? in_path
51
+
52
+ file = params[:key] unless params[:key].to_s.length.zero?
53
+ file ||= File.basename(params[:in])
54
+ File.write("#{params[:workspace]}/#{file}.crypt", File.read(in_path))
30
55
  @git_changed = true
31
56
  end
32
57
 
33
58
  def delete_file(params)
34
- FileUtils.rm_f "#{params[:workspace]}/#{params[:key]}.crypt"
59
+ UI.user_error!("No key file supplied") if params[:key].to_s.length.zero?
60
+ path = "#{params[:workspace]}/#{params[:key]}.crypt"
61
+ UI.user_error!("Wrong key file supplied.") unless File.exist? path
62
+
63
+ FileUtils.rm path
35
64
  @git_changed = true
36
65
  end
37
66
 
38
67
  def export_file(params)
39
- File.write(File.expand_path(params[:out]), File.read("#{params[:workspace]}/#{params[:key]}.crypt"))
40
- @git_changed = true
68
+ UI.user_error!("No key file supplied") if params[:key].to_s.length.zero?
69
+ path = "#{params[:workspace]}/#{params[:key]}.crypt"
70
+ UI.user_error!("Wrong key file supplied.") unless File.exist? path
71
+
72
+ outfile = params[:out] unless params[:out].to_s.length.zero?
73
+ outfile ||= File.basename(params[:key])
74
+ File.write(File.expand_path(outfile), File.read(path))
41
75
  end
42
76
 
43
77
  def nuke_all(params)
@@ -1,6 +1,6 @@
1
1
  module Fastlane
2
2
  module Cryptex
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  DESCRIPTION = "cryptex"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-cryptex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helmut Januschka