rename 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/rename/shared/common_methods.rb +15 -7
- data/lib/rename/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd9bfc9678104ffa45d1ed46dd77175ec9477dd8ac9d78e2b311312821e93e7c
|
4
|
+
data.tar.gz: 928bd83c721e29792092910a6f40b34215c43a1a7750be1eaf4e39a753a7de42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cdb1e940a996bf0eddf75eaf12bad8542e2af9ced9f468761c72f8ec11dca3dc56b459b99074cb96b9f573df5384e223928a504d15e66db8e202d2810022efa
|
7
|
+
data.tar.gz: 892261fd19eb9228bd0f945c8c2ab035ac7842a20356334df1a6d20c3dc321b507e916e9474aeee90af6c3ddce06ae81c9512542d655071f4320f2baa1ae89c1
|
@@ -29,6 +29,7 @@ module CommonMethods
|
|
29
29
|
def prepare_app_vars
|
30
30
|
@new_key = new_name.gsub(/\W/, '_')
|
31
31
|
@old_module_name = app_parent
|
32
|
+
@old_dir = File.basename(Dir.getwd)
|
32
33
|
@new_module_name = @new_key.squeeze('_').camelize
|
33
34
|
@new_dir = new_name.gsub(/[&%*@()!{}\[\]'\\\/"]+/, '')
|
34
35
|
@new_path = Rails.root.to_s.split('/')[0...-1].push(@new_dir).join('/')
|
@@ -87,6 +88,7 @@ module CommonMethods
|
|
87
88
|
# rename_app_to_new_app_directory
|
88
89
|
def change_app_directory
|
89
90
|
rename_references
|
91
|
+
remove_references
|
90
92
|
rename_directory
|
91
93
|
end
|
92
94
|
|
@@ -101,17 +103,23 @@ module CommonMethods
|
|
101
103
|
end
|
102
104
|
|
103
105
|
def rename_references
|
104
|
-
|
105
|
-
old_basename = File.basename(Dir.getwd)
|
106
|
+
print 'Renaming references...'
|
106
107
|
|
107
108
|
in_root do
|
108
|
-
Dir.glob('.idea/*', File::FNM_DOTMATCH).each do |file|
|
109
|
-
replace_into_file(file, old_basename, @new_dir)
|
110
|
-
end
|
111
|
-
|
112
109
|
gem_set_file = '.ruby-gemset'
|
113
|
-
replace_into_file(gem_set_file,
|
110
|
+
replace_into_file(gem_set_file, @old_dir, @new_dir) if file_exist?(gem_set_file)
|
111
|
+
end
|
112
|
+
puts 'Done!'
|
113
|
+
end
|
114
|
+
|
115
|
+
def remove_references
|
116
|
+
print 'Removing references...'
|
117
|
+
|
118
|
+
begin
|
119
|
+
FileUtils.rm_r('.idea')
|
120
|
+
rescue Exception => ex
|
114
121
|
end
|
122
|
+
puts 'Done!'
|
115
123
|
end
|
116
124
|
|
117
125
|
def rename_directory
|
data/lib/rename/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rename
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morshed Alam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|