envlogic 1.0.4 → 1.1.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
- SHA1:
3
- metadata.gz: 01dedf4a6f681524600178032147de780b79924f
4
- data.tar.gz: a1ed78a597dc680529063b78fe437a664dbeb120
2
+ SHA256:
3
+ metadata.gz: e8a09f4a02ecb4aa854f21c30620be8670fc22f41eb3eb464ec5d8bb67dda98d
4
+ data.tar.gz: 706f85a46eb589b93492e3a0b3fa08cbd5c4685471305c60fa6dd0d6745f6981
5
5
  SHA512:
6
- metadata.gz: 70a478be725813975558af7b7f18008960cf6d2cdcebbfb676178e63509de63d9d6a692d49c703e645a4f3f4eb976b2d3eccfd56fc04051c3d7ea8a84207999b
7
- data.tar.gz: 43812ac0f76694b18aee9c4b989ef21ac08a495f85115b854438ecd3565c97cc73674ff29401d5ae0adc0ab26f417e599e3565ac7ba6b6d5cfff78246136155a
6
+ metadata.gz: d47e67ed63559fa4a23f5a28952fd0ee63bab890ed24e79e126e15b52c1fe09fa51343463b8396d3d4e58f9cbd14ebb1a8d4522d0c5b052a8b00308589c3096d
7
+ data.tar.gz: 8be0454147aa97749c5ff9c1e0832dd5173d596abdda9f58865065b5b6c1a248b02da1413b1c6fda16f2ef77158a9080aa2d4eff5e246f9664a0e51f90675d18
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.5.0
@@ -1,12 +1,18 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 2.2.2
4
- - 2.2.3
5
4
  - 2.3.0
6
5
  - 2.3.1
7
6
  - 2.3.2
8
7
  - 2.3.3
8
+ - 2.3.4
9
9
  - 2.4.0
10
10
  - 2.4.1
11
- script:
12
- - bundle exec rake
11
+ - 2.4.2
12
+ - 2.5.0
13
+ - jruby-head
14
+ script: bundle exec rspec spec/
15
+ env:
16
+ global:
17
+ - JRUBY_OPTS='--debug'
18
+ install: bundle install --jobs=3 --retry=3
@@ -1,12 +1,18 @@
1
1
  # Envlogic gem changelog
2
2
 
3
- ## Unreleased
3
+ ## 1.1.0
4
+ - Ruby 2.4.2 support
5
+ - Ruby 2.5.0 support
6
+ - ActiveSupport dependency dropped in favor of dry-inflector
7
+
8
+ ## 1.0.4
4
9
  - Switched with quality metrics to Coditsu (https://coditsu.io/)
5
10
  - Gem dump
6
11
  - Quality improvements
7
12
  - Gems cleanup
8
13
  - Ruby dump to 2.4.1
9
14
  - Better specs (less internal, more integrational)
15
+ - License added to the gemspec file
10
16
 
11
17
  ## 1.0.3
12
18
  - Gem dump x3
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :development, :test do
8
+ gem 'rake'
8
9
  gem 'rspec'
9
10
  gem 'simplecov'
10
- gem 'rake'
11
11
  end
@@ -1,45 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- envlogic (1.0.4)
5
- activesupport
4
+ envlogic (1.1.0)
5
+ dry-inflector (~> 0.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (5.1.3)
11
- concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (~> 0.7)
13
- minitest (~> 5.1)
14
- tzinfo (~> 1.1)
15
- concurrent-ruby (1.0.5)
16
10
  diff-lcs (1.3)
17
- docile (1.1.5)
18
- i18n (0.8.6)
11
+ docile (1.3.0)
12
+ dry-inflector (0.1.1)
19
13
  json (2.1.0)
20
- minitest (5.10.3)
21
- rake (12.0.0)
22
- rspec (3.6.0)
23
- rspec-core (~> 3.6.0)
24
- rspec-expectations (~> 3.6.0)
25
- rspec-mocks (~> 3.6.0)
26
- rspec-core (3.6.0)
27
- rspec-support (~> 3.6.0)
28
- rspec-expectations (3.6.0)
14
+ rake (12.3.1)
15
+ rspec (3.7.0)
16
+ rspec-core (~> 3.7.0)
17
+ rspec-expectations (~> 3.7.0)
18
+ rspec-mocks (~> 3.7.0)
19
+ rspec-core (3.7.1)
20
+ rspec-support (~> 3.7.0)
21
+ rspec-expectations (3.7.0)
29
22
  diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.6.0)
31
- rspec-mocks (3.6.0)
23
+ rspec-support (~> 3.7.0)
24
+ rspec-mocks (3.7.0)
32
25
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.6.0)
34
- rspec-support (3.6.0)
35
- simplecov (0.15.0)
36
- docile (~> 1.1.0)
26
+ rspec-support (~> 3.7.0)
27
+ rspec-support (3.7.1)
28
+ simplecov (0.16.1)
29
+ docile (~> 1.1)
37
30
  json (>= 1.8, < 3)
38
31
  simplecov-html (~> 0.10.0)
39
32
  simplecov-html (0.10.2)
40
- thread_safe (0.3.6)
41
- tzinfo (1.2.3)
42
- thread_safe (~> 0.1)
43
33
 
44
34
  PLATFORMS
45
35
  ruby
@@ -51,4 +41,4 @@ DEPENDENCIES
51
41
  simplecov
52
42
 
53
43
  BUNDLED WITH
54
- 1.14.6
44
+ 1.16.1
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Envlogic
2
2
 
3
3
  [![Build Status](https://travis-ci.org/karafka/envlogic.png)](https://travis-ci.org/karafka/envlogic)
4
- [![Code Climate](https://codeclimate.com/github/karafka/envlogic/badges/gpa.svg)](https://codeclimate.com/github/karafka/envlogic)
5
- [![Gem Version](https://badge.fury.io/rb/envlogic.svg)](http://badge.fury.io/rb/envlogic)
6
4
  [![Join the chat at https://gitter.im/karafka/karafka](https://badges.gitter.im/karafka/karafka.svg)](https://gitter.im/karafka/karafka?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
5
 
8
6
  Envlogic is a library used to manage environments for your Ruby application in a similar to Rails.env way.
@@ -87,28 +85,17 @@ Basic::Karafka.env.development? # => true
87
85
  ## References
88
86
 
89
87
  * [Karafka framework](https://github.com/karafka/karafka)
90
- * [Waterdrop](https://github.com/karafka/waterdrop)
91
- * [Envlogic](https://github.com/karafka/envlogic)
92
- * [Worker Glass](https://github.com/karafka/worker-glass)
93
- * [Null Logger](https://github.com/karafka/null-logger)
94
88
  * [Envlogic Travis CI](https://travis-ci.org/karafka/envlogic)
95
- * [Envlogic Code Climate](https://codeclimate.com/github/karafka/envlogic)
89
+ * [Envlogic Coditsu](https://app.coditsu.io/karafka/repositories/envlogic)
96
90
 
97
- ## Note on Patches/Pull Requests
91
+ ## Note on contributions
98
92
 
99
- Fork the project.
100
- Make your feature addition or bug fix.
101
- Add tests for it. This is important so I don't break it in a future version unintentionally.
102
- Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull). Send me a pull request. Bonus points for topic branches.
93
+ First, thank you for considering contributing to Envlogic! It's people like you that make the open source community such a great community!
103
94
 
104
- [![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://coditsu.io)
95
+ Each pull request must pass all the rspec specs and meet our quality requirements.
105
96
 
106
- Each pull request must pass our quality requirements. To check if everything is as it should be, we use [Coditsu](https://coditsu.io) that combines multiple linters and code analyzers. Unfortunately, for now it is invite-only based, so just ping us and we will give you access to the quality results.
97
+ To check if everything is as it should be, we use [Coditsu](https://coditsu.io) that combines multiple linters and code analyzers for both code and documentation. Once you're done with your changes, submit a pull request.
107
98
 
108
- Please run:
99
+ Coditsu will automatically check your work against our quality standards. You can find your commit check results on the [builds page](https://app.coditsu.io/karafka/repositories/envlogic/builds/commit_builds) of Envlogic repository.
109
100
 
110
- ```bash
111
- bundle exec rake
112
- ```
113
-
114
- to check if everything is in order. After that you can submit a pull request.
101
+ [![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://app.coditsu.io/karafka/repositories/envlogic/builds/commit_builds)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  require 'envlogic/version'
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.homepage = 'https://github.com/karafka/envlogic'
17
17
  spec.license = 'MIT'
18
18
 
19
- spec.add_dependency 'activesupport'
19
+ spec.add_dependency 'dry-inflector', '~> 0.1'
20
20
  spec.required_ruby_version = '>= 2.2.0'
21
21
 
22
22
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  %w[
4
- active_support/inflector
5
- active_support/string_inquirer
4
+ dry/inflector
6
5
  envlogic/version
7
- envlogic/string_refinements
8
6
  envlogic/env
9
7
  ].each { |lib| require lib }
10
8
 
@@ -3,13 +3,20 @@
3
3
  # Main module
4
4
  module Envlogic
5
5
  # Env module to get and set environment
6
- class Env < ActiveSupport::StringInquirer
7
- using StringRefinements
8
-
6
+ class Env < String
9
7
  # What environment key should be used by default
10
8
  FALLBACK_ENV_KEY = 'RACK_ENV'
11
9
  # What default environment should be asumed when there's nothing else
12
10
  FALLBACK_ENV = 'development'
11
+ # Postfix for ENV keys
12
+ ENV_KEY_POSTFIX = '_ENV'
13
+ # String inflecting engine
14
+ INFLECTOR = Dry::Inflector.new
15
+
16
+ private_constant :FALLBACK_ENV_KEY, :FALLBACK_ENV, :ENV_KEY_POSTFIX, :INFLECTOR
17
+
18
+ # It's just a string replace alias for the envlogic compatibility
19
+ alias update replace
13
20
 
14
21
  # @param klass [Class, Module] class/module for which we want to build a Envlogic::Env object
15
22
  # @return [Envlogic::Env] envlogic env object]
@@ -17,20 +24,26 @@ module Envlogic
17
24
  # Envlogic::Env.new(User)
18
25
  # @note Will load appropriate environment automatically
19
26
  def initialize(klass)
20
- env = ENV[app_dir_name.to_env_key]
21
- env ||= ENV[klass.to_s.to_env_key]
27
+ env = ENV[to_env_key(app_dir_name)]
28
+ env ||= ENV[to_env_key(klass.to_s)]
22
29
  env ||= ENV[FALLBACK_ENV_KEY]
23
30
 
24
31
  update(env || FALLBACK_ENV)
25
32
  end
26
33
 
27
- # @param environment [String] new environment that we want to set
28
- # @example
29
- # env.update('production')
30
- def update(environment)
31
- replace(
32
- ActiveSupport::StringInquirer.new(environment)
33
- )
34
+ # @param method_name [String] method name
35
+ # @param include_private [Boolean] should we include private methods as well
36
+ # @return [Boolean] true if we respond to a given missing method, otherwise false
37
+ def respond_to_missing?(method_name, include_private = false)
38
+ (method_name[-1] == '?') || super
39
+ end
40
+
41
+ # Reacts to missing methods, from which some might be the env checkings.
42
+ # If the method ends with '?' we assume, that it is an env check
43
+ # @param method_name [String] method name for missing or env name with question mark
44
+ # @param arguments [Array] any arguments that we pass to the method
45
+ def method_missing(method_name, *arguments)
46
+ method_name[-1] == '?' ? self == method_name[0..-2] : super
34
47
  end
35
48
 
36
49
  private
@@ -45,5 +58,13 @@ module Envlogic
45
58
  .basename
46
59
  .to_s
47
60
  end
61
+
62
+ # Converts any string into a bash ENV key
63
+ def to_env_key(string)
64
+ INFLECTOR
65
+ .underscore(string)
66
+ .tr('/', '_')
67
+ .upcase + ENV_KEY_POSTFIX
68
+ end
48
69
  end
49
70
  end
@@ -3,5 +3,5 @@
3
3
  # Main module to encapsulate logic
4
4
  module Envlogic
5
5
  # Current version of gem
6
- VERSION = '1.0.4'
6
+ VERSION = '1.1.0'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pavlo_vavruk
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-31 00:00:00.000000000 Z
12
+ date: 2018-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: activesupport
15
+ name: dry-inflector
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '0.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: '0.1'
28
28
  description: Library used to manage environments for your Ruby application
29
29
  email:
30
30
  - pavlo.vavruk@gmail.com
@@ -47,7 +47,6 @@ files:
47
47
  - envlogic.gemspec
48
48
  - lib/envlogic.rb
49
49
  - lib/envlogic/env.rb
50
- - lib/envlogic/string_refinements.rb
51
50
  - lib/envlogic/version.rb
52
51
  homepage: https://github.com/karafka/envlogic
53
52
  licenses:
@@ -69,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
68
  version: '0'
70
69
  requirements: []
71
70
  rubyforge_project:
72
- rubygems_version: 2.6.13
71
+ rubygems_version: 2.7.6
73
72
  signing_key:
74
73
  specification_version: 4
75
74
  summary: Library which allows to set and get environments values
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Envlogic
4
- # String refinements used in this library
5
- module StringRefinements
6
- # Postfix for ENV keys
7
- ENV_KEY_POSTFIX = '_ENV'
8
-
9
- refine String do
10
- # Converts any string into a bash ENV key
11
- def to_env_key
12
- underscore
13
- .tr('/', '_')
14
- .upcase + Envlogic::StringRefinements::ENV_KEY_POSTFIX
15
- end
16
- end
17
- end
18
- end