capistrano-env 0.1.0 → 0.1.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: eca7b988424503f05ab3e67e4dfe6a9b9bf18bf0
4
- data.tar.gz: 3c5cecb6d77d1c5e51914892964a1bee6165946e
3
+ metadata.gz: 8df3f7d4f949a79689126918c6de74338707c745
4
+ data.tar.gz: eb0809253334ed4c996a9a17808e9917208a72f5
5
5
  SHA512:
6
- metadata.gz: f71e31fce1fa9e316d74dc3839520e20679b811c0beb75432f7a1299c1d4c02a44903f2ecb47f5487c0a1170b05db29fbee70d1509c1bfcec367fb674114423c
7
- data.tar.gz: 79da44e5a2556f819b49759584bf9586ecc6e18034c4fc780b9d16b1771f2b557522b047c3b0291f84beb26e442067b48aa6b1be4e7e716f0ffe892fc2e3be00
6
+ metadata.gz: 448aa8dd55f3e8ff47e290e76e93254e2872afad63bd3154fe3124e10fe135516608baca5ed8a3da1d06c308b2a496bd7fb34767e2432c7d7ba6242c14793033
7
+ data.tar.gz: 0eac3447a423e1362d409eafdf95aeaed2dcb1fcfe9b99b5fd7f75b5c2b5a68ac46a8d07a15740839f82a273023020ac9d78cb5a26ca80b73263fb2934c55632
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
- --format documentation
2
1
  --color
2
+ --format doc
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ Metrics/LineLength:
2
+ Enabled: false
3
+ Metrics/MethodLength:
4
+ Enabled: false
5
+ Style/Documentation:
6
+ Enabled: false
7
+ Style/FileName:
8
+ Enabled: false
9
+ Style/RegexpLiteral:
10
+ MaxSlashes: 0
data/.travis.yml CHANGED
@@ -2,3 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 2.1.2
5
+ script:
6
+ - bundle exec rake spec
7
+ - bundle exec rubocop
data/Guardfile CHANGED
@@ -4,14 +4,13 @@
4
4
  guard :rspec do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
6
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
7
+ watch('spec/(spec|rails)_helper.rb') { 'spec' }
8
8
 
9
9
  # Rails example
10
10
  watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
11
  watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
12
  watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
- watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
- watch('config/routes.rb') { "spec/routing" }
15
- watch('app/controllers/application_controller.rb') { "spec/controllers" }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
14
+ watch('config/routes.rb') { 'spec/routing' }
15
+ watch('app/controllers/application_controller.rb') { 'spec/controllers' }
16
16
  end
17
-
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -4,26 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'capistrano/env/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "capistrano-env"
7
+ spec.name = 'capistrano-env'
8
8
  spec.version = Capistrano::Env::VERSION
9
- spec.authors = ["masarakki"]
10
- spec.email = ["masaki@hisme.net"]
11
- spec.description = %q{capistrano with environments}
12
- spec.summary = %q{capistrano with environments}
13
- spec.homepage = "https://github.com/masarakki/capistrano-env"
14
- spec.license = "MIT"
9
+ spec.authors = ['masarakki']
10
+ spec.email = ['masaki@hisme.net']
11
+ spec.description = 'capistrano with environments'
12
+ spec.summary = 'capistrano with environments'
13
+ spec.homepage = 'https://github.com/masarakki/capistrano-env'
14
+ spec.license = 'MIT'
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency "rails", ">= 3.0", "< 5.0"
21
+ spec.add_dependency 'rails', '>= 3.0', '< 5.0'
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "rspec-rails"
27
- spec.add_development_dependency "sqlite3"
28
- spec.add_development_dependency "capistrano", '~> 2'
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'rspec-rails'
27
+ spec.add_development_dependency 'rubocop'
28
+ spec.add_development_dependency 'sqlite3'
29
+ spec.add_development_dependency 'capistrano', '~> 2'
29
30
  end
@@ -27,16 +27,8 @@ module Capistrano
27
27
  def envs
28
28
  result = {}
29
29
  @keys.each do |key, block|
30
- key_values = if key.is_a? Regexp
31
- ENV.select{|x| x =~ key }
32
- else
33
- ENV.select{|x| x == key }
34
- end
35
- if block
36
- key_values = Hash[key_values.map do |k, v|
37
- [block.call(k), v]
38
- end]
39
- end
30
+ key_values = key.is_a?(Regexp) ? ENV.select { |x| x =~ key } : ENV.select { |x| x == key }
31
+ key_values = Hash[key_values.map { |k, v| [block.call(k), v] }] if block
40
32
  result.merge!(key_values)
41
33
  end
42
34
  result.merge(@values)
@@ -3,7 +3,7 @@ module Capistrano
3
3
  module Formatter
4
4
  class RubyFormatter
5
5
  def self.file_ext
6
- "rb"
6
+ 'rb'
7
7
  end
8
8
 
9
9
  def self.format(envs)
@@ -2,8 +2,8 @@ module Capistrano
2
2
  module Env
3
3
  class Railtie < ::Rails::Railtie
4
4
  config.before_configuration do
5
- capenv_file = File.expand_path("./capenv.rb", Rails.root)
6
- require capenv_file if File.exists?(capenv_file)
5
+ capenv_file = File.expand_path('./capenv.rb', Rails.root)
6
+ require capenv_file if File.exist?(capenv_file)
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Env
3
- VERSION = "0.1.0"
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- require "capistrano/env/version"
1
+ require 'capistrano/env/version'
2
2
 
3
3
  module Capistrano
4
4
  module Env
@@ -7,6 +7,6 @@ module Capistrano
7
7
  end
8
8
  end
9
9
 
10
- require "capistrano/env/plugin"
11
- require "capistrano/env/config"
12
- require "capistrano/env/railtie" if defined? Rails
10
+ require 'capistrano/env/plugin'
11
+ require 'capistrano/env/config'
12
+ require 'capistrano/env/railtie' if defined? Rails
@@ -1,63 +1,63 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe Capistrano::Env::Config do
4
4
  let(:config) { described_class.new }
5
- describe "#formatter" do
5
+ describe '#formatter' do
6
6
  it { expect(config.formatter).to eq :ruby }
7
7
  end
8
8
 
9
- describe "#formatter_class" do
9
+ describe '#formatter class' do
10
10
  it { expect(config.formatter_class).to eq Capistrano::Env::Formatter::RubyFormatter }
11
11
  end
12
12
 
13
- describe "#capenv_file" do
14
- it { expect(config.capenv_file).to eq "capenv.rb" }
13
+ describe '#capenv_file' do
14
+ it { expect(config.capenv_file).to eq 'capenv.rb' }
15
15
  end
16
16
 
17
- describe "capenv content" do
18
- it {
17
+ describe '#capenv_content' do
18
+ it do
19
19
  require 'capistrano/env/formatter/ruby_formatter'
20
- allow(config).to receive(:envs).and_return( { "a" => "b" } )
21
- expect(Capistrano::Env::Formatter::RubyFormatter).to receive(:format).with({"a" => "b"}).and_return "hello"
22
- expect(config.capenv_content).to eq "hello"
23
- }
20
+ allow(config).to receive(:envs).and_return('a' => 'b')
21
+ expect(Capistrano::Env::Formatter::RubyFormatter).to receive(:format).with('a' => 'b').and_return 'hello'
22
+ expect(config.capenv_content).to eq 'hello'
23
+ end
24
24
  end
25
25
 
26
- describe "#add" do
26
+ describe '#add' do
27
27
  before do
28
- ENV["CAPENV_TEST_A"] = "a"
29
- ENV["CAPENV_TEST_B"] = "1,2,3"
30
- ENV["CAPENV_TEST"] = "$"
31
- ENV["VAPENV_XYZ_A"] = "X"
28
+ ENV['CAPENV_TEST_A'] = 'a'
29
+ ENV['CAPENV_TEST_B'] = '1,2,3'
30
+ ENV['CAPENV_TEST'] = '$'
31
+ ENV['VAPENV_XYZ_A'] = 'X'
32
32
  end
33
33
 
34
- context "with regex" do
34
+ context 'with regex' do
35
35
  before do
36
- config.add /^CAPENV_TEST_/
36
+ config.add(/^CAPENV_TEST_/)
37
37
  end
38
- it { expect(config.envs).to eq({"CAPENV_TEST_A" => "a", "CAPENV_TEST_B" => "1,2,3"}) }
38
+ it { expect(config.envs).to eq('CAPENV_TEST_A' => 'a', 'CAPENV_TEST_B' => '1,2,3') }
39
39
  end
40
- context "with string" do
40
+ context 'with string' do
41
41
  before do
42
- config.add "CAPENV_TEST"
42
+ config.add 'CAPENV_TEST'
43
43
  end
44
- it { expect(config.envs).to eq({"CAPENV_TEST" => "$"}) }
44
+ it { expect(config.envs).to eq('CAPENV_TEST' => '$') }
45
45
  end
46
- describe "overridable" do
46
+ describe 'overridable' do
47
47
  before do
48
- config.add /^CAPENV_TEST_/
49
- config.add "CAPENV_TEST_B", "UNKO"
48
+ config.add(/^CAPENV_TEST_/)
49
+ config.add 'CAPENV_TEST_B', 'UNKO'
50
50
  end
51
- it { expect(config.envs).to eq({"CAPENV_TEST_A" => "a", "CAPENV_TEST_B" => "UNKO"}) }
51
+ it { expect(config.envs).to eq('CAPENV_TEST_A' => 'a', 'CAPENV_TEST_B' => 'UNKO') }
52
52
  end
53
- describe "fix key with block" do
53
+ describe 'fix key with block' do
54
54
  before do
55
- config.add /^CAPENV_TEST_/
56
- config.add /^CAPENV_TEST_/ do |key|
55
+ config.add(/^CAPENV_TEST_/)
56
+ config.add(/^CAPENV_TEST_/) do |key|
57
57
  key.gsub(/CAPENV_/, '')
58
58
  end
59
59
  end
60
- it { expect(config.envs).to eq({"CAPENV_TEST_A" => "a", "CAPENV_TEST_B" => "1,2,3", "TEST_A" => "a", "TEST_B" => "1,2,3"}) }
60
+ it { expect(config.envs).to eq('CAPENV_TEST_A' => 'a', 'CAPENV_TEST_B' => '1,2,3', 'TEST_A' => 'a', 'TEST_B' => '1,2,3') }
61
61
  end
62
62
  end
63
63
  end
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
  require 'capistrano/env/formatter/ruby_formatter'
3
3
 
4
4
  describe Capistrano::Env::Formatter::RubyFormatter do
5
- let(:envs) { {"HELLO" => "WORLD", "HOGE" => "1,2,3"} }
6
- expect_string =<<EOF
5
+ let(:envs) { { 'HELLO' => 'WORLD', 'HOGE' => '1,2,3' } }
6
+ expect_string = <<EOF
7
7
  ENV["HELLO"] = "WORLD"
8
8
  ENV["HOGE"] = "1,2,3"
9
9
  EOF
@@ -4,18 +4,18 @@ require 'capistrano'
4
4
  describe Capistrano::Env::Plugin do
5
5
  let(:capistrano) { Capistrano::Configuration.new }
6
6
 
7
- describe "#capenv" do
8
- let(:setup) { capistrano.capenv.use {|config| config.add "HELLO", "WORLD" } }
7
+ describe '#capenv' do
8
+ let(:setup) { capistrano.capenv.use { |config| config.add 'HELLO', 'WORLD' } }
9
9
 
10
- it "add task" do
10
+ it 'add task' do
11
11
  expect(capistrano.capenv).to receive(:add)
12
12
  setup
13
13
  end
14
14
  it { expect(setup).to be_a Capistrano::Env::Config }
15
15
 
16
- it "set default_environment" do
16
+ it 'set default_environment' do
17
17
  setup
18
- expect(capistrano.fetch(:default_environment)).to eq "HELLO" => "WORLD"
18
+ expect(capistrano.fetch(:default_environment)).to eq 'HELLO' => 'WORLD'
19
19
  end
20
20
  end
21
21
  end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Capistrano::Env::Railtie" do
4
- describe "use in application.rb" do
5
- it { expect(Rails.configuration.hello).to eq "WORLD" }
3
+ describe 'Capistrano::Env::Railtie' do
4
+ describe 'use in application.rb' do
5
+ it { expect(Rails.configuration.hello).to eq 'WORLD' }
6
6
  end
7
7
 
8
- describe "use in initializers" do
9
- it { expect(Rails.configuration.hoge).to eq "HAGE" }
8
+ describe 'use in initializers' do
9
+ it { expect(Rails.configuration.hoge).to eq 'HAGE' }
10
10
  end
11
11
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe Capistrano::Env do
4
4
  it 'should have a version number' do
data/spec/dummy/capenv.rb CHANGED
@@ -1,3 +1,3 @@
1
- ENV["HELLO"] = "WORLD"
2
- ENV["HOGE"] = "HAGE"
3
- ENV["TEST"] = "1,2,3"
1
+ ENV['HELLO'] = 'WORLD'
2
+ ENV['HOGE'] = 'HAGE'
3
+ ENV['TEST'] = '1,2,3'
@@ -1,4 +1,4 @@
1
1
  # Set up gems listed in the Gemfile.
2
2
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
3
 
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -14,7 +14,7 @@ Dummy::Application.configure do
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
16
  config.serve_static_assets = true
17
- config.static_cache_control = "public, max-age=3600"
17
+ config.static_cache_control = 'public, max-age=3600'
18
18
 
19
19
  # Show full error reports and disable caching.
20
20
  config.consider_all_requests_local = true
@@ -1 +1 @@
1
- Rails.configuration.hoge = ENV["HOGE"]
1
+ Rails.configuration.hoge = ENV['HOGE']
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'capistrano'
4
+
5
+ ENV['RAILS_ENV'] ||= 'test'
6
+ require File.expand_path('../dummy/config/environment', __FILE__)
7
+ require 'rspec/rails'
8
+ require 'capistrano-env'
9
+
10
+ RSpec.configure do |_config|
11
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,60 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
-
3
- require 'capistrano'
4
-
5
- ENV['RAILS_ENV'] ||= 'test'
6
- require File.expand_path("../dummy/config/environment", __FILE__)
7
- require 'rspec/rails'
8
- require 'rspec/autorun'
9
- require 'capistrano-env'
10
-
11
- RSpec.configure do |config|
1
+ RSpec.configure do |_config|
2
+ # The settings below are suggested to provide a good initial experience
3
+ # with RSpec, but feel free to customize to your heart's content.
4
+ # # These two settings work together to allow you to limit a spec run
5
+ # # to individual examples or groups you care about by tagging them with
6
+ # # `:focus` metadata. When nothing is tagged with `:focus`, all examples
7
+ # # get run.
8
+ # config.filter_run :focus
9
+ # config.run_all_when_everything_filtered = true
10
+ #
11
+ # # Many RSpec users commonly either run the entire suite or an individual
12
+ # # file, and it's useful to allow more verbose output when running an
13
+ # # individual spec file.
14
+ # if config.files_to_run.one?
15
+ # # Use the documentation formatter for detailed output,
16
+ # # unless a formatter has already been configured
17
+ # # (e.g. via a command-line flag).
18
+ # config.default_formatter = 'doc'
19
+ # end
20
+ #
21
+ # # Print the 10 slowest examples and example groups at the
22
+ # # end of the spec run, to help surface which specs are running
23
+ # # particularly slow.
24
+ # config.profile_examples = 10
25
+ #
26
+ # # Run specs in random order to surface order dependencies. If you find an
27
+ # # order dependency and want to debug it, you can fix the order by providing
28
+ # # the seed, which is printed after each run.
29
+ # # --seed 1234
30
+ # config.order = :random
31
+ #
32
+ # # Seed global randomization in this process using the `--seed` CLI option.
33
+ # # Setting this allows you to use `--seed` to deterministically reproduce
34
+ # # test failures related to randomization by passing the same `--seed` value
35
+ # # as the one that triggered the failure.
36
+ # Kernel.srand config.seed
37
+ #
38
+ # # rspec-expectations config goes here. You can use an alternate
39
+ # # assertion/expectation library such as wrong or the stdlib/minitest
40
+ # # assertions if you prefer.
41
+ # config.expect_with :rspec do |expectations|
42
+ # # Enable only the newer, non-monkey-patching expect syntax.
43
+ # # For more details, see:
44
+ # # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
45
+ # expectations.syntax = :expect
46
+ # end
47
+ #
48
+ # # rspec-mocks config goes here. You can use an alternate test double
49
+ # # library (such as bogus or mocha) by changing the `mock_with` option here.
50
+ # config.mock_with :rspec do |mocks|
51
+ # # Enable only the newer, non-monkey-patching expect syntax.
52
+ # # For more details, see:
53
+ # # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
54
+ # mocks.syntax = :expect
55
+ #
56
+ # # Prevents you from mocking or stubbing a method that does not exist on
57
+ # # a real object. This is generally recommended.
58
+ # mocks.verify_partial_doubles = true
59
+ # end
12
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-env
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - masarakki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: sqlite3
91
105
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +137,7 @@ extra_rdoc_files: []
123
137
  files:
124
138
  - ".gitignore"
125
139
  - ".rspec"
140
+ - ".rubocop.yml"
126
141
  - ".travis.yml"
127
142
  - Gemfile
128
143
  - Guardfile
@@ -190,6 +205,7 @@ files:
190
205
  - spec/dummy/public/robots.txt
191
206
  - spec/dummy/vendor/assets/javascripts/.keep
192
207
  - spec/dummy/vendor/assets/stylesheets/.keep
208
+ - spec/rails_helper.rb
193
209
  - spec/spec_helper.rb
194
210
  homepage: https://github.com/masarakki/capistrano-env
195
211
  licenses:
@@ -269,4 +285,5 @@ test_files:
269
285
  - spec/dummy/public/robots.txt
270
286
  - spec/dummy/vendor/assets/javascripts/.keep
271
287
  - spec/dummy/vendor/assets/stylesheets/.keep
288
+ - spec/rails_helper.rb
272
289
  - spec/spec_helper.rb