effective_developer 0.2.6 → 0.2.7

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: 22b439e6da5070f38393dcbc0f876b8c3d74899b
4
- data.tar.gz: 894e2abe799d458168fc1ae9f6a11e34912b2b20
3
+ metadata.gz: 74c38f7ee20c5522dcff4f6b2a6a1e58c8031f19
4
+ data.tar.gz: e9111fe494d48ed6d024bca15dbc435ff3d19e9a
5
5
  SHA512:
6
- metadata.gz: 2c521f4a6caa21afbdc021a518b67771483ea3306dae2f222fcf56d9132f1596941462f0227f69285a212d9add5737e0bbfa4d344afb0fe906e9048d3b59a5bb
7
- data.tar.gz: 59e2a645d664051e457e7a99321bf2482cbda6b96489da30bc1284f6432afe1f48eea1705906670327298328ecb2d3e4f8c52d1135d1dcd844c226c02dd3fd7d
6
+ metadata.gz: 6e65b13b9a3030f2853bec4aaecf5c2b0d21b8a0a349f59cb93e1051ce80ae4bc3ba7510284e79d2c13e548dd28549ae102f1d6abeff6562652e4fa01dbd6d60
7
+ data.tar.gz: f20cbb3501f214a4981eedf971cd4102537f89fd710493b8fabac95e1b2eb5556885102dc5f1515764b56812322199e91c0ebd3d39448df8e37ee5a0d6d36cb1
@@ -1,3 +1,3 @@
1
1
  module EffectiveDeveloper
2
- VERSION = '0.2.6'.freeze
2
+ VERSION = '0.2.7'.freeze
3
3
  end
@@ -11,7 +11,7 @@ task :rename_class, [:source, :target, :db] => :environment do |t, args|
11
11
 
12
12
  puts "=== Renaming class '#{source.classify}' to '#{target.classify}'"
13
13
 
14
- whitelist = ['app/', 'db/', 'lib/', 'test/'].compact
14
+ whitelist = ['app/', 'config/routes.rb', 'config/locales/', 'db/', 'lib/', 'test/'].compact
15
15
  blacklist = ['db/schema.rb', ('db/migrate' if args.db == 'skipdb')].compact
16
16
 
17
17
  # Rename any directories in the app
@@ -28,7 +28,7 @@ task :rename_class, [:source, :target, :db] => :environment do |t, args|
28
28
  end
29
29
  end
30
30
 
31
- # For every file in the app
31
+ # Rename any files in the app
32
32
  Dir.glob('**/*.*').each do |path|
33
33
  next unless whitelist.any? { |ok| path.start_with?(ok) }
34
34
  next if blacklist.any? { |nope| path.start_with?(nope) }
@@ -41,16 +41,24 @@ task :rename_class, [:source, :target, :db] => :environment do |t, args|
41
41
  end
42
42
  end
43
43
 
44
- # For every file in the app
44
+ # Search and replace in all files
45
+ subs = {
46
+ source.classify.pluralize => target.classify.pluralize,
47
+ source.classify => target.classify,
48
+ source.pluralize => target.pluralize,
49
+ source => target
50
+ }
51
+
52
+ if source.include?('_')
53
+ subs[source.gsub('_', '-')] ||= target
54
+ end
55
+
45
56
  Dir.glob('**/*.*').each do |path|
46
57
  next unless whitelist.any? { |ok| path.start_with?(ok) }
47
58
  next if blacklist.any? { |nope| path.start_with?(nope) }
48
59
 
49
60
  writer = Effective::CodeWriter.new(path) do |w|
50
- w.gsub!(source.classify.pluralize, target.classify.pluralize)
51
- w.gsub!(source.classify, target.classify)
52
- w.gsub!(source.pluralize, target.pluralize)
53
- w.gsub!(source, target)
61
+ subs.each { |k, v| w.gsub!(k, v) }
54
62
  end
55
63
 
56
64
  puts "updated: #{path}" if writer.changed?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_developer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect