config_for 0.1.0.pre1 → 0.1.0.pre2

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: 0fc8f929db5b50524c698fb943e5446e8f8d2ed9
4
- data.tar.gz: e9a2a724817253874d80b587ff1a8c135e110002
3
+ metadata.gz: 56695dbf594d62058d97d938c3cbaaa43df4abc8
4
+ data.tar.gz: 8eccf7a2a5e2e8bb9563a5f350fdc7f7af69524a
5
5
  SHA512:
6
- metadata.gz: 1f712133ad38f13065e5d6ce340af6da380f09f5cc53c6171ff9c65ebd5068b760b6b3ed9b86530291dbfde3f11adb87f115bb9ac45e30c78a47dc1f00e428d2
7
- data.tar.gz: 52acce1e49b443dbd0c3fd3a8c4da3109f16ac7d26de80291c05b9a80989544d3f9f509d1838449dbc82c48a995482df28330dcd3ced498796c0c76c79595d9a
6
+ metadata.gz: 8bfe600b0d710581029c7615b198c8035a6d4f97cde6db3761d856dc78fb1d721f7a6db35203737f00b78661c344f51d7d40d5bc107bc29baf0df20b9b136b9a
7
+ data.tar.gz: d8424645e62e20dcf324ca134a8333aec7be2370f0075a217cc8b85db115429f55e81ab1840b54133518697d64534a47eb07c375a4af28a2f968b3bb7c4d826a
@@ -32,11 +32,11 @@ module ConfigFor
32
32
  def self.load_config(path, name, env)
33
33
  yaml = File.join(path, "#{name}.yml")
34
34
 
35
- if File.exist?(yaml)
35
+ if File.readable?(yaml)
36
36
  config = parse_yaml(yaml)[env]
37
37
  ActiveSupport::HashWithIndifferentAccess.new(config)
38
38
  else
39
- raise "Could not load configuration. No such file - #{yaml}"
39
+ raise "Could not load configuration. Can't read #{yaml}"
40
40
  end
41
41
  end
42
42
 
@@ -16,9 +16,6 @@ module ConfigFor
16
16
  # @example changing the folder
17
17
  # ConfigFor::Capistrano::Task.new(:database) { |task| task.folder = 'configuration' }
18
18
  class Task < ::Rake::TaskLib
19
- include ::Capistrano::DSL
20
-
21
-
22
19
  # @!attribute name
23
20
  # @return [String] the name of the task and subtasks namespace
24
21
  attr_accessor :name
@@ -49,7 +46,6 @@ module ConfigFor
49
46
  define
50
47
  end
51
48
 
52
-
53
49
  # Path where will be the file uploaded
54
50
  # Is a join of #folder and #file
55
51
  def path
@@ -57,7 +53,7 @@ module ConfigFor
57
53
  end
58
54
 
59
55
  # Invokes the task to do the upload
60
- def run_task
56
+ def run_task(_task, _args)
61
57
  invoke("#{name}:upload")
62
58
  end
63
59
 
@@ -78,6 +74,8 @@ module ConfigFor
78
74
 
79
75
  private
80
76
 
77
+ include ::Capistrano::DSL
78
+
81
79
  def define
82
80
  namespace name do
83
81
  desc "Upload #{path} to remote servers"
@@ -112,15 +110,12 @@ module ConfigFor
112
110
  remote_file path => @tempfile.path, roles: @roles
113
111
  file @tempfile.path => "#{name}:generate"
114
112
 
113
+ before 'deploy:check:linked_files', @name
114
+
115
115
  desc "Generate #{path}"
116
116
  task(name, &method(:run_task))
117
-
118
- before 'deploy:check:linked_files', @name
119
117
  end
120
118
 
121
-
122
- private
123
-
124
119
  # This reimplements Capistrano::DSL::TaskEnhancements#remote_file
125
120
  # but uses UploadTask instead of Rake::Task
126
121
 
@@ -1,3 +1,3 @@
1
1
  module ConfigFor
2
- VERSION = '0.1.0.pre1'
2
+ VERSION = '0.1.0.pre2'
3
3
  end
@@ -63,16 +63,23 @@ RSpec.describe ConfigFor::Capistrano::Task do
63
63
 
64
64
  context 'task' do
65
65
  it 'accepts block to change folder' do
66
- task = described_class.new(:test) { |task| task.folder = 'other' }
66
+ task = described_class.new(:test) { |t| t.folder = 'other' }
67
67
  expect(task.folder).to eq('other')
68
68
  expect(rake_task('other/test.yml')).to be
69
69
  end
70
70
 
71
71
  it 'accepts block to change name' do
72
- task = described_class.new(:test) { |task| task.name = 'other' }
72
+ task = described_class.new(:test) { |t| t.name = 'other' }
73
73
  expect(task.name).to eq('other')
74
74
  expect(rake_task('other')).to be
75
75
  end
76
+
77
+ it 'invokes upload' do
78
+ task = described_class.new(:test)
79
+ expect(rake_task('test:upload')).to receive(:invoke)
80
+
81
+ invoke(task.name)
82
+ end
76
83
  end
77
84
 
78
85
  context 'task in namespace' do
@@ -97,6 +104,5 @@ RSpec.describe ConfigFor::Capistrano::Task do
97
104
  context 'config/database.yml' do
98
105
  it { is_expected.to be_a(ConfigFor::Capistrano::UploadTask) }
99
106
  end
100
-
101
107
  end
102
108
  end
@@ -17,7 +17,7 @@ RSpec.describe ConfigFor do
17
17
  it do
18
18
  expect{ subject }
19
19
  .to raise_error(RuntimeError,
20
- 'Could not load configuration. No such file - spec/fixtures/unknown.yml')
20
+ 'Could not load configuration. Can\'t read spec/fixtures/unknown.yml')
21
21
  end
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre1
4
+ version: 0.1.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Cichra
@@ -14,132 +14,132 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
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: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
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: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
- - - <
48
+ - - "<"
49
49
  - !ruby/object:Gem::Version
50
50
  version: '4.2'
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '3.0'
58
- - - <
58
+ - - "<"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '4.2'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: sinatra
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '>='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: 1.4.0
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 1.4.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: capistrano
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '3.0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '3.0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rspec
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ~>
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '3.1'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ~>
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '3.1'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: memfs
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - '>='
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - '>='
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: yard
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>='
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: activesupport
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '3.0'
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - '>='
142
+ - - ">="
143
143
  - !ruby/object:Gem::Version
144
144
  version: '3.0'
145
145
  description: Simplifies YAML parsing in Sinatra and Rails applications. Provides tools
@@ -150,9 +150,9 @@ executables: []
150
150
  extensions: []
151
151
  extra_rdoc_files: []
152
152
  files:
153
- - .gitignore
154
- - .rspec
155
- - .travis.yml
153
+ - ".gitignore"
154
+ - ".rspec"
155
+ - ".travis.yml"
156
156
  - Appraisals
157
157
  - CHANGELOG.md
158
158
  - Gemfile
@@ -184,12 +184,12 @@ require_paths:
184
184
  - lib
185
185
  required_ruby_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - '>='
187
+ - - ">="
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - '>'
192
+ - - ">"
193
193
  - !ruby/object:Gem::Version
194
194
  version: 1.3.1
195
195
  requirements: []