config_curator 0.2.3 → 0.2.4

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: 9af0c4d52d23b706e8e09981116e80082b81c08b
4
- data.tar.gz: 317bbb50b2c7154328e2a4f8e79248ee2b03fdff
3
+ metadata.gz: 5e2b559882994bb8018bbe48134184ae10ff7f77
4
+ data.tar.gz: 2f9dc98e7e92abed3919cd1254ec1ead0d92a136
5
5
  SHA512:
6
- metadata.gz: 5d963e3943a58c0f02b675fd2d775965be1d494cbc4c4b249302d100dede6957e2af2ea49d0b943e7e7d632e19076990978fb38dea402d0340f8018aa8028dfd
7
- data.tar.gz: d5376c45ac4da4699fe56912ddc059a40356ed63b0fefe4805dda8b147f2ecc454dced7b740d84ec5471c710cbe73630e9cf81dc26b7d63f925342d34c6ca3d5
6
+ metadata.gz: 743e75e64d381dad366fcd0edbab0c3e9ffa2540492883a6ccf4ada91ab24a5b3519652f0ea0d061aafc63b0d6bdb73ef3af2eeb13c36c081a0c876d75ee711c
7
+ data.tar.gz: 42344300ff9789b36ac74860167ba3338910a7aabffa8a38b9c3974b23425498302306109c2cd27ac86b9d43e55a32ed41d7e0d59de76df2173c86c924f6ead8
@@ -1,5 +1,10 @@
1
1
  # ChangeLog
2
2
 
3
+ ## 0.2.4
4
+
5
+ - Fix issue where wrong host-specific file would be installed.
6
+ - Only display installed messaged if unit was actually installed.
7
+
3
8
  ## 0.2.3
4
9
 
5
10
  - Fix bug where component would not install
@@ -137,10 +137,10 @@ module ConfigCurator
137
137
  # @param quiet [Boolean] suppress some {#logger} output
138
138
  # @return [Boolean] if unit was installed
139
139
  def install_unit(unit, type, quiet = false)
140
- unit.install
140
+ success = unit.install
141
141
  logger.info do
142
142
  "Installed #{type_name(type)}: #{unit.source} ⇨ #{unit.destination_path}"
143
- end unless quiet
143
+ end unless quiet || !success
144
144
  return true
145
145
 
146
146
  rescue Unit::InstallFailed => e
@@ -64,12 +64,21 @@ module ConfigCurator
64
64
 
65
65
  # Will look for files with the naming pattern `filename.hostname.ext`.
66
66
  # @param path [String] path to the non-host-specific file
67
+ # rubocop:disable Metrics/MethodLength
67
68
  def search_for_host_specific_file(path)
68
69
  directory = File.dirname path
70
+ filename = File.basename path
69
71
  extension = File.extname path
70
- basename = File.basename path.chomp(extension)
72
+ basename = filename.chomp(extension)
71
73
  if Dir.exist? directory
72
- file = Dir.entries(directory).grep(/^#{basename}.#{hostname.downcase}/).first
74
+ files = Dir.entries(directory)
75
+
76
+ file = files.grep(/^#{filename}\.#{hostname.downcase}$/).first
77
+ return File.join directory, file unless file.nil?
78
+
79
+ extension.gsub!(/^\./, '\.')
80
+ regex = /^#{basename}\.#{hostname.downcase}#{extension}$/
81
+ file = files.grep(regex).first
73
82
  return File.join directory, file unless file.nil?
74
83
  end
75
84
  nil
@@ -1,5 +1,5 @@
1
1
  # Simple and intelligent configuration file management.
2
2
  module ConfigCurator
3
3
  # Config Curator version.
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.4'
5
5
  end
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.2.3
4
+ version: 0.2.4
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: 2015-04-14 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport