configmonkey_cli 1.0.3 → 1.0.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
  SHA256:
3
- metadata.gz: b79152a88f58919cc9bc888e066f8e45e38151bd256819a6ddbf9d4f8b7b6fdb
4
- data.tar.gz: ff62a2d5f62f3ff1d90add227b5cf6553bc888a157d559dfaa587e7c494b4827
3
+ metadata.gz: 99ff31b49f67bac7cc9d0e1695fbf7fa21e33d288301994b47c8e4b7ab6742ab
4
+ data.tar.gz: 12aa92f2207ed7d6c748c04dedf8ce58d979e0c635e022b0aae6686f912b140b
5
5
  SHA512:
6
- metadata.gz: 0c0a8cdc332aa53f88a917f00fd5dfc73349a6ff77c9f95569776975a0c104824e27635ea8cf7f1653a37a6b13032ad5e21610325d7d6c780af9ce1110b760e7
7
- data.tar.gz: 79521949dd0f73e7b21e41e0f10080ae2749adf24a3a0769a404841bd960ade83e64da51a4de9c612323a09e450d777b8e629c1275048c62b3cf25a6c333c06e
6
+ metadata.gz: c500d71590fac066406dc47b6544ee0de098e881e7c6c5ac440b45d38fd48d2696ff886fa1d6da065b1e0fc6d78dd3b8ee052106149ad3e13dacb4e153a1d02e
7
+ data.tar.gz: 3200b1469a198e9dc067dd4d96d8fec97e2c0e4aa6bcf3ae9f6f4dc313bb788ae87f9d2fcbffa95106f67161a32fdc98756b7c7ff272d8ce23a8c65d0f12f5f6
data/README.md CHANGED
@@ -45,7 +45,7 @@ To get a list of available options invoke Configmonkey with the `--help` or `-h`
45
45
  # Application options
46
46
  --generate-manifest Generates an example manifest in current directory
47
47
  -a, --accept accept all defaults
48
- -b, --no-bell dont ring a bell when asked
48
+ -b, --bell ring a bell when asked
49
49
  -D, --diff change default diff tool
50
50
  -f, --fake-host HOST override hostname
51
51
  -i, --in DIR operate from this source directory instead of pwd
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -8,6 +8,7 @@ module ConfigmonkeyCli
8
8
  prefix: nil,
9
9
  map: "d:dp",
10
10
  hard: false,
11
+ exclude: [],
11
12
  })
12
13
  end
13
14
 
@@ -42,16 +43,35 @@ module ConfigmonkeyCli
42
43
  def destructive
43
44
  prefixed_sources = @sources.map do |src|
44
45
  File.join(@destination, "#{@prefix}#{File.basename(src)}")
45
- end
46
+ end.reject{|f| excluded?(f) }
46
47
 
47
48
  if @purge
48
49
  (Dir["#{File.join(@destination, @prefix)}*"] - prefixed_sources).each do |f|
49
50
  thor.remove_file(f)
51
+ # @todo fix for https://github.com/erikhuda/thor/pull/720
52
+ ::FileUtils.rm_rf(f) if File.symlink?(f)
50
53
  end
51
54
  end
52
55
 
53
56
  @sources.each do |src|
54
- thor.create_link("#{@destination}/#{@prefix}#{File.basename(src)}", src, @opts)
57
+ if r = excluded?(src)
58
+ status :excluded, :black, rel(src) << c(" #{r.inspect}", :black)
59
+ else
60
+ thor.create_link("#{@destination}/#{@prefix}#{File.basename(src)}", src, @opts)
61
+ end
62
+ end
63
+ end
64
+
65
+ def excluded? src
66
+ [*@opts[:exclude]].detect do |filter|
67
+ case filter
68
+ when Proc
69
+ filter.call(src)
70
+ when Regexp
71
+ src.match(filter)
72
+ when String
73
+ src.ends_with?(filter)
74
+ end
55
75
  end
56
76
  end
57
77
  end
@@ -41,7 +41,7 @@ module ConfigmonkeyCli
41
41
  hostname: `hostname`.chomp, # -f flag
42
42
  diff_tool: nil, # -D flag
43
43
  merge_tool: nil, # -M flag
44
- bell: true, # -b flag
44
+ bell: false, # -b flag
45
45
  default_accept: false, # -a flag
46
46
  default_yes: false, # -y flag
47
47
  dispatch: :index, # (internal) action to dispatch
@@ -106,7 +106,7 @@ module ConfigmonkeyCli
106
106
  opts.separator(c "# Application options", :blue)
107
107
  opts.on("--generate-manifest", "Generates an example manifest in current directory") { @opts[:dispatch] = :generate_manifest }
108
108
  opts.on("-a", "--accept", "accept all defaults") { @opts[:default_accept] = true }
109
- opts.on("-b", "--no-bell", "dont ring a bell when asked") { @opts[:bell] = false }
109
+ opts.on("-b", "--bell", "dont ring a bell when asked") { @opts[:bell] = true }
110
110
  opts.on("-D", "--diff", "change default diff tool") {|s| @opts[:diff_tool] = s }
111
111
  opts.on("-f", "--fake-host HOST", "override hostname") {|s| @opts[:hostname] = s }
112
112
  opts.on("-i", "--in DIR", "operate from this source directory instead of pwd") {|s| @opts[:working_directory] = s }
@@ -1,4 +1,4 @@
1
1
  module ConfigmonkeyCli
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  UPDATE_URL = "https://raw.githubusercontent.com/2called-chaos/configmonkey_cli/master/VERSION"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configmonkey_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Pachnit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-25 00:00:00.000000000 Z
11
+ date: 2020-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport