effuse 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/ChangeLog.md +6 -0
  2. data/README.md +2 -0
  3. data/bin/effuse +34 -23
  4. data/effuse.gemspec +1 -1
  5. metadata +2 -2
data/ChangeLog.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.3.0 (23 January 2012)
4
+
5
+ * Added `--noconfirm` option
6
+
7
+ * Fix: Ruby 1.8 compatibility
8
+
3
9
  ## 0.2.0 (22 January 2012)
4
10
 
5
11
  * Added `--include` option
data/README.md CHANGED
@@ -40,6 +40,8 @@ Usage: effuse [OPTION...] [DEST]
40
40
  -e, --exclude GLOB Exclude GLOB from symlinking
41
41
  -i, --include GLOB Include GLOB in symlinking
42
42
 
43
+ -y, --noconfirm CHOICE Assume CHOICE on file conflicts
44
+
43
45
  -v, --verbose Show verbose output
44
46
  -h, --help Show this message
45
47
  ```
data/bin/effuse CHANGED
@@ -4,7 +4,7 @@ require 'optparse'
4
4
  require 'ostruct'
5
5
  require 'fileutils'
6
6
 
7
- options = OpenStruct.new(:verbose => false, :exclude => ['.git', '.gitignore', '.gitmodules', '*~', '.*.swp'], :clean => false)
7
+ options = OpenStruct.new(:verbose => false, :exclude => ['.git', '.gitignore', '.gitmodules', '*~', '.*.swp'], :clean => false, :noconfirm => nil)
8
8
 
9
9
  OptionParser.new do |o|
10
10
  o.banner = 'Usage: effuse [OPTION...] [DEST]'
@@ -25,6 +25,12 @@ OptionParser.new do |o|
25
25
 
26
26
  o.separator ''
27
27
 
28
+ o.on('-y', '--noconfirm CHOICE', 'Assume CHOICE on file conflicts') do |choice|
29
+ options.noconfirm = choice.downcase[0].chr # Shakes fist at Ruby 1.8 (.chr)
30
+ end
31
+
32
+ o.separator ''
33
+
28
34
  o.on('-v', '--verbose', 'Show verbose output') do
29
35
  options.verbose = true
30
36
  end
@@ -80,30 +86,35 @@ else
80
86
  puts "already symlinked #{dest}" if options.verbose
81
87
  next
82
88
  else
83
- puts "File already exists: #{dest}"
84
- puts " [R] Backup and replace"
85
- puts " [i] Import original file and symlink"
86
- puts " [k] Keep original file"
87
-
88
- skip = false
89
- loop do
90
- case gets.chomp.downcase[0] || 'r'
91
- when 'r'
92
- puts "renaming #{dest} -> #{dest + '~'}" if options.verbose
93
- File.rename(dest, dest + '~')
94
- break
95
- when 'i'
96
- puts "renaming #{src} -> #{src + '~'}" if options.verbose
97
- File.rename(src, src + '~')
98
- puts "renaming #{dest} -> #{src}" if options.verbose
99
- File.rename(dest, src)
100
- break
101
- when 'k'
102
- skip = true
103
- break
89
+ if options.noconfirm
90
+ input = options.noconfirm
91
+ puts "assuming '#{input}' for #{dest}" if options.verbose
92
+ else
93
+ puts "File already exists: #{dest}"
94
+ puts " [R] Backup and replace"
95
+ puts " [i] Import original file and symlink"
96
+ puts " [k] Keep original file"
97
+
98
+ loop do
99
+ input = gets.chomp.downcase[0].chr || 'r' # Shakes fist at Ruby 1.8 (.chr)
100
+ break if 'rik'.include?(input)
101
+ puts "Error: '#{input}' is not an option"
104
102
  end
105
103
  end
106
- next if skip
104
+
105
+ case input
106
+ when 'r'
107
+ puts "renaming #{dest} -> #{dest + '~'}" if options.verbose
108
+ File.rename(dest, dest + '~')
109
+ when 'i'
110
+ puts "renaming #{src} -> #{src + '~'}" if options.verbose
111
+ File.rename(src, src + '~')
112
+ puts "renaming #{dest} -> #{src}" if options.verbose
113
+ File.rename(dest, src)
114
+ when 'k'
115
+ puts "skipping #{dest}" if options.verbose
116
+ next
117
+ end
107
118
  end
108
119
  end
109
120
 
data/effuse.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'effuse'
3
- s.version = '0.2.0'
3
+ s.version = '0.3.0'
4
4
  s.authors = ['Curtis McEnroe']
5
5
  s.email = ['programble@gmail.com']
6
6
  s.homepage = 'https://github.com/programble/effuse'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-22 00:00:00.000000000 Z
12
+ date: 2012-01-24 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A tool for managing symlinks
15
15
  email: