env-checker 0.1.5 → 0.1.6

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: 787f95fa9585bada75c7b3343ecde721a5a71ca0
4
- data.tar.gz: d33b2fbd2ee5c321e9134ac2a37df57bd84924b7
3
+ metadata.gz: d606bb4975be0f760db096c69b4a23c746c6ec2f
4
+ data.tar.gz: 4d302b7b62a1dd1af3fbc4429128ed1060702a7e
5
5
  SHA512:
6
- metadata.gz: 4c6ba33bc106c8c27f3fa7678c2defe258646aa270de98db4d3494a62709854414763d0268dec3d2478c1cde877da64ad489194cf579376ec0bc6a41d89ef242
7
- data.tar.gz: 867efafdfb59b5232bf0fe6cb79be37a0857018a8e404e8d14251a4cc13f7bd7cfe232ccda7ccd6ce9f5dad9aac1cab132f81a982efc71014bd244d493218b2e
6
+ metadata.gz: 28805353881884386a46352ce6d3d6a435bcddc1394834a4d973816aabf3f46e9d428c52ae19f7e6596f10d0a7dca921160bf335d607d03b24e41d2179e0da8a
7
+ data.tar.gz: 01edfd571a14417c19f1d8df31b46bebe5fd1d18a73ada466cc02b8104ac8a88d25d6bae48c95e535ed0ffa6a0cfa69c1eba942c8a38603ddd288d68d41c49d9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- env-checker (0.1.5)
4
+ env-checker (0.1.6)
5
5
  slack-notifier (~> 1.5)
6
6
  thor (~> 0.19.1)
7
7
 
@@ -57,6 +57,7 @@ module EnvChecker
57
57
  return { 'global' => config }
58
58
  end
59
59
 
60
+ config.environment = options[:environment] if options[:environment]
60
61
  config.optional_variables = options[:optional] if options[:optional]
61
62
  config.required_variables = options[:required] if options[:required]
62
63
  config.slack_webhook_url = options[:slack] if options[:slack]
@@ -7,9 +7,10 @@ module EnvChecker
7
7
  puts "EnvChecker #{EnvChecker::VERSION}"
8
8
  end
9
9
 
10
+ option :environment, :aliases => :e, :type => :string
10
11
  option :config_file, :aliases => :cf, :type => :string
11
- option :required, :aliases => :r, :type => :array
12
- option :optional, :aliases => :o, :type => :array
12
+ option :required_variables, :aliases => [:r, :required], :type => :array
13
+ option :optional_variables, :aliases => [:o, :optional], :type => :array
13
14
  option :slack_webhook_url, :aliases => :slack, :type => :string
14
15
  desc 'check', 'Check optional and required environment variables.'
15
16
  def check
@@ -40,11 +40,18 @@ module EnvChecker
40
40
  raise ConfigurationError.new("Invalid value optional_variables: #{optional_variables}")
41
41
  end
42
42
 
43
- if slack_webhook_url && slack_webhook_url != ~ URI.regexp
43
+ unless valid_url?(slack_webhook_url)
44
44
  raise ConfigurationError.new("Invalid value slack_webhook_url: #{slack_webhook_url}")
45
45
  end
46
46
 
47
47
  true
48
48
  end
49
+
50
+ def valid_url?(uri)
51
+ return true unless uri
52
+
53
+ valid = (uri =~ URI.regexp(%w(http https)))
54
+ valid && valid.zero?
55
+ end
49
56
  end
50
57
  end
@@ -1,3 +1,3 @@
1
1
  module EnvChecker
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env-checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillermo Guerrero Ibarra