config_curator 0.1.0 → 0.1.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/.travis.yml +1 -0
- data/README.md +6 -6
- data/lib/config_curator.rb +1 -0
- data/lib/config_curator/package_lookup.rb +2 -9
- data/lib/config_curator/unit.rb +2 -9
- data/lib/config_curator/units/component.rb +1 -1
- data/lib/config_curator/units/config_file.rb +2 -2
- data/lib/config_curator/utils.rb +18 -0
- data/lib/config_curator/version.rb +1 -1
- data/spec/units/config_file_spec.rb +14 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd8b835a413ec4e9f789730aee2df2afc6b495d3
|
4
|
+
data.tar.gz: 0d5edcc08ff046b1d1271c5426a3a5a2dc5b03ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d208bfb15fdb6a0845cb4f9837850e634e05f59a7a4db4e39c0a631452f5f3d63a8272fb32c0837696328d7039a8867d4bc7303d8dc4a83c25d568fd1d31712d
|
7
|
+
data.tar.gz: a6b8394a2e5e7f9d1232f7e4054d278f839d89c6cc19e5dbe34f93da0fda408552d0e0e49f529e8e19710f3e56140d4987f1a945cc01488fc88f18d93052f14d
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,12 +4,12 @@ by Evan Boyd Sosenko.
|
|
4
4
|
|
5
5
|
_Simple and intelligent configuration file management._
|
6
6
|
|
7
|
-
[](https://rubygems.org/gems/config_curator)
|
8
|
-
[](./LICENSE.txt)
|
9
|
-
[](https://gemnasium.com/razor-x/config_curator)
|
10
|
-
[](https://travis-ci.org/razor-x/config_curator)
|
11
|
-
[](https://coveralls.io/r/razor-x/config_curator)
|
12
|
-
[](https://codeclimate.com/github/razor-x/config_curator)
|
7
|
+
[](https://rubygems.org/gems/config_curator)
|
8
|
+
[](./LICENSE.txt)
|
9
|
+
[](https://gemnasium.com/razor-x/config_curator)
|
10
|
+
[](https://travis-ci.org/razor-x/config_curator)
|
11
|
+
[](https://coveralls.io/r/razor-x/config_curator)
|
12
|
+
[](https://codeclimate.com/github/razor-x/config_curator)
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
data/lib/config_curator.rb
CHANGED
@@ -12,6 +12,8 @@ module ConfigCurator
|
|
12
12
|
# PackageLookup.new(tool: :pacman).installed? 'ruby' #=> true
|
13
13
|
class PackageLookup
|
14
14
|
|
15
|
+
include Utils
|
16
|
+
|
15
17
|
# Error when a package lookup cannot be completed.
|
16
18
|
class LookupFailed < RuntimeError; end
|
17
19
|
|
@@ -63,15 +65,6 @@ module ConfigCurator
|
|
63
65
|
|
64
66
|
private
|
65
67
|
|
66
|
-
# Checks if command exists.
|
67
|
-
# @param command [String] command name to check
|
68
|
-
# @return [String, nil] full path to command or nil if not found
|
69
|
-
def command? command
|
70
|
-
MakeMakefile::Logging.instance_variable_set :@logfile, File::NULL
|
71
|
-
MakeMakefile::Logging.quiet = true
|
72
|
-
MakeMakefile.find_executable command.to_s
|
73
|
-
end
|
74
|
-
|
75
68
|
#
|
76
69
|
# Tool specific package lookup methods below.
|
77
70
|
#
|
data/lib/config_curator/unit.rb
CHANGED
@@ -8,6 +8,8 @@ module ConfigCurator
|
|
8
8
|
# All units must specify a {#source} and a {#destination}.
|
9
9
|
class Unit
|
10
10
|
|
11
|
+
include Utils
|
12
|
+
|
11
13
|
# Error if the unit will fail to install.
|
12
14
|
class InstallFailed < RuntimeError; end
|
13
15
|
|
@@ -111,15 +113,6 @@ module ConfigCurator
|
|
111
113
|
def pkg_exists? pkg
|
112
114
|
package_lookup.installed? pkg
|
113
115
|
end
|
114
|
-
|
115
|
-
# Checks if command exists.
|
116
|
-
# @param command [String] command name to check
|
117
|
-
# @return [String, nil] full path to command or nil if not found
|
118
|
-
def command? command
|
119
|
-
MakeMakefile::Logging.instance_variable_set :@logfile, File::NULL
|
120
|
-
MakeMakefile::Logging.quiet = true
|
121
|
-
MakeMakefile.find_executable command.to_s
|
122
|
-
end
|
123
116
|
end
|
124
117
|
|
125
118
|
end
|
@@ -32,7 +32,7 @@ module ConfigCurator
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
# Recursively creates the necessary directories and
|
35
|
+
# Recursively creates the necessary directories and installs the component.
|
36
36
|
# Any files in the install directory not in the source directory are removed.
|
37
37
|
# Use rsync if available.
|
38
38
|
def install_component
|
@@ -14,10 +14,10 @@ module ConfigCurator
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# (see Unit#destination)
|
17
|
-
# @note Use {#source} by default.
|
17
|
+
# @note Use {Unit#source} by default.
|
18
18
|
def destination
|
19
19
|
super
|
20
|
-
@destination ||= source
|
20
|
+
@destination ||= @source
|
21
21
|
end
|
22
22
|
|
23
23
|
# (see Unit#install)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ConfigCurator
|
2
|
+
|
3
|
+
# Utility class.
|
4
|
+
module Utils
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
# Checks if command exists.
|
9
|
+
# @param command [String] command name to check
|
10
|
+
# @return [String, nil] full path to command or nil if not found
|
11
|
+
def command? command
|
12
|
+
MakeMakefile::Logging.instance_variable_set :@logfile, File::NULL
|
13
|
+
MakeMakefile::Logging.quiet = true
|
14
|
+
MakeMakefile.find_executable command.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -6,9 +6,21 @@ describe ConfigCurator::ConfigFile do
|
|
6
6
|
|
7
7
|
describe "#destination" do
|
8
8
|
|
9
|
+
let(:source) { 'path/../src_name.ext' }
|
10
|
+
|
9
11
|
it "uses the source path to set the destination" do
|
10
|
-
config_file.source =
|
11
|
-
expect(config_file.destination).to eq
|
12
|
+
config_file.source = source
|
13
|
+
expect(config_file.destination).to eq source
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when host-specific file found" do
|
17
|
+
|
18
|
+
it "uses the source path to set the destination" do
|
19
|
+
config_file.source = source
|
20
|
+
allow(config_file).to receive(:search_for_host_specific_file).with(source)
|
21
|
+
.and_return('path/../src_name.hostname.ext')
|
22
|
+
expect(config_file.destination).to eq source
|
23
|
+
end
|
12
24
|
end
|
13
25
|
end
|
14
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_curator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Boyd Sosenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- lib/config_curator/units/component.rb
|
235
235
|
- lib/config_curator/units/config_file.rb
|
236
236
|
- lib/config_curator/units/symlink.rb
|
237
|
+
- lib/config_curator/utils.rb
|
237
238
|
- lib/config_curator/version.rb
|
238
239
|
- spec/cli_spec.rb
|
239
240
|
- spec/collection_spec.rb
|