anyway_config 0.4.0 → 0.5.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -1
  3. data/.rubocop.yml +38 -0
  4. data/.travis.yml +18 -25
  5. data/CHANGELOG.md +21 -0
  6. data/Gemfile +11 -3
  7. data/LICENSE.txt +1 -1
  8. data/README.md +82 -47
  9. data/Rakefile +18 -5
  10. data/anyway_config.gemspec +15 -11
  11. data/config/cool.yml +5 -0
  12. data/gemfiles/rails42.gemfile +1 -2
  13. data/gemfiles/rails5.gemfile +6 -0
  14. data/gemfiles/railsmaster.gemfile +6 -0
  15. data/lib/anyway.rb +3 -5
  16. data/lib/anyway/config.rb +52 -31
  17. data/lib/anyway/env.rb +60 -61
  18. data/lib/anyway/ext/class.rb +18 -0
  19. data/lib/anyway/ext/deep_dup.rb +34 -0
  20. data/lib/anyway/ext/hash.rb +34 -0
  21. data/lib/anyway/rails/config.rb +16 -7
  22. data/lib/anyway/version.rb +5 -3
  23. data/lib/anyway_config.rb +3 -0
  24. data/spec/anyway.yml +1 -1
  25. data/spec/config_spec.rb +30 -19
  26. data/spec/config_spec_norails.rb +59 -16
  27. data/spec/dummy/config.ru +0 -4
  28. data/spec/dummy/config/application.rb +3 -12
  29. data/spec/dummy/config/cool.yml +1 -1
  30. data/spec/dummy/config/environments/test.rb +0 -37
  31. data/spec/dummy/config/routes.rb +0 -54
  32. data/spec/dummy/config/secrets.yml +0 -1
  33. data/spec/env_spec.rb +18 -14
  34. data/spec/ext/deep_dup_spec.rb +38 -0
  35. data/spec/spec_helper.rb +21 -9
  36. data/spec/spec_norails_helper.rb +18 -5
  37. data/spec/support/cool_config.rb +9 -3
  38. data/spec/support/test_config.rb +14 -3
  39. metadata +26 -80
  40. data/gemfiles/rails32.gemfile +0 -7
  41. data/gemfiles/rails40.gemfile +0 -7
  42. data/gemfiles/rails41.gemfile +0 -7
  43. data/spec/dummy.yml +0 -0
  44. data/spec/dummy/README.rdoc +0 -28
  45. data/spec/dummy/Rakefile +0 -6
  46. data/spec/dummy/app/assets/images/.keep +0 -0
  47. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  48. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  49. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  50. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  51. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  52. data/spec/dummy/app/mailers/.keep +0 -0
  53. data/spec/dummy/app/models/.keep +0 -0
  54. data/spec/dummy/app/models/concerns/.keep +0 -0
  55. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  56. data/spec/dummy/bin/bundle +0 -3
  57. data/spec/dummy/bin/rails +0 -4
  58. data/spec/dummy/bin/rake +0 -4
  59. data/spec/dummy/config/environments/development.rb +0 -37
  60. data/spec/dummy/config/environments/production.rb +0 -83
  61. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  62. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  63. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  64. data/spec/dummy/config/initializers/inflections.rb +0 -16
  65. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  66. data/spec/dummy/config/initializers/session_store.rb +0 -3
  67. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  68. data/spec/dummy/config/locales/en.yml +0 -23
  69. data/spec/dummy/db/migrate/20140730133818_add_testos.rb +0 -11
  70. data/spec/dummy/db/migrate/20140731162044_add_column_to_testos.rb +0 -5
  71. data/spec/dummy/db/schema.rb +0 -22
  72. data/spec/dummy/lib/assets/.keep +0 -0
  73. data/spec/dummy/log/.keep +0 -0
  74. data/spec/dummy/public/404.html +0 -67
  75. data/spec/dummy/public/422.html +0 -67
  76. data/spec/dummy/public/500.html +0 -66
  77. data/spec/dummy/public/favicon.ico +0 -0
data/spec/spec_helper.rb CHANGED
@@ -1,19 +1,31 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
5
 
4
- ENV["RAILS_ENV"] ||= 'test'
6
+ begin
7
+ require "pry-byebug"
8
+ rescue LoadError # rubocop:disable all
9
+ end
5
10
 
6
- require 'rspec'
7
- require 'pry'
11
+ ENV["RAILS_ENV"] = 'test'
8
12
 
9
- require 'rails/all'
10
- require 'rspec/rails'
13
+ require File.expand_path("../dummy/config/environment", __FILE__)
14
+ require 'anyway_config'
11
15
 
12
- require 'anyway'
13
- require "dummy/config/environment"
16
+ Rails.application.eager_load!
14
17
 
15
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
18
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
16
19
 
17
20
  RSpec.configure do |config|
18
21
  config.mock_with :rspec
19
- end
22
+
23
+ config.example_status_persistence_file_path = "tmp/rspec_examples.txt"
24
+ config.filter_run :focus
25
+ config.run_all_when_everything_filtered = true
26
+
27
+ config.order = :random
28
+ Kernel.srand config.seed
29
+
30
+ config.before(:each) { Anyway.env.clear }
31
+ end
@@ -1,13 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
5
 
4
- require 'rspec'
5
- require 'pry'
6
+ begin
7
+ require "pry-byebug"
8
+ rescue LoadError # rubocop:disable all
9
+ end
6
10
 
7
- require 'anyway'
11
+ require 'anyway_config'
12
+ require 'erb'
8
13
 
9
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
14
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
10
15
 
11
16
  RSpec.configure do |config|
12
17
  config.mock_with :rspec
13
- end
18
+
19
+ config.filter_run :focus
20
+ config.run_all_when_everything_filtered = true
21
+
22
+ config.order = :random
23
+ Kernel.srand config.seed
24
+
25
+ config.before(:each) { Anyway.env.clear }
26
+ end
@@ -1,4 +1,10 @@
1
- class CoolConfig < Anyway::Config
1
+ # frozen_string_literal: true
2
+
3
+ class CoolConfig < Anyway::Config # :nodoc:
2
4
  config_name :cool
3
- attr_config :meta, :data, port: 8080, host: 'localhost', user: {name: 'admin', password: 'admin'}
4
- end
5
+ attr_config :meta,
6
+ :data,
7
+ port: 8080,
8
+ host: 'localhost',
9
+ user: { name: 'admin', password: 'admin' }
10
+ end
@@ -1,5 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Anyway
2
- class TestConfig < Anyway::Config
3
- attr_config :test, api: {key: ''}
4
+ class TestConfig < Anyway::Config # :nodoc:
5
+ attr_config :test,
6
+ api: { key: '' },
7
+ log: {
8
+ format: {
9
+ color: false,
10
+ max_length: 100
11
+ },
12
+ level: :info
13
+ },
14
+ log_levels: %i[info fatal]
4
15
  end
5
- end
16
+ end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyway_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
- - Vlad Dem
7
+ - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '3.2'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '3.2'
27
- - !ruby/object:Gem::Dependency
28
- name: pry
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: simplecov
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -58,29 +30,31 @@ dependencies:
58
30
  requirements:
59
31
  - - "~>"
60
32
  - !ruby/object:Gem::Version
61
- version: 3.0.0
33
+ version: 3.5.0
62
34
  type: :development
63
35
  prerelease: false
64
36
  version_requirements: !ruby/object:Gem::Requirement
65
37
  requirements:
66
38
  - - "~>"
67
39
  - !ruby/object:Gem::Version
68
- version: 3.0.0
40
+ version: 3.5.0
69
41
  - !ruby/object:Gem::Dependency
70
- name: rspec-rails
42
+ name: rubocop
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
45
  - - "~>"
74
46
  - !ruby/object:Gem::Version
75
- version: 3.0.0
47
+ version: '0.49'
76
48
  type: :development
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
52
  - - "~>"
81
53
  - !ruby/object:Gem::Version
82
- version: 3.0.0
83
- description: Configuration for Rails plugins and applications
54
+ version: '0.49'
55
+ description: "\n Configuration DSL for Ruby libraries and applications.\n\n Allows
56
+ you to easily follow the twevle factor application principles (https://12factor.net/config).\n
57
+ \ "
84
58
  email:
85
59
  - dementiev.vm@gmail.com
86
60
  executables: []
@@ -88,69 +62,41 @@ extensions: []
88
62
  extra_rdoc_files: []
89
63
  files:
90
64
  - ".gitignore"
65
+ - ".rubocop.yml"
91
66
  - ".travis.yml"
67
+ - CHANGELOG.md
92
68
  - Gemfile
93
69
  - LICENSE.txt
94
70
  - README.md
95
71
  - Rakefile
96
72
  - anyway_config.gemspec
97
- - gemfiles/rails32.gemfile
98
- - gemfiles/rails40.gemfile
99
- - gemfiles/rails41.gemfile
73
+ - config/cool.yml
100
74
  - gemfiles/rails42.gemfile
75
+ - gemfiles/rails5.gemfile
76
+ - gemfiles/railsmaster.gemfile
101
77
  - lib/anyway.rb
102
78
  - lib/anyway/config.rb
103
79
  - lib/anyway/env.rb
80
+ - lib/anyway/ext/class.rb
81
+ - lib/anyway/ext/deep_dup.rb
82
+ - lib/anyway/ext/hash.rb
104
83
  - lib/anyway/rails/config.rb
105
84
  - lib/anyway/version.rb
85
+ - lib/anyway_config.rb
106
86
  - spec/anyway.yml
107
87
  - spec/config_spec.rb
108
88
  - spec/config_spec_norails.rb
109
- - spec/dummy.yml
110
- - spec/dummy/README.rdoc
111
- - spec/dummy/Rakefile
112
- - spec/dummy/app/assets/images/.keep
113
- - spec/dummy/app/assets/javascripts/application.js
114
- - spec/dummy/app/assets/stylesheets/application.css
115
- - spec/dummy/app/controllers/application_controller.rb
116
- - spec/dummy/app/controllers/concerns/.keep
117
- - spec/dummy/app/helpers/application_helper.rb
118
- - spec/dummy/app/mailers/.keep
119
- - spec/dummy/app/models/.keep
120
- - spec/dummy/app/models/concerns/.keep
121
- - spec/dummy/app/views/layouts/application.html.erb
122
- - spec/dummy/bin/bundle
123
- - spec/dummy/bin/rails
124
- - spec/dummy/bin/rake
125
89
  - spec/dummy/config.ru
126
90
  - spec/dummy/config/application.rb
127
91
  - spec/dummy/config/boot.rb
128
92
  - spec/dummy/config/cool.yml
129
93
  - spec/dummy/config/database.yml
130
94
  - spec/dummy/config/environment.rb
131
- - spec/dummy/config/environments/development.rb
132
- - spec/dummy/config/environments/production.rb
133
95
  - spec/dummy/config/environments/test.rb
134
- - spec/dummy/config/initializers/backtrace_silencers.rb
135
- - spec/dummy/config/initializers/cookies_serializer.rb
136
- - spec/dummy/config/initializers/filter_parameter_logging.rb
137
- - spec/dummy/config/initializers/inflections.rb
138
- - spec/dummy/config/initializers/mime_types.rb
139
- - spec/dummy/config/initializers/session_store.rb
140
- - spec/dummy/config/initializers/wrap_parameters.rb
141
- - spec/dummy/config/locales/en.yml
142
96
  - spec/dummy/config/routes.rb
143
97
  - spec/dummy/config/secrets.yml
144
- - spec/dummy/db/migrate/20140730133818_add_testos.rb
145
- - spec/dummy/db/migrate/20140731162044_add_column_to_testos.rb
146
- - spec/dummy/db/schema.rb
147
- - spec/dummy/lib/assets/.keep
148
- - spec/dummy/log/.keep
149
- - spec/dummy/public/404.html
150
- - spec/dummy/public/422.html
151
- - spec/dummy/public/500.html
152
- - spec/dummy/public/favicon.ico
153
98
  - spec/env_spec.rb
99
+ - spec/ext/deep_dup_spec.rb
154
100
  - spec/spec_helper.rb
155
101
  - spec/spec_norails_helper.rb
156
102
  - spec/support/cool_config.rb
@@ -167,16 +113,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
113
  requirements:
168
114
  - - ">="
169
115
  - !ruby/object:Gem::Version
170
- version: 1.9.3
116
+ version: '2'
171
117
  required_rubygems_version: !ruby/object:Gem::Requirement
172
118
  requirements:
173
- - - ">="
119
+ - - ">"
174
120
  - !ruby/object:Gem::Version
175
- version: '0'
121
+ version: 1.3.1
176
122
  requirements: []
177
123
  rubyforge_project:
178
- rubygems_version: 2.2.2
124
+ rubygems_version: 2.6.4
179
125
  signing_key:
180
126
  specification_version: 4
181
- summary: Configuration for Rails plugins and applications
127
+ summary: Configuration DSL for Ruby libraries and applications
182
128
  test_files: []
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'sqlite3', platform: :mri
4
- gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
5
- gem 'rails', '~> 3.2'
6
-
7
- gemspec path: '..'
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'sqlite3', platform: :mri
4
- gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
5
- gem 'rails', '~> 4.0.1'
6
-
7
- gemspec path: '..'
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'sqlite3', platform: :mri
4
- gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
5
- gem 'rails', '~> 4.1.0'
6
-
7
- gemspec path: '..'
data/spec/dummy.yml DELETED
File without changes
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
data/spec/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Dummy::Application.load_tasks
File without changes
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
File without changes
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
File without changes
File without changes
File without changes
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'