envvy 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92bc2c804bf6a1074c2d98bf6f9dc44db1c2f453
4
- data.tar.gz: 0530e29e60e973985551cf3acd45dbd88d0223e6
3
+ metadata.gz: 581e30cae81cfea127fd88632613f7fe6c089f45
4
+ data.tar.gz: 491062b2c2fff3aa0f5f4a7b2e2a3c7ce1f5ae71
5
5
  SHA512:
6
- metadata.gz: 1273d4c84b120084341725a5c17dc48380cc3b011f6390083b930853df3a48568574910b27efa97239bd245fb2e8c25815177799eeab943298e3de89faf7f39f
7
- data.tar.gz: 4b05a733047e1217c540789b6ec936dc4c61e04f3beada72c7325549dd4f4d12211e7de740c2ae61370894801b5e858d63c8709722746487a9eb76bb3af917aa
6
+ metadata.gz: 199912e55270ac10e1ff9052f72820e043414c33c9f54592bce63d0a1a6c3c26b68e36ce5248f8ca02a5842c16e9e567f3c5801e581f30fe62f4a887724226d9
7
+ data.tar.gz: 5da0afda7da8cfbd00730f8531b80771dbaf492da2ad9ffa9d634755f8d1404b2c36ba34362dd918ea5c610eb091bd085dc6b63c725e6d91071bd025046b0163
data/.gitignore CHANGED
@@ -12,3 +12,9 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+
16
+ test/dummy_app/db/*
17
+ test/dummy_app/log/*.log
18
+ test/dummy_app/tmp/
19
+ test/dummy_app/.sass-cache
20
+
data/Rakefile CHANGED
@@ -1,2 +1,22 @@
1
- require "bundler/gem_tasks"
1
+ lib_path = File.join(File.dirname(__FILE__), 'lib')
2
+ $:.unshift(lib_path) unless $:.include?(lib_path)
3
+
4
+ require 'rake/testtask'
5
+ task :test do |t|
6
+ $: << File.expand_path('test/')
7
+ Dir.glob('./test/**/*_test.rb').each { |file| require file }
8
+ end
9
+
10
+ desc 'Start a dummy (test) Rails app server'
11
+ task :dummy_rails do
12
+ require 'rack'
13
+ require 'term/ansicolor'
14
+ port = ENV['PORT'] || 9292
15
+ puts %Q(Starting on #{Term::ANSIColor.cyan "http://localhost:#{port}"})
16
+ Rack::Server.start(
17
+ config: 'test/dummy_rails/config.ru',
18
+ Port: port)
19
+ end
20
+
21
+ task default: :test
2
22
 
data/envvy.gemspec CHANGED
@@ -8,18 +8,22 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Envvy::VERSION
9
9
  spec.authors = ["Guillaume Balaine", "Finexkap"]
10
10
  spec.email = ["igosuki@gmail.com", "dev@finexkap.com"]
11
- spec.summary = %q{Load environment variables from various sources within the Rails initialization process}
11
+ spec.summary = %q{Rails back and front env variable loader}
12
12
  spec.description = %q{Load environment variables from various sources within the Rails initialization process}
13
13
  spec.homepage = "http://github.com/nexkap/envvy"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
18
  spec.require_paths = ["lib"]
20
19
 
21
- spec.add_dependency "rails"
22
- spec.add_development_dependency "filewatch"
20
+ spec.add_dependency 'rails', '~> 3'
21
+
22
+ spec.add_development_dependency "filewatch", "~>0"
23
23
  spec.add_development_dependency "bundler", "~> 1.7"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency 'minitest', '~> 5.6'
26
+ spec.add_development_dependency 'minitest-reporters', '~> 1.0'
27
+ spec.add_development_dependency 'capybara', "~> 2.4"
28
+ spec.add_development_dependency 'poltergeist', "~> 1"
25
29
  end
data/lib/envvy/js.rb CHANGED
@@ -3,7 +3,7 @@ module Envvy
3
3
  mattr_accessor :env
4
4
 
5
5
  def self.env
6
- @env ||= envvy.get("js_config")
6
+ @env ||= Envvy.get("js_config")
7
7
  end
8
8
  end
9
9
  end
data/lib/envvy/railtie.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'yaml'
2
+
1
3
  module Envvy
2
4
  class Railtie < Rails::Railtie
3
5
  attr_accessor :env
data/lib/envvy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Envvy
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+ require 'fileutils'
3
+ require 'find'
4
+ require 'shellwords'
5
+
6
+ class SprocketsRailsTest < Minitest::Test
7
+
8
+ def test_sprockets_digest_asset_refs
9
+ root = 'test/dummy_app'
10
+ command = "bundle exec rake assets:precompile GEMFILE=#{GEM_PATH}/Gemfile RAILS_ENV=production"
11
+ compiled = Dir.chdir root do
12
+ silence_stderr_if !ENV['VERBOSE'] do
13
+ system(command)
14
+ end
15
+ end
16
+ assert compiled, 'Could not precompile assets'
17
+ Dir.glob(File.join(root, 'public', 'assets', 'app*.{css,js}')) do |path|
18
+ File.open(path, 'r') do |f|
19
+ f.read.scan /url\("?[^"]+\.(?:jpg|png|eot|woff2?|ttf|svg)[^"]*"?\)/ do |m|
20
+ assert_match /-[0-9a-f]{12,}\./, m
21
+ end
22
+ end
23
+ end
24
+ ensure
25
+ FileUtils.rm_rf %W(#{root}/public/assets/ #{root}/tmp/cache/), secure: true
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path("../spring", __FILE__)
4
+ rescue LoadError
5
+ end
6
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
7
+
8
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
9
+ require File.expand_path('../../config/boot', __FILE__)
10
+ require 'rails/commands'
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path("../spring", __FILE__)
4
+ rescue LoadError
5
+ end
6
+ require 'bundler/setup'
7
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path("../spring", __FILE__)
4
+ rescue LoadError
5
+ end
6
+ require 'bundler/setup'
7
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads spring without using Bundler, in order to be fast
4
+ # It gets overwritten when you run the `spring binstub` command
5
+
6
+ unless defined?(Spring)
7
+ require "rubygems"
8
+ require "bundler"
9
+
10
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
11
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
+ ENV["GEM_HOME"] = ""
13
+ Gem.paths = ENV
14
+
15
+ gem "spring", match[1]
16
+ require "spring/binstub"
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails'
4
+
5
+ %w(
6
+ action_controller
7
+ action_view
8
+ sprockets
9
+ ).each do |framework|
10
+ require "#{framework}/railtie"
11
+ end
12
+
13
+ Bundler.require(*Rails.groups)
14
+
15
+ require "envvy"
16
+
17
+ module Dummy
18
+ class Application < Rails::Application
19
+
20
+ end
21
+ end
22
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,5 @@
1
+ config:
2
+ some_key: secret
3
+ storage: "/mnt/storage"
4
+ js_config:
5
+ xx_api: http://localhost:3002
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,33 @@
1
+
2
+ Dummy::Application.configure do
3
+ # Settings specified here will take precedence over those in config/application.rb
4
+
5
+ # In the development environment your application's code is reloaded on
6
+ # every request. This slows down response time but is perfect for development
7
+ # since you don't have to restart the web server when you make code changes.
8
+ config.cache_classes = false
9
+
10
+ # Show full error reports and disable caching
11
+ config.consider_all_requests_local = true
12
+ config.action_controller.perform_caching = false
13
+
14
+ # Don't care if the mailer can't send
15
+ config.action_mailer.raise_delivery_errors = false
16
+
17
+ # Print deprecation notices to the Rails logger
18
+ config.active_support.deprecation = :log
19
+
20
+ # Only use best-standards-support built into browsers
21
+ config.action_dispatch.best_standards_support = :builtin
22
+
23
+ # Do not compress assets
24
+ config.assets.compress = false
25
+
26
+ # Expands the lines which load the assets
27
+ config.assets.debug = true
28
+
29
+ config.eager_load = false
30
+
31
+ config.eh_surveillance_policy_identifier = "0020422201"
32
+ config.eh_insurance_policy_identifier = "0020422201"
33
+ end
@@ -0,0 +1,32 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_files = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Show full error reports and disable caching
15
+ config.consider_all_requests_local = true
16
+ config.action_controller.perform_caching = false
17
+
18
+ # Raise exceptions instead of rendering exception templates
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ # Disable request forgery protection in test environment
22
+ config.action_controller.allow_forgery_protection = false
23
+
24
+ # Print deprecation notices to the stderr
25
+ config.active_support.deprecation = :stderr
26
+
27
+ config.eager_load = true
28
+
29
+ config.i18n.default_locale = :fr
30
+
31
+ Rails.application.routes.default_url_options = { host: "localhost", port: "3000", scheme: "http"}
32
+ end
@@ -0,0 +1,3 @@
1
+ Dummy::Application.routes.draw do
2
+ mount Envvy::Engine => "/"
3
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class EnvvyEngineTest < Minitest::Test
4
+
5
+ # Based on test/dummy_app/config/env_vars.yml
6
+ def test_env_variables_exist
7
+ assert ENV["SOME_KEY"] = "secret"
8
+ assert ENV["STORAGE"] = "/mnt/storage"
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module Kernel
3
+ def silence_stdout_if(cond, &run)
4
+ silence_stream_if(cond, STDOUT, &run)
5
+ end
6
+
7
+ def silence_stderr_if(cond, &run)
8
+ silence_stream_if(cond, STDERR, &run)
9
+ end
10
+
11
+ def silence_stream_if(cond, stream, &run)
12
+ if cond
13
+ silence_stream(stream, &run)
14
+ else
15
+ run.call
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,44 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+
3
+ require File.expand_path("../dummy_app/config/environment", __FILE__)
4
+
5
+ require 'minitest/autorun'
6
+ require 'minitest/reporters'
7
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
8
+
9
+ require 'active_support/core_ext/kernel/reporting'
10
+ require 'test_helper'
11
+ require 'rails/test_help'
12
+ require 'capybara/rails'
13
+
14
+ ENV['RAILS_ENV'] = ENV['RACK_ENV'] = 'test'
15
+
16
+
17
+ Dir['test/support/**/*.rb'].each do |file|
18
+ # strip ^test/ and .rb$
19
+ file = file[5..-4]
20
+ require_relative File.join('.', file)
21
+ end
22
+
23
+ GEM_PATH = File.expand_path('../', File.dirname(__FILE__))
24
+
25
+ #= Capybara + Poltergeist
26
+ require 'capybara/poltergeist'
27
+
28
+ Capybara.register_driver :poltergeist do |app|
29
+ Capybara::Poltergeist::Driver.new(
30
+ app,
31
+ # inspector: '/Applications/Chromium.app/Contents/MacOS/Chromium', # open in inspector: page.driver.debug
32
+ window_size: [1280, 1024],
33
+ timeout: 90,
34
+ js_errors: true
35
+ )
36
+ end
37
+
38
+ Capybara.configure do |config|
39
+ config.app_host = 'http://localhost:7000'
40
+ config.default_driver = :poltergeist
41
+ config.javascript_driver = :poltergeist
42
+ config.server_port = 7000
43
+ config.default_wait_time = 10
44
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envvy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Balaine
@@ -15,28 +15,28 @@ dependencies:
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '3'
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: '3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: filewatch
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,62 @@ dependencies:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '10.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: minitest
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '5.6'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '5.6'
84
+ - !ruby/object:Gem::Dependency
85
+ name: minitest-reporters
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '1.0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '1.0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: capybara
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '2.4'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '2.4'
112
+ - !ruby/object:Gem::Dependency
113
+ name: poltergeist
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '1'
70
126
  description: Load environment variables from various sources within the Rails initialization
71
127
  process
72
128
  email:
@@ -89,6 +145,26 @@ files:
89
145
  - lib/envvy/js.rb
90
146
  - lib/envvy/railtie.rb
91
147
  - lib/envvy/version.rb
148
+ - test/compilation/js_test.rb
149
+ - test/dummy_app/Rakefile
150
+ - test/dummy_app/bin/rails
151
+ - test/dummy_app/bin/rake
152
+ - test/dummy_app/bin/rspec
153
+ - test/dummy_app/bin/spring
154
+ - test/dummy_app/config.ru
155
+ - test/dummy_app/config/application.rb
156
+ - test/dummy_app/config/boot.rb
157
+ - test/dummy_app/config/env_vars.yml
158
+ - test/dummy_app/config/environment.rb
159
+ - test/dummy_app/config/environments/development.rb
160
+ - test/dummy_app/config/environments/test.rb
161
+ - test/dummy_app/config/routes.rb
162
+ - test/dummy_app/lib/assets/.gitkeep
163
+ - test/dummy_app/log/.gitkeep
164
+ - test/dummy_app/script/rails
165
+ - test/engine/engine_test.rb
166
+ - test/support/reporting.rb
167
+ - test/test_helper.rb
92
168
  homepage: http://github.com/nexkap/envvy
93
169
  licenses:
94
170
  - MIT
@@ -112,6 +188,25 @@ rubyforge_project:
112
188
  rubygems_version: 2.4.5
113
189
  signing_key:
114
190
  specification_version: 4
115
- summary: Load environment variables from various sources within the Rails initialization
116
- process
117
- test_files: []
191
+ summary: Rails back and front env variable loader
192
+ test_files:
193
+ - test/compilation/js_test.rb
194
+ - test/dummy_app/Rakefile
195
+ - test/dummy_app/bin/rails
196
+ - test/dummy_app/bin/rake
197
+ - test/dummy_app/bin/rspec
198
+ - test/dummy_app/bin/spring
199
+ - test/dummy_app/config.ru
200
+ - test/dummy_app/config/application.rb
201
+ - test/dummy_app/config/boot.rb
202
+ - test/dummy_app/config/env_vars.yml
203
+ - test/dummy_app/config/environment.rb
204
+ - test/dummy_app/config/environments/development.rb
205
+ - test/dummy_app/config/environments/test.rb
206
+ - test/dummy_app/config/routes.rb
207
+ - test/dummy_app/lib/assets/.gitkeep
208
+ - test/dummy_app/log/.gitkeep
209
+ - test/dummy_app/script/rails
210
+ - test/engine/engine_test.rb
211
+ - test/support/reporting.rb
212
+ - test/test_helper.rb