rename 1.0.9 → 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/README.md +1 -1
- data/lib/generators/rename/shared/common_methods.rb +17 -9
- data/lib/rename/version.rb +1 -1
- data/rename.gemspec +1 -0
- metadata +3 -3
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
|
data/README.md
CHANGED
@@ -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('/')
|
@@ -44,9 +45,9 @@ module CommonMethods
|
|
44
45
|
elsif reserved_names.include?(@new_module_name.downcase)
|
45
46
|
raise Thor::Error, '[Error] Please give a name which does not match any of the reserved Rails keywords.'
|
46
47
|
elsif Object.const_defined?(@new_module_name)
|
47
|
-
raise Thor::Error, "[Error] Constant #{@new_module_name} is already in use, please choose another name."
|
48
|
+
raise Thor::Error, "[Error] Constant '#{@new_module_name}' is already in use, please choose another name."
|
48
49
|
elsif file_exist?(@new_path)
|
49
|
-
raise Thor::Error,
|
50
|
+
raise Thor::Error, "[Error] Folder '#{@new_dir}' already in use, please choose another name."
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -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
data/rename.gemspec
CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.email = %w(morshed201@gmail.com)
|
10
10
|
gem.homepage = 'https://github.com/morshedalam/rename'
|
11
11
|
gem.summary = 'Rename your Rails application using a single command.'
|
12
|
+
gem.required_ruby_version = ">= 1.8.7"
|
12
13
|
|
13
14
|
gem.add_dependency 'rails', '>= 3.0.0'
|
14
15
|
gem.add_dependency 'thor', '>= 0.19.1'
|
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
|
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 1.8.7
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|