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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32b4ddb600f1f140e66c33d83bdde687f92e94a3
4
- data.tar.gz: 85b1b44674ba0ac5df73cd64e33e509a44b9a77c
3
+ metadata.gz: dd8b835a413ec4e9f789730aee2df2afc6b495d3
4
+ data.tar.gz: 0d5edcc08ff046b1d1271c5426a3a5a2dc5b03ce
5
5
  SHA512:
6
- metadata.gz: 71e19020b4da56639b484babdd8e153e45ebdffdcf8423546bfd7de17d296738c9cd8f447bdd97d45aaf1230d81910e15a36a3a24078ae231f63a3d1efbe9582
7
- data.tar.gz: 1efebe21980e568e141376b77c92c60da909ba77c042b8a91ed490c817e2fc41451828e0985dd7d5422e1ca96b91fb758ac8ecf28aafa445115f2b92894dc7c4
6
+ metadata.gz: d208bfb15fdb6a0845cb4f9837850e634e05f59a7a4db4e39c0a631452f5f3d63a8272fb32c0837696328d7039a8867d4bc7303d8dc4a83c25d568fd1d31712d
7
+ data.tar.gz: a6b8394a2e5e7f9d1232f7e4054d278f839d89c6cc19e5dbe34f93da0fda408552d0e0e49f529e8e19710f3e56140d4987f1a945cc01488fc88f18d93052f14d
data/.travis.yml CHANGED
@@ -3,4 +3,5 @@ cache: bundler
3
3
  rvm:
4
4
  - 2.0.0
5
5
  - 2.1.1
6
+ - 2.1.2
6
7
  script: bundle exec rake travis
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
- [![Gem Version](http://img.shields.io/gem/v/config_curator.svg)](https://rubygems.org/gems/config_curator)
8
- [![MIT License](http://img.shields.io/badge/license-MIT-red.svg)](./LICENSE.txt)
9
- [![Dependency Status](http://img.shields.io/gemnasium/razor-x/config_curator.svg)](https://gemnasium.com/razor-x/config_curator)
10
- [![Build Status](http://img.shields.io/travis/razor-x/config_curator.svg)](https://travis-ci.org/razor-x/config_curator)
11
- [![Coverage Status](http://img.shields.io/coveralls/razor-x/config_curator.svg)](https://coveralls.io/r/razor-x/config_curator)
12
- [![Code Climate](http://img.shields.io/codeclimate/github/razor-x/config_curator.svg)](https://codeclimate.com/github/razor-x/config_curator)
7
+ [![Gem Version](http://img.shields.io/gem/v/config_curator.svg?style=flat)](https://rubygems.org/gems/config_curator)
8
+ [![MIT License](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](./LICENSE.txt)
9
+ [![Dependency Status](http://img.shields.io/gemnasium/razor-x/config_curator.svg?style=flat)](https://gemnasium.com/razor-x/config_curator)
10
+ [![Build Status](http://img.shields.io/travis/razor-x/config_curator.svg?style=flat)](https://travis-ci.org/razor-x/config_curator)
11
+ [![Coverage Status](http://img.shields.io/coveralls/razor-x/config_curator.svg?style=flat)](https://coveralls.io/r/razor-x/config_curator)
12
+ [![Code Climate](http://img.shields.io/codeclimate/github/razor-x/config_curator.svg?style=flat)](https://codeclimate.com/github/razor-x/config_curator)
13
13
 
14
14
  ## Installation
15
15
 
@@ -1,4 +1,5 @@
1
1
  require 'config_curator/version'
2
+ require 'config_curator/utils'
2
3
  require 'config_curator/package_lookup'
3
4
  require 'config_curator/collection'
4
5
  require 'config_curator/cli'
@@ -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
  #
@@ -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 install the component.
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
@@ -1,4 +1,4 @@
1
1
  module ConfigCurator
2
2
  # Config Curator version.
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  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 = 'path/to/file'
11
- expect(config_file.destination).to eq 'path/to/file'
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.0
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-05-18 00:00:00.000000000 Z
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