env-checker 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: 3b69d2729808eb8df421332bd614066c161fdeda
4
- data.tar.gz: 6a78a5b6c6e31ba5e25f7e8f52d0e92797f46197
3
+ metadata.gz: 157bc8d87b47465463bf92d1f36cabd512383af7
4
+ data.tar.gz: 38eb8608f2b9ec6bc737da8150eecddc4a0c7d65
5
5
  SHA512:
6
- metadata.gz: 6377aec544e2d13020113253fdf63eb35fefa0a008ce0067e99c96599bb2bb81a7894bfc9eaf00ff109e5e23d1d64a8ff7663539d7be8be8ccb2c71d06b6b0a1
7
- data.tar.gz: c38c14c7ea5b277e1658718c47e70d1a1f2b6d50cfac3f66e1d3578bf24ac6c40273353f05fc599f890c026b8e1cfb3ab47240ab607cb8b220111974c689bc91
6
+ metadata.gz: 5207f2040ab213eb3fae659885f674ea09f04d2f19271a21b52d3aa531ce310fd7928f2a57e11506e4b044ee0d3d432098696ee0798b12bf4a510cae139cc359
7
+ data.tar.gz: dc18440c297ef31674862717097829cd008526492f5fc7e25a16ea7cef02484b04f1630e48da427e17ade50bf40e66c5ac48e1f939c24e268a73ca084aac1b6b
data/.gitignore CHANGED
@@ -21,6 +21,7 @@ build/
21
21
  build-iPhoneOS/
22
22
  build-iPhoneSimulator/
23
23
  .ruby-gemset
24
+ .byebug_history
24
25
 
25
26
  ## Specific to RubyMotion (use of CocoaPods):
26
27
  #
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-11-08 20:21:40 +0100 using RuboCop version 0.45.0.
3
+ # on 2016-11-11 15:00:02 +0100 using RuboCop version 0.45.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -8,24 +8,30 @@
8
8
 
9
9
  # Offense count: 2
10
10
  Metrics/AbcSize:
11
- Max: 16
11
+ Max: 21
12
12
 
13
13
  # Offense count: 1
14
14
  # Configuration parameters: CountComments.
15
15
  Metrics/BlockLength:
16
- Max: 30
16
+ Max: 31
17
17
 
18
- # Offense count: 1
18
+ # Offense count: 2
19
19
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
20
20
  # URISchemes: http, https
21
21
  Metrics/LineLength:
22
- Max: 81
22
+ Max: 82
23
23
 
24
24
  # Offense count: 2
25
25
  # Configuration parameters: CountComments.
26
26
  Metrics/MethodLength:
27
27
  Max: 11
28
28
 
29
+ # Offense count: 1
30
+ # Cop supports --auto-correct.
31
+ Style/EmptyLines:
32
+ Exclude:
33
+ - 'spec/env_checker/cli_spec.rb'
34
+
29
35
  # Offense count: 1
30
36
  # Cop supports --auto-correct.
31
37
  # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
@@ -33,34 +39,21 @@ Style/ExtraSpacing:
33
39
  Exclude:
34
40
  - 'env-checker.gemspec'
35
41
 
36
- # Offense count: 15
42
+ # Offense count: 16
37
43
  # Cop supports --auto-correct.
38
44
  # Configuration parameters: EnforcedStyle, SupportedStyles.
39
45
  # SupportedStyles: when_needed, always
40
46
  Style/FrozenStringLiteralComment:
41
- Exclude:
42
- - 'Gemfile'
43
- - 'Rakefile'
44
- - 'bin/console'
45
- - 'env-checker.gemspec'
46
- - 'exe/env-checker'
47
- - 'lib/env_checker.rb'
48
- - 'lib/env_checker/cli.rb'
49
- - 'lib/env_checker/configuration.rb'
50
- - 'lib/env_checker/missing_keys_error.rb'
51
- - 'lib/env_checker/version.rb'
52
- - 'spec/env_checker/configuration_spec.rb'
53
- - 'spec/env_checker/missing_keys_error_spec.rb'
54
- - 'spec/env_checker/version_spec.rb'
55
- - 'spec/env_checker_spec.rb'
56
- - 'spec/spec_helper.rb'
47
+ Enabled: false
57
48
 
58
- # Offense count: 5
49
+ # Offense count: 7
59
50
  # Cop supports --auto-correct.
60
- # Configuration parameters: SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
51
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
61
52
  # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
62
53
  Style/HashSyntax:
63
- EnforcedStyle: hash_rockets
54
+ Exclude:
55
+ - 'Rakefile'
56
+ - 'lib/env_checker/cli.rb'
64
57
 
65
58
  # Offense count: 1
66
59
  # Cop supports --auto-correct.
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- env-checker (0.1.2)
5
- thor (~> 0)
4
+ env-checker (0.1.3)
5
+ thor
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.3.0)
11
+ byebug (9.0.6)
11
12
  coveralls (0.8.15)
12
13
  json (>= 1.8, < 3)
13
14
  simplecov (~> 0.12.0)
@@ -21,7 +22,7 @@ GEM
21
22
  ast (~> 2.2)
22
23
  powerpack (0.1.1)
23
24
  rainbow (2.1.0)
24
- rake (10.5.0)
25
+ rake (11.3.0)
25
26
  rspec (3.5.0)
26
27
  rspec-core (~> 3.5.0)
27
28
  rspec-expectations (~> 3.5.0)
@@ -57,13 +58,14 @@ PLATFORMS
57
58
  ruby
58
59
 
59
60
  DEPENDENCIES
60
- bundler (~> 1.13)
61
- coveralls (~> 0)
61
+ bundler (>= 1.13)
62
+ byebug (>= 9.0.5)
63
+ coveralls
62
64
  env-checker!
63
- rake (~> 10.0)
64
- rspec (~> 3.0)
65
- rubocop (~> 0)
66
- simplecov (~> 0)
65
+ rake (>= 10.0)
66
+ rspec (>= 3.0)
67
+ rubocop
68
+ simplecov
67
69
 
68
70
  BUNDLED WITH
69
71
  1.13.6
data/README.md CHANGED
@@ -96,8 +96,14 @@ end
96
96
 
97
97
  #### Check optional and required variables
98
98
 
99
+ Inline passing the variables with the shell:
100
+
99
101
  $ env-checker check --optional MyOptVar1 MyOptVar2 --required MyReqVar1 MyReqVar2
100
102
 
103
+ Example with a `.yml` [example file](https://raw.githubusercontent.com/ryanfox1985/env-checker/master/sample_config.yml):
104
+
105
+ $ env-checker check --config_file sample_config.yml
106
+
101
107
  #### Show help
102
108
 
103
109
  $ env-checker help
@@ -32,11 +32,12 @@ Gem::Specification.new do |spec|
32
32
  spec.require_paths = ['lib']
33
33
  spec.required_ruby_version = '>= 2.0.0'
34
34
 
35
- spec.add_runtime_dependency 'thor', '~> 0'
36
- spec.add_development_dependency 'bundler', '~> 1.13'
37
- spec.add_development_dependency 'rake', '~> 10.0'
38
- spec.add_development_dependency 'rspec', '~> 3.0'
39
- spec.add_development_dependency 'rubocop', '~> 0'
40
- spec.add_development_dependency 'coveralls', '~> 0'
41
- spec.add_development_dependency 'simplecov', '~> 0'
35
+ spec.add_runtime_dependency 'thor', '>= 0'
36
+ spec.add_development_dependency 'bundler', '>= 1.13'
37
+ spec.add_development_dependency 'rake', '>= 10.0'
38
+ spec.add_development_dependency 'rspec', '>= 3.0'
39
+ spec.add_development_dependency 'rubocop', '>= 0'
40
+ spec.add_development_dependency 'coveralls', '>= 0'
41
+ spec.add_development_dependency 'simplecov', '>= 0'
42
+ spec.add_development_dependency 'byebug', '>= 9.0.5'
42
43
  end
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'env_checker'
4
4
 
5
- CLI.start(ARGV)
5
+ EnvChecker::CLI.start(ARGV)
@@ -1,5 +1,6 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
 
3
+ require 'yaml'
3
4
  require 'env_checker/version'
4
5
  require 'env_checker/missing_keys_error'
5
6
  require 'env_checker/configuration'
@@ -19,12 +20,14 @@ module EnvChecker
19
20
  end
20
21
 
21
22
  def configure
22
- self.configuration ||= Configuration.new
23
+ self.configuration = Configuration.new
23
24
  yield(configuration)
24
25
  end
25
26
 
26
27
  def cli_configure_and_check(options)
27
- return if !options[:optional] && !options[:required]
28
+ return if !options[:optional] &&
29
+ !options[:required] &&
30
+ !options[:config_file]
28
31
 
29
32
  self.configuration = create_config_from_parameters(options)
30
33
 
@@ -39,6 +42,15 @@ module EnvChecker
39
42
 
40
43
  def create_config_from_parameters(options)
41
44
  config = Configuration.new
45
+
46
+ if options[:config_file]
47
+ from_file = YAML.load_file(options[:config_file])
48
+ config.optional_variables = from_file['optional_variables']
49
+ config.required_variables = from_file['required_variables']
50
+
51
+ return config
52
+ end
53
+
42
54
  config.optional_variables = options[:optional] if options[:optional]
43
55
  config.required_variables = options[:required] if options[:required]
44
56
 
@@ -1,21 +1,25 @@
1
1
  require 'thor'
2
2
 
3
- class CLI < Thor
4
- desc 'version', 'EnvChecker version.'
5
- def version
6
- puts "EnvChecker #{EnvChecker::VERSION}"
7
- end
3
+ module EnvChecker
4
+ class CLI < Thor
5
+ desc 'version', 'EnvChecker version.'
6
+ def version
7
+ puts "EnvChecker #{EnvChecker::VERSION}"
8
+ end
8
9
 
9
- option :required, :aliases => :r, :type => :array
10
- option :optional, :aliases => :o, :type => :array
11
- desc 'check', 'check environment variables'
12
- def check
13
- output = []
14
- output << 'Variables: '
15
- output << "- Optional: #{options[:optional]}" if options[:optional]
16
- output << "- Required: #{options[:required]}" if options[:required]
17
- puts output.join("\n")
10
+ option :config_file, :aliases => :cf, :type => :string
11
+ option :required, :aliases => :r, :type => :array
12
+ option :optional, :aliases => :o, :type => :array
13
+ desc 'check', 'Check optional and required environment variables.'
14
+ def check
15
+ output = []
16
+ output << 'Variables: '
17
+ output << "- Config file: #{options[:config_file]}" if options[:config_file]
18
+ output << "- Optional: #{options[:optional]}" if options[:optional]
19
+ output << "- Required: #{options[:required]}" if options[:required]
20
+ puts output.join("\n")
18
21
 
19
- EnvChecker.cli_configure_and_check(options)
22
+ EnvChecker.cli_configure_and_check(options)
23
+ end
20
24
  end
21
25
  end
@@ -1,3 +1,3 @@
1
1
  module EnvChecker
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -0,0 +1,6 @@
1
+ optional_variables:
2
+ - MyOptVar1
3
+ - MyOptVar2
4
+ required_variables:
5
+ - MyReqVar1
6
+ - MyReqVar2
@@ -0,0 +1,7 @@
1
+ ---
2
+ optional_variables:
3
+ - OptMyVar1
4
+ - OptMyVar2
5
+ required_variables:
6
+ - MyVar1
7
+ - MyVar2
metadata CHANGED
@@ -1,113 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env-checker
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
  - Guillermo Guerrero Ibarra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-08 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.13'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.13'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: coveralls
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 9.0.5
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 9.0.5
111
125
  description: |2
112
126
  When you are developing a new feature if your app have some environments
113
127
  like test, staging and production is easy to forget an environment variable
@@ -140,6 +154,8 @@ files:
140
154
  - lib/env_checker/configuration.rb
141
155
  - lib/env_checker/missing_keys_error.rb
142
156
  - lib/env_checker/version.rb
157
+ - sample_config.yml
158
+ - test_config.yml
143
159
  homepage: https://github.com/ryanfox1985/env-checker
144
160
  licenses:
145
161
  - MIT