tamplier 0.3.0 → 0.3.1
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 +4 -4
- data/bin/tamplier +4 -3
- data/lib/tamplier/copy.rb +3 -3
- data/lib/tamplier/iterator.rb +4 -7
- data/lib/tamplier/problem_iterator.rb +13 -0
- data/lib/tamplier/symlink.rb +3 -3
- data/lib/tamplier/validator.rb +1 -2
- data/lib/tamplier/version.rb +1 -1
- data/spec/iterator_spec.rb +6 -0
- data/spec/validator_spec.rb +1 -0
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6609614622dd56b61b1e01efbe77d34ef7aa3f4c
|
4
|
+
data.tar.gz: ad4af9a74bcbad4f569b4e7d8e1da90c0dfad1c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7227fceae9ce04a192eae0aa0425774b2e3ca3452de6f77438633bf5ef8b27960c44d6499bc36430252b9544d63d65deb370cbca99fcb9d4271af581016f0c16
|
7
|
+
data.tar.gz: 4d1c1d58a27c24ca9d97b1171bb1c77a96264bb574edada9db5cd24c16579fe9d51c8b1cab887db7733e15d5bfdfdad7ff779b8684c27cc97f893e13bad0e840
|
data/bin/tamplier
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative '../lib/tamplier'
|
4
4
|
require_relative '../lib/tamplier/iterator'
|
5
|
+
require_relative '../lib/tamplier/problem_iterator'
|
5
6
|
require_relative '../lib/tamplier/copy'
|
6
7
|
require_relative '../lib/tamplier/symlink'
|
7
8
|
|
@@ -11,7 +12,7 @@ require 'commander'
|
|
11
12
|
Commander.configure do
|
12
13
|
program :name, 'Tamplier'
|
13
14
|
program :version, Tamplier::VERSION
|
14
|
-
program :description, 'Tamplier provides ability to manage
|
15
|
+
program :description, 'Tamplier provides ability to manage sample config files in your ruby projects.'
|
15
16
|
program :help, 'Author', 'Alexander Shestakov <Maksar.mail@gmail.com>'
|
16
17
|
|
17
18
|
command :check do |c|
|
@@ -29,7 +30,7 @@ Commander.configure do
|
|
29
30
|
|
30
31
|
command :copy do |c|
|
31
32
|
c.syntax = 'tamplier copy'
|
32
|
-
c.description = 'Creates copies of all
|
33
|
+
c.description = 'Creates copies of all sample files in config directory with .yml extension'
|
33
34
|
c.action do |args, options|
|
34
35
|
Tamplier::Copy.new.call(Pathname('.').join('config'))
|
35
36
|
end
|
@@ -37,7 +38,7 @@ Commander.configure do
|
|
37
38
|
|
38
39
|
command :symlink do |c|
|
39
40
|
c.syntax = 'tamplier copy'
|
40
|
-
c.description = 'Creates symbolic links with .yml extension pointing to
|
41
|
+
c.description = 'Creates symbolic links with .yml extension pointing to sample files'
|
41
42
|
c.action do |args, options|
|
42
43
|
Tamplier::Symlink.new.call(Pathname('.').join('config'))
|
43
44
|
end
|
data/lib/tamplier/copy.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Tamplier
|
2
|
-
class Copy
|
3
|
-
def call(
|
4
|
-
|
2
|
+
class Copy
|
3
|
+
def call(root)
|
4
|
+
ProblemIterator.new.call(root) do |sample_file, config_file|
|
5
5
|
FileUtils.cp(sample_file, config_file) unless config_file.exist?
|
6
6
|
puts "Made a copy of #{sample_file} to #{config_file}."
|
7
7
|
end
|
data/lib/tamplier/iterator.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
module Tamplier
|
2
2
|
class Iterator
|
3
|
+
TEMPLATES = %w[yml.sample sample.yml yml.example example.yml]
|
3
4
|
def call(root)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if config_file.exist? || config_file.symlink?
|
8
|
-
puts "#{config_file} already exist, skipping."
|
9
|
-
else
|
10
|
-
yield(sample_file, config_file)
|
5
|
+
TEMPLATES.each do |template|
|
6
|
+
Pathname.glob(File.join(root, "*.#{template}")).each do |sample_file|
|
7
|
+
yield(sample_file, sample_file.sub(template, 'yml'))
|
11
8
|
end
|
12
9
|
end
|
13
10
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Tamplier
|
2
|
+
class ProblemIterator
|
3
|
+
def call(root)
|
4
|
+
Iterator.new.call(root) do |sample_file, config_file|
|
5
|
+
if config_file.exist? || config_file.symlink?
|
6
|
+
puts "#{config_file} already exist, skipping."
|
7
|
+
else
|
8
|
+
yield(sample_file, config_file)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/tamplier/symlink.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Tamplier
|
2
|
-
class Symlink
|
3
|
-
def call(
|
4
|
-
|
2
|
+
class Symlink
|
3
|
+
def call(root)
|
4
|
+
ProblemIterator.new.call(root) do |sample_file, config_file|
|
5
5
|
FileUtils.ln_s(sample_file, config_file)
|
6
6
|
puts "Made a symlink from #{sample_file} pointing to #{config_file}."
|
7
7
|
end
|
data/lib/tamplier/validator.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module Tamplier
|
2
2
|
class Validator
|
3
3
|
def ensure(root, environment = nil)
|
4
|
-
|
5
|
-
config_file = sample_file.sub_ext('')
|
4
|
+
Iterator.new.call(root) do |sample_file, config_file|
|
6
5
|
raise ConfigurationException.new("Configuration file #{config_file} does not exist, but sample file #{sample_file} does.") unless config_file.exist?
|
7
6
|
|
8
7
|
if environmental_file?(sample_file)
|
data/lib/tamplier/version.rb
CHANGED
data/spec/validator_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tamplier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Shestakov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -124,9 +124,9 @@ dependencies:
|
|
124
124
|
version: '0'
|
125
125
|
description: |
|
126
126
|
How many times your deploys were failed, because you forgot to update .yml files on server... No more!
|
127
|
-
Tamplier gem checks, that all keys from any
|
127
|
+
Tamplier gem checks, that all keys from any sample files are actually exist in real .yml files.
|
128
128
|
That allows to detect configuration problems earlier and spend less time on deployment problems investigations.
|
129
|
-
Gem also provides command line utility to quickly setup fresh development environment by copying or symlinking
|
129
|
+
Gem also provides command line utility to quickly setup fresh development environment by copying or symlinking sample files.
|
130
130
|
email:
|
131
131
|
- Maksar.mail@gmail.com
|
132
132
|
executables:
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/tamplier/copy.rb
|
140
140
|
- lib/tamplier/exceptions/configuration_exception.rb
|
141
141
|
- lib/tamplier/iterator.rb
|
142
|
+
- lib/tamplier/problem_iterator.rb
|
142
143
|
- lib/tamplier/railtie.rb
|
143
144
|
- lib/tamplier/symlink.rb
|
144
145
|
- lib/tamplier/validator.rb
|
@@ -157,6 +158,7 @@ files:
|
|
157
158
|
- spec/examples/absent_file/valid.yml.sample
|
158
159
|
- spec/examples/absent_keys/non_environment.yml
|
159
160
|
- spec/examples/absent_keys/non_environment.yml.sample
|
161
|
+
- spec/iterator_spec.rb
|
160
162
|
- spec/railtie_spec.rb
|
161
163
|
- spec/spec_helper.rb
|
162
164
|
- spec/validator_spec.rb
|
@@ -183,8 +185,8 @@ rubyforge_project:
|
|
183
185
|
rubygems_version: 2.2.2
|
184
186
|
signing_key:
|
185
187
|
specification_version: 4
|
186
|
-
summary: Tamplier gem provides ability to manage
|
187
|
-
|
188
|
+
summary: Tamplier gem provides ability to manage sample config files in your ruby
|
189
|
+
projects.
|
188
190
|
test_files:
|
189
191
|
- spec/dummy/config/environment.rb
|
190
192
|
- spec/dummy/config/test.yml.sample
|
@@ -200,6 +202,7 @@ test_files:
|
|
200
202
|
- spec/examples/absent_file/valid.yml.sample
|
201
203
|
- spec/examples/absent_keys/non_environment.yml
|
202
204
|
- spec/examples/absent_keys/non_environment.yml.sample
|
205
|
+
- spec/iterator_spec.rb
|
203
206
|
- spec/railtie_spec.rb
|
204
207
|
- spec/spec_helper.rb
|
205
208
|
- spec/validator_spec.rb
|