wycats-thor 0.10.26 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,23 +53,35 @@ class Thor
53
53
  end
54
54
 
55
55
  def invoke!
56
- base.empty_directory given_destination
57
- lookup = recursive ? File.join(source, '**', '*') : File.join(source, '*')
56
+ raise "Source #{source.inspect} does not exist" unless File.exists?(source)
57
+ base.empty_directory given_destination, @log_status
58
+ execute!
59
+ end
60
+
61
+ def revoke!
62
+ execute!
63
+ end
58
64
 
59
- Dir[lookup].each do |file_source|
60
- file_destination = File.join(given_destination, file_source.gsub(source, '.'))
65
+ protected
61
66
 
62
- if File.directory?(file_source)
63
- base.empty_directory(file_destination, @log_status) if recursive
64
- elsif file_source !~ /\.empty_directory$/
65
- if file_source =~ /\.tt$/
66
- base.template(file_source, file_destination[0..-4], @log_status)
67
- else
68
- base.copy_file(file_source, file_destination, @log_status)
67
+ def execute!
68
+ lookup = recursive ? File.join(source, '**') : source
69
+ lookup = File.join(lookup, '{*,.[a-z]*}')
70
+
71
+ Dir[lookup].each do |file_source|
72
+ file_destination = File.join(given_destination, file_source.gsub(source, '.'))
73
+ next if File.directory?(file_source)
74
+
75
+ case file_source
76
+ when /\.empty_directory$/
77
+ base.empty_directory(File.dirname(file_destination), @log_status)
78
+ when /\.tt$/
79
+ base.template(file_source, file_destination[0..-4], @log_status)
80
+ else
81
+ base.copy_file(file_source, file_destination, @log_status)
69
82
  end
70
83
  end
71
84
  end
72
- end
73
85
 
74
86
  end
75
87
  end
@@ -75,14 +75,14 @@ class Thor
75
75
  def output_diff_line(diff)
76
76
  case diff.action
77
77
  when '-'
78
- say "- #{diff.old_element.chomp}", :red
78
+ say "- #{diff.old_element.chomp}", :red, true
79
79
  when '+'
80
- say "+ #{diff.new_element.chomp}", :green
80
+ say "+ #{diff.new_element.chomp}", :green, true
81
81
  when '!'
82
- say "- #{diff.old_element.chomp}", :red
83
- say "+ #{diff.new_element.chomp}", :green
82
+ say "- #{diff.old_element.chomp}", :red, true
83
+ say "+ #{diff.new_element.chomp}", :green, true
84
84
  else
85
- say " #{diff.old_element.chomp}"
85
+ say " #{diff.old_element.chomp}", nil, true
86
86
  end
87
87
  end
88
88
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wycats-thor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.26
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-04 00:00:00 -07:00
12
+ date: 2009-07-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15