config_curator 0.2.4 → 0.3.0
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 +2 -3
- data/CHANGELOG.md +6 -0
- data/README.md +68 -36
- data/config_curator.gemspec +1 -1
- data/lib/config_curator/collection.rb +6 -6
- data/lib/config_curator/unit.rb +18 -0
- data/lib/config_curator/units/component.rb +15 -2
- data/lib/config_curator/units/config_file.rb +13 -0
- data/lib/config_curator/units/symlink.rb +13 -0
- data/lib/config_curator/version.rb +1 -1
- data/spec/spec_helper.rb +7 -6
- data/spec/unit_spec.rb +71 -0
- data/spec/units/component_spec.rb +18 -0
- data/spec/units/config_file_spec.rb +18 -0
- data/spec/units/symlink_spec.rb +18 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60147ff36c757ecf906de200cfee1119dc440f33
|
4
|
+
data.tar.gz: fee2526348a940b0c24868f3cbb70c0a5ff52179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e38e6a073ea040e258bddcd6d768e1c874dc13487cbc0f8fef0d1d0c46c32e6eacc3fe8c4d55900ff2aca8a1ce74b7f9bf14f749a6461bd6218dfcc8f9af0ad2
|
7
|
+
data.tar.gz: d7b8d47e299d248d4d9e29e6e693a9ee04920ae9482036eb614f6811ec7791d5a8b1b5a542a7c4d650a4fafa176d8b76b1e4cf0fdeb545ff559a915b2f972dc6
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Config Curator
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/config_curator)
|
4
|
-
[](./LICENSE.txt)
|
5
5
|
[](https://gemnasium.com/razor-x/config_curator)
|
6
6
|
[](https://travis-ci.org/razor-x/config_curator)
|
7
|
-
[](https://codecov.io/github/razor-x/config_curator)
|
8
8
|
[](https://codeclimate.com/github/razor-x/config_curator)
|
9
9
|
|
10
10
|
by Evan Boyd Sosenko.
|
@@ -30,6 +30,24 @@ e.g., file, directory, symbolic link, etc.,
|
|
30
30
|
is actually a subclass of the more generic `Unit` type.
|
31
31
|
Other types can be added simply by adding more subclasses.
|
32
32
|
|
33
|
+
## Quick start
|
34
|
+
|
35
|
+
1. Install the `config_curator` gem
|
36
|
+
(make sure installed gem binaries are in your PATH).
|
37
|
+
|
38
|
+
2. Create a `manifest.yml` file, e.g.,
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
config_files:
|
42
|
+
- src: .config/git/config
|
43
|
+
```
|
44
|
+
|
45
|
+
3. Add `.config/git/config` to your project and run
|
46
|
+
|
47
|
+
```bash
|
48
|
+
$ curate -v
|
49
|
+
```
|
50
|
+
|
33
51
|
## Usage
|
34
52
|
|
35
53
|
### The `manifest.yml` file
|
@@ -45,7 +63,7 @@ or a unit type: `components`, `config_files`, or `symlinks`.
|
|
45
63
|
Optional global Config Curator settings.
|
46
64
|
Defaults listed below.
|
47
65
|
|
48
|
-
|
66
|
+
```yaml
|
49
67
|
# All units installed relative to the root.
|
50
68
|
root: "~/"
|
51
69
|
|
@@ -53,7 +71,7 @@ root: "~/"
|
|
53
71
|
# Will automatically detect if not explicitly set.
|
54
72
|
# Available tools: pacman, dpkg, pkgng.
|
55
73
|
package_tool:
|
56
|
-
|
74
|
+
```
|
57
75
|
|
58
76
|
#### `defaults`
|
59
77
|
|
@@ -64,7 +82,7 @@ Any per-unit attribute will override the value here.
|
|
64
82
|
Any attribute not set here will use
|
65
83
|
the Config Curator defined defaults below.
|
66
84
|
|
67
|
-
|
85
|
+
```yaml
|
68
86
|
defaults:
|
69
87
|
# File and directory permissions.
|
70
88
|
# Empty values will not change permissions.
|
@@ -83,7 +101,7 @@ defaults:
|
|
83
101
|
# Only install this unit if packages are present.
|
84
102
|
# Empty array will not check for any packages.
|
85
103
|
packages: []
|
86
|
-
|
104
|
+
```
|
87
105
|
|
88
106
|
#### Units
|
89
107
|
|
@@ -109,7 +127,7 @@ Components are installed before other units.
|
|
109
127
|
The source will be mirrored to the destination.
|
110
128
|
**Any existing files in the destination will be lost.**
|
111
129
|
|
112
|
-
|
130
|
+
```yaml
|
113
131
|
components:
|
114
132
|
- src: .config/terminator
|
115
133
|
|
@@ -118,7 +136,7 @@ components:
|
|
118
136
|
fmode: 640
|
119
137
|
dmode: 0750
|
120
138
|
packages: [ tmux ]
|
121
|
-
|
139
|
+
```
|
122
140
|
|
123
141
|
##### Config files are copied individually
|
124
142
|
|
@@ -130,7 +148,7 @@ In this example, the files `.tmux.conf` and `.tmux.baz.conf` both exist:
|
|
130
148
|
the first will be installed on hosts `foo` and `bar`,
|
131
149
|
while the second will be installed on host `baz`.
|
132
150
|
|
133
|
-
|
151
|
+
```yaml
|
134
152
|
config_files:
|
135
153
|
- src: .gitconfig
|
136
154
|
- src: .bundle/config
|
@@ -142,7 +160,7 @@ config_files:
|
|
142
160
|
|
143
161
|
- src: .tmux.conf
|
144
162
|
hosts: [ foo, bar, baz ]
|
145
|
-
|
163
|
+
```
|
146
164
|
|
147
165
|
##### Symlinks
|
148
166
|
|
@@ -150,26 +168,26 @@ Symlinks create a symbolic link to the `src` at the `dst`.
|
|
150
168
|
|
151
169
|
They are installed last.
|
152
170
|
|
153
|
-
|
171
|
+
```yaml
|
154
172
|
symlinks:
|
155
173
|
- src: ~/Wallpaper/tux.png
|
156
174
|
dst: .config/awesome/wall.png
|
157
175
|
packages: [ awesome ]
|
158
|
-
|
176
|
+
```
|
159
177
|
|
160
178
|
### The `curate` command
|
161
179
|
|
162
180
|
Once you have prepared your manifest, simply run
|
163
181
|
|
164
|
-
|
182
|
+
```bash
|
165
183
|
$ curate
|
166
|
-
|
184
|
+
```
|
167
185
|
|
168
186
|
Or if you prefer more verbose feedback
|
169
187
|
|
170
|
-
|
188
|
+
```bash
|
171
189
|
$ curate -v
|
172
|
-
|
190
|
+
```
|
173
191
|
|
174
192
|
You can always get help with
|
175
193
|
|
@@ -186,12 +204,25 @@ Options:
|
|
186
204
|
[--debug], [--no-debug]
|
187
205
|
```
|
188
206
|
|
207
|
+
#### Uninstalling units
|
208
|
+
|
209
|
+
Currently all units have an uninstall method.
|
210
|
+
Smart uninstall via `curate uninstall` is planned for an
|
211
|
+
[upcoming release](https://github.com/razor-x/config_curator/issues/7).
|
212
|
+
|
189
213
|
### Scripting
|
190
214
|
|
191
215
|
Config Curator is fully scriptable for easy inclusion into other Ruby programs.
|
192
216
|
The API is well documented for this purpose
|
193
217
|
(see [Documentation](#documentation) above).
|
194
218
|
|
219
|
+
### Plugins
|
220
|
+
|
221
|
+
Plugin support is
|
222
|
+
[planned for an upcoming release](https://github.com/razor-x/config_curator/issues/8).
|
223
|
+
If you like Config Curator and want to write a plugin,
|
224
|
+
please let me know!
|
225
|
+
|
195
226
|
## Installation
|
196
227
|
|
197
228
|
You can install the gem either with Bundler or directly.
|
@@ -203,21 +234,21 @@ along with `manifest.yml` into version control.
|
|
203
234
|
|
204
235
|
Add this line to your application's Gemfile:
|
205
236
|
|
206
|
-
|
237
|
+
```ruby
|
207
238
|
gem 'config_curator'
|
208
|
-
|
239
|
+
```
|
209
240
|
|
210
241
|
And then execute:
|
211
242
|
|
212
|
-
|
243
|
+
```bash
|
213
244
|
$ bundle
|
214
|
-
|
245
|
+
```
|
215
246
|
|
216
247
|
Or install it yourself as:
|
217
248
|
|
218
|
-
|
249
|
+
```bash
|
219
250
|
$ gem install config_curator
|
220
|
-
|
251
|
+
```
|
221
252
|
|
222
253
|
## Documentation
|
223
254
|
|
@@ -225,8 +256,8 @@ The primary documentation for Config Curator is this README and the YARD source
|
|
225
256
|
|
226
257
|
YARD documentation for all gem versions is hosted on the
|
227
258
|
[Config Curator gem page](https://rubygems.org/gems/config_curator).
|
228
|
-
|
229
|
-
[
|
259
|
+
Also checkout
|
260
|
+
[Omniref's interactive documentation](https://www.omniref.com/ruby/gems/config_curator).
|
230
261
|
|
231
262
|
## Development and Testing
|
232
263
|
|
@@ -236,30 +267,31 @@ The [Config Curator source](https://github.com/razor-x/config_curator)
|
|
236
267
|
is hosted on GitHub.
|
237
268
|
To clone the project run
|
238
269
|
|
239
|
-
|
270
|
+
```bash
|
240
271
|
$ git clone https://github.com/razor-x/config_curator.git
|
241
|
-
|
272
|
+
```
|
242
273
|
|
243
274
|
### Rake
|
244
275
|
|
245
276
|
Run `rake -T` to see all Rake tasks.
|
246
277
|
|
247
|
-
|
278
|
+
```
|
248
279
|
rake all # Run all tasks
|
249
|
-
rake build # Build config_curator-0.
|
250
|
-
rake bump:current
|
251
|
-
rake bump:major
|
252
|
-
rake bump:minor
|
253
|
-
rake bump:patch
|
254
|
-
rake bump:pre
|
280
|
+
rake build # Build config_curator-0.3.0.gem into the pkg directory
|
281
|
+
rake bump:current[tag] # Show current gem version
|
282
|
+
rake bump:major[tag] # Bump major part of gem version
|
283
|
+
rake bump:minor[tag] # Bump minor part of gem version
|
284
|
+
rake bump:patch[tag] # Bump patch part of gem version
|
285
|
+
rake bump:pre[tag] # Bump pre part of gem version
|
255
286
|
rake bump:set # Sets the version number using the VERSION environment variable
|
256
|
-
rake install # Build and install config_curator-0.
|
257
|
-
rake
|
287
|
+
rake install # Build and install config_curator-0.3.0.gem into system gems
|
288
|
+
rake install:local # Build and install config_curator-0.3.0.gem into system gems without network access
|
289
|
+
rake release # Create tag v0.3.0 and build and push config_curator-0.3.0.gem to Rubygems
|
258
290
|
rake rubocop # Run RuboCop
|
259
291
|
rake rubocop:auto_correct # Auto-correct RuboCop offenses
|
260
292
|
rake spec # Run RSpec code examples
|
261
293
|
rake yard # Generate YARD Documentation
|
262
|
-
|
294
|
+
```
|
263
295
|
|
264
296
|
### Guard
|
265
297
|
|
data/config_curator.gemspec
CHANGED
@@ -41,6 +41,6 @@ Gem::Specification.new do |spec|
|
|
41
41
|
|
42
42
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
43
43
|
spec.add_development_dependency 'simplecov', '~> 0.9'
|
44
|
-
spec.add_development_dependency '
|
44
|
+
spec.add_development_dependency 'codecov', '~> 0.1'
|
45
45
|
spec.add_development_dependency 'fuubar', '~> 2.0'
|
46
46
|
end
|
@@ -143,9 +143,9 @@ module ConfigCurator
|
|
143
143
|
end unless quiet || !success
|
144
144
|
return true
|
145
145
|
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
rescue Unit::InstallFailed => e
|
147
|
+
logger.fatal { "Halting install! Install attempt failed for #{type_name(type)}: #{e}" }
|
148
|
+
return false
|
149
149
|
end
|
150
150
|
|
151
151
|
# Checks if a unit can be installed.
|
@@ -161,9 +161,9 @@ module ConfigCurator
|
|
161
161
|
end unless quiet
|
162
162
|
return true
|
163
163
|
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
rescue Unit::InstallFailed => e
|
165
|
+
logger.error { "Cannot install #{type_name(type)}: #{e}" }
|
166
|
+
return false
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
data/lib/config_curator/unit.rb
CHANGED
@@ -18,6 +18,9 @@ module ConfigCurator
|
|
18
18
|
# Unit installed relative to this path.
|
19
19
|
root: Dir.home,
|
20
20
|
|
21
|
+
# Automatically uninstall units that would not be installed.
|
22
|
+
uninstall: false,
|
23
|
+
|
21
24
|
# Package tool to use. See #package_lookup.
|
22
25
|
package_tool: nil
|
23
26
|
}
|
@@ -73,7 +76,22 @@ module ConfigCurator
|
|
73
76
|
@package_lookup ||= PackageLookup.new tool: options[:package_tool]
|
74
77
|
end
|
75
78
|
|
79
|
+
# Uninstalls the unit.
|
80
|
+
# @return [Boolean] if the unit was uninstalled
|
81
|
+
def uninstall(force: false)
|
82
|
+
return true if uninstall? || force
|
83
|
+
false
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks if the unit should be uninstalled.
|
87
|
+
# @return [Boolean] if the unit should be uninstalled
|
88
|
+
def uninstall?
|
89
|
+
return true if !install? && options[:uninstall]
|
90
|
+
false
|
91
|
+
end
|
92
|
+
|
76
93
|
# Installs the unit.
|
94
|
+
# @return [Boolean] if the unit was installed
|
77
95
|
def install
|
78
96
|
return false unless install?
|
79
97
|
true
|
@@ -8,6 +8,14 @@ module ConfigCurator
|
|
8
8
|
class Component < Unit
|
9
9
|
attr_accessor :fmode, :dmode, :owner, :group
|
10
10
|
|
11
|
+
# (see Unit#uninstall)
|
12
|
+
def uninstall(*args)
|
13
|
+
s = super(*args)
|
14
|
+
return s unless s
|
15
|
+
uninstall_component
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
11
19
|
# (see Unit#install)
|
12
20
|
def install
|
13
21
|
s = super
|
@@ -30,13 +38,18 @@ module ConfigCurator
|
|
30
38
|
|
31
39
|
private
|
32
40
|
|
41
|
+
# Uninstalls the component by removing the directory.
|
42
|
+
def uninstall_component
|
43
|
+
FileUtils.remove_entry_secure destination_path if Dir.exist? destination_path
|
44
|
+
end
|
45
|
+
|
33
46
|
# Recursively creates the necessary directories and installs the component.
|
34
47
|
# Any files in the install directory not in the source directory are removed.
|
35
48
|
# Use rsync if available.
|
36
49
|
def install_component
|
37
50
|
if command? 'rsync'
|
38
51
|
FileUtils.mkdir_p destination_path
|
39
|
-
cmd = [command?('rsync'), '-
|
52
|
+
cmd = [command?('rsync'), '-rtc', '--del', '--links', "#{source_path}/", destination_path]
|
40
53
|
logger.debug { "Running command: #{cmd.join ' '}" }
|
41
54
|
system(*cmd)
|
42
55
|
else
|
@@ -56,7 +69,7 @@ module ConfigCurator
|
|
56
69
|
|
57
70
|
{fmode: 'f', dmode: 'd'}.each do |k, v|
|
58
71
|
next if send(k).nil?
|
59
|
-
cmd = [find,
|
72
|
+
cmd = [find, destination_path, '-type', v, '-exec']
|
60
73
|
cmd.concat [chmod, send(k).to_s(8), '{}', '+']
|
61
74
|
logger.debug { "Running command: #{cmd.join ' '}" }
|
62
75
|
system(*cmd)
|
@@ -23,6 +23,14 @@ module ConfigCurator
|
|
23
23
|
@destination ||= @source
|
24
24
|
end
|
25
25
|
|
26
|
+
# (see Unit#uninstall)
|
27
|
+
def uninstall(*args)
|
28
|
+
s = super(*args)
|
29
|
+
return s unless s
|
30
|
+
uninstall_file
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
26
34
|
# (see Unit#install)
|
27
35
|
def install
|
28
36
|
s = super
|
@@ -44,6 +52,11 @@ module ConfigCurator
|
|
44
52
|
|
45
53
|
private
|
46
54
|
|
55
|
+
# Uninstalls the file by removing it.
|
56
|
+
def uninstall_file
|
57
|
+
FileUtils.remove_entry_secure destination_path if File.exist? destination_path
|
58
|
+
end
|
59
|
+
|
47
60
|
# Recursively creates the necessary directories and install the file.
|
48
61
|
def install_file
|
49
62
|
FileUtils.mkdir_p File.dirname(destination_path)
|
@@ -3,6 +3,14 @@ module ConfigCurator
|
|
3
3
|
# The {#destination_path} will be a link
|
4
4
|
# that points to the {#source_path}.
|
5
5
|
class Symlink < Unit
|
6
|
+
# (see Unit#uninstall)
|
7
|
+
def uninstall(*args)
|
8
|
+
s = super(*args)
|
9
|
+
return s unless s
|
10
|
+
uninstall_symlink
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
6
14
|
# (see Unit#install)
|
7
15
|
def install
|
8
16
|
s = super
|
@@ -22,6 +30,11 @@ module ConfigCurator
|
|
22
30
|
|
23
31
|
private
|
24
32
|
|
33
|
+
# Uninstalls the symlink by removing it.
|
34
|
+
def uninstall_symlink
|
35
|
+
FileUtils.remove_entry_secure destination_path if File.exist? destination_path
|
36
|
+
end
|
37
|
+
|
25
38
|
# Recursively creates the necessary directories and make the symlink.
|
26
39
|
def install_symlink
|
27
40
|
FileUtils.mkdir_p File.dirname(destination_path)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
require 'coveralls'
|
2
1
|
require 'simplecov'
|
3
2
|
|
4
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
-
SimpleCov::Formatter::HTMLFormatter,
|
6
|
-
Coveralls::SimpleCov::Formatter
|
7
|
-
]
|
8
|
-
|
9
3
|
SimpleCov.start
|
10
4
|
|
5
|
+
if ENV['CI'] == 'true'
|
6
|
+
require 'codecov'
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
8
|
+
else
|
9
|
+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
10
|
+
end
|
11
|
+
|
11
12
|
require 'config_curator'
|
12
13
|
|
13
14
|
RSpec.configure do |c|
|
data/spec/unit_spec.rb
CHANGED
@@ -91,6 +91,55 @@ describe ConfigCurator::Unit do
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
describe "#uninstall" do
|
95
|
+
context "when unit should be uninstalled" do
|
96
|
+
it "returns true" do
|
97
|
+
expect(unit).to receive(:uninstall?).and_return(true)
|
98
|
+
expect(unit.uninstall).to be true
|
99
|
+
end
|
100
|
+
|
101
|
+
it "returns true when uninstall is forced" do
|
102
|
+
expect(unit).to receive(:uninstall?).and_return(false)
|
103
|
+
expect(unit.uninstall force: true).to be true
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "when unit should not be uninstalled" do
|
108
|
+
it "returns false" do
|
109
|
+
expect(unit).to receive(:uninstall?).and_return(false)
|
110
|
+
expect(unit.uninstall).to be false
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "#uninstall?" do
|
116
|
+
context "unit should not be installed" do
|
117
|
+
it "returns false by default" do
|
118
|
+
expect(unit).to receive(:install?).and_return(false)
|
119
|
+
expect(unit.uninstall?).to be false
|
120
|
+
end
|
121
|
+
|
122
|
+
it "returns true when uninstall option is set" do
|
123
|
+
unit.options[:uninstall] = true
|
124
|
+
expect(unit).to receive(:install?).and_return(false)
|
125
|
+
expect(unit.uninstall?).to be true
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context "unit should be installed" do
|
130
|
+
it "returns false" do
|
131
|
+
expect(unit).to receive(:install?).and_return(true)
|
132
|
+
expect(unit.uninstall?).to be false
|
133
|
+
end
|
134
|
+
|
135
|
+
it "returns false when uninstall option is set" do
|
136
|
+
unit.options[:uninstall] = true
|
137
|
+
expect(unit).to receive(:install?).and_return(true)
|
138
|
+
expect(unit.uninstall?).to be false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
94
143
|
describe "#install" do
|
95
144
|
context "when unit should be installed" do
|
96
145
|
it "returns true" do
|
@@ -117,6 +166,28 @@ describe ConfigCurator::Unit do
|
|
117
166
|
expect(unit).to receive(:packages_installed?)
|
118
167
|
unit.install?
|
119
168
|
end
|
169
|
+
|
170
|
+
context "when requirements are met" do
|
171
|
+
it "returns true" do
|
172
|
+
expect(unit).to receive(:allowed_host?).and_return(true)
|
173
|
+
expect(unit).to receive(:packages_installed?).and_return(true)
|
174
|
+
expect(unit.install?).to be true
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
context "when not on an allowed host" do
|
179
|
+
it "returns false" do
|
180
|
+
expect(unit).to receive(:allowed_host?).and_return(false)
|
181
|
+
expect(unit.install?).to be false
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
context "when required packages are not installed" do
|
186
|
+
it "returns false" do
|
187
|
+
expect(unit).to receive(:packages_installed?).and_return(false)
|
188
|
+
expect(unit.install?).to be false
|
189
|
+
end
|
190
|
+
end
|
120
191
|
end
|
121
192
|
|
122
193
|
describe "#allowed_host?" do
|
@@ -3,6 +3,24 @@ require 'spec_helper'
|
|
3
3
|
describe ConfigCurator::Component do
|
4
4
|
subject(:component) { ConfigCurator::Component.new }
|
5
5
|
|
6
|
+
describe "#uninstall" do
|
7
|
+
context "when component should be uninstalled" do
|
8
|
+
it "uninstalls the component and returns true" do
|
9
|
+
expect(component).to receive(:uninstall?).and_return(true)
|
10
|
+
expect(component).to receive(:uninstall_component)
|
11
|
+
expect(component.uninstall).to be true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "when component should not be uninstalled" do
|
16
|
+
it "does not uninstall the component and returns false" do
|
17
|
+
expect(component).to receive(:uninstall?).and_return(false)
|
18
|
+
expect(component).to_not receive(:uninstall_component)
|
19
|
+
expect(component.uninstall).to be false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
6
24
|
describe "#install" do
|
7
25
|
context "when component should be installed" do
|
8
26
|
it "installs the component and returns true" do
|
@@ -45,6 +45,24 @@ describe ConfigCurator::ConfigFile do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
describe "#uninstall" do
|
49
|
+
context "when config file should be uninstalled" do
|
50
|
+
it "uninstalls the config file and returns true" do
|
51
|
+
expect(config_file).to receive(:uninstall?).and_return(true)
|
52
|
+
expect(config_file).to receive(:uninstall_file)
|
53
|
+
expect(config_file.uninstall).to be true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "when config file should not be uninstalled" do
|
58
|
+
it "does not uninstall the config file and returns false" do
|
59
|
+
expect(config_file).to receive(:uninstall?).and_return(false)
|
60
|
+
expect(config_file).to_not receive(:uninstall_file)
|
61
|
+
expect(config_file.uninstall).to be false
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
48
66
|
describe "#install" do
|
49
67
|
context "when config file should be installed" do
|
50
68
|
it "installs the config file and returns true" do
|
data/spec/units/symlink_spec.rb
CHANGED
@@ -3,6 +3,24 @@ require 'spec_helper'
|
|
3
3
|
describe ConfigCurator::Symlink do
|
4
4
|
subject(:symlink) { ConfigCurator::Symlink.new }
|
5
5
|
|
6
|
+
describe "#uninstall" do
|
7
|
+
context "when symlink should be uninstalled" do
|
8
|
+
it "uninstalls the symlink and returns true" do
|
9
|
+
expect(symlink).to receive(:uninstall?).and_return(true)
|
10
|
+
expect(symlink).to receive(:uninstall_symlink)
|
11
|
+
expect(symlink.uninstall).to be true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "when symlink should not be uninstalled" do
|
16
|
+
it "does not uninstall the symlink and returns false" do
|
17
|
+
expect(symlink).to receive(:uninstall?).and_return(false)
|
18
|
+
expect(symlink).to_not receive(:uninstall_symlink)
|
19
|
+
expect(symlink.uninstall).to be false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
6
24
|
describe "#install" do
|
7
25
|
context "when symbolic link should be installed" do
|
8
26
|
it "installs the symbolic link and returns true" do
|
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.
|
4
|
+
version: 0.3.0
|
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-
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -235,19 +235,19 @@ dependencies:
|
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0.9'
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
238
|
+
name: codecov
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
241
|
- - "~>"
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: '0.
|
243
|
+
version: '0.1'
|
244
244
|
type: :development
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
248
|
- - "~>"
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version: '0.
|
250
|
+
version: '0.1'
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
252
|
name: fuubar
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|