rename 1.0.11 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd9bfc9678104ffa45d1ed46dd77175ec9477dd8ac9d78e2b311312821e93e7c
4
- data.tar.gz: 928bd83c721e29792092910a6f40b34215c43a1a7750be1eaf4e39a753a7de42
3
+ metadata.gz: 04cb7ca7a219f63bd6fd8da695d5e0ea96ee758434705f742151afa0f43ad453
4
+ data.tar.gz: b89e1988ddcd6516e6ac8c73f2b2944554e5368457719ea2f13dd8f6919e4f84
5
5
  SHA512:
6
- metadata.gz: 4cdb1e940a996bf0eddf75eaf12bad8542e2af9ced9f468761c72f8ec11dca3dc56b459b99074cb96b9f573df5384e223928a504d15e66db8e202d2810022efa
7
- data.tar.gz: 892261fd19eb9228bd0f945c8c2ab035ac7842a20356334df1a6d20c3dc321b507e916e9474aeee90af6c3ddce06ae81c9512542d655071f4320f2baa1ae89c1
6
+ metadata.gz: a40212bc260a48a7daeb3ffeef3d59acfd4dbeb7fd5e4886c45d3f90d4c78d739dbc9fc8ddb7ece0243ce53833741d7731f3e5e312d43759f49fa716c7e92edd
7
+ data.tar.gz: 4b59761975f027efbff227a9a31b7f44b9c61d356e44fd3a08f3cc1f51f63224a7e033b11c8c937a0f5139b1ee80154b51c332b48e7732fc91bd0ff8d1ceef59
data/README.md CHANGED
@@ -18,6 +18,46 @@ gem 'rename'
18
18
  rails g rename:into New-Name
19
19
  ```
20
20
 
21
+ ## Applied
22
+
23
+ ```
24
+ Search and replace exact module name to...
25
+ Gemfile
26
+ Gemfile.lock
27
+ README.md
28
+ Rakefile
29
+ config.ru
30
+ config/application.rb
31
+ config/boot.rb
32
+ config/environment.rb
33
+ config/environments/development.rb
34
+ config/environments/production.rb
35
+ config/environments/test.rb
36
+ config/importmap.rb
37
+ config/initializers/assets.rb
38
+ config/initializers/content_security_policy.rb
39
+ config/initializers/filter_parameter_logging.rb
40
+ config/initializers/inflections.rb
41
+ config/initializers/permissions_policy.rb
42
+ config/puma.rb
43
+ config/routes.rb
44
+ app/views/layouts/application.html.erb
45
+ app/views/layouts/application.html.haml
46
+ app/views/layouts/application.html.slim
47
+ README.md
48
+ README.markdown
49
+ README.mdown
50
+ README.mkdn
51
+ Search and replace underscore seperated module name to...
52
+ config/initializers/session_store.rb
53
+ config/database.yml
54
+ config/cable.yml
55
+ config/environments/production.rb
56
+ package.json
57
+ Removing references...
58
+ .idea
59
+ Renaming directory...
60
+ ```
21
61
 
22
62
  ## Contributing
23
63
 
@@ -15,7 +15,8 @@ module CommonMethods
15
15
  prepare_app_vars
16
16
  validate_name_and_path?
17
17
  apply_new_module_name
18
- change_app_directory
18
+ remove_references
19
+ rename_directory
19
20
  end
20
21
 
21
22
  def app_parent
@@ -54,44 +55,36 @@ module CommonMethods
54
55
  # rename_app_to_new_app_module
55
56
  def apply_new_module_name
56
57
  in_root do
57
- puts 'Search and replace module in files...'
58
-
59
- #Search and replace module in to file
58
+ puts 'Search and replace exact module name...'
60
59
  Dir['*', 'config/**/**/*.rb', '.{rvmrc}'].each do |file|
61
60
  # file = File.join(Dir.pwd, file)
62
61
  replace_into_file(file, /(#{@old_module_name}*)/m, @new_module_name)
63
62
  end
63
+ #Application layout
64
+ %w(erb haml slim).each do |ext|
65
+ replace_into_file("app/views/layouts/application.html.#{ext}", /#{@old_module_name}/, @new_module_name)
66
+ end
67
+ #Readme
68
+ %w(md markdown mdown mkdn).each do |ext|
69
+ replace_into_file("README.#{ext}", /#{@old_module_name}/, @new_module_name)
70
+ end
64
71
 
65
- #Rename session key
72
+ puts 'Search and replace underscore seperated module name in files...'
73
+ #session key
66
74
  replace_into_file('config/initializers/session_store.rb', /(('|")_.*_session('|"))/i, "'_#{@new_key}_session'")
67
- #Rename database
75
+ #database
68
76
  replace_into_file('config/database.yml', /#{@old_module_name.underscore}/i, @new_name.underscore)
69
- #Rename into channel and job queue
77
+ #Channel and job queue
70
78
  %w(config/cable.yml config/environments/production.rb).each do |file|
71
79
  replace_into_file(file, /#{@old_module_name.underscore}_production/, "#{@new_module_name.underscore}_production")
72
80
  end
73
- #Application layout
74
- %w(erb haml).each do |file|
75
- replace_into_file("app/views/layouts/application.html.#{file}", /#{@old_module_name}/, @new_module_name)
76
- end
77
- # Update package.json name entry
81
+ # package.json name entry
78
82
  old_package_name_regex = /\Wname\W *: *\W(?<name>[-_\p{Alnum}]+)\W *, */i
79
- new_package_name = %("name":"#{@new_module_name.underscore}",)
83
+ new_package_name = %("name":"#{@new_module_name.underscore}",)
80
84
  replace_into_file('package.json', old_package_name_regex, new_package_name)
81
-
82
- puts 'Search and replace module in environment variables...'
83
- #Rename database
84
- replace_into_file('config/database.yml', /#{@old_module_name.underscore.upcase}/, @new_module_name.underscore.upcase)
85
85
  end
86
86
  end
87
87
 
88
- # rename_app_to_new_app_directory
89
- def change_app_directory
90
- rename_references
91
- remove_references
92
- rename_directory
93
- end
94
-
95
88
  private
96
89
 
97
90
  def reserved_names
@@ -102,16 +95,6 @@ module CommonMethods
102
95
  File.respond_to?(:exist?) ? File.exist?(name) : File.exists?(name)
103
96
  end
104
97
 
105
- def rename_references
106
- print 'Renaming references...'
107
-
108
- in_root do
109
- gem_set_file = '.ruby-gemset'
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
98
  def remove_references
116
99
  print 'Removing references...'
117
100
 
@@ -127,6 +110,8 @@ module CommonMethods
127
110
 
128
111
  begin
129
112
  # FileUtils.mv Dir.pwd, app_path
113
+ gem_set_file = '.ruby-gemset'
114
+ replace_into_file(gem_set_file, @old_dir, @new_dir) if file_exist?(gem_set_file)
130
115
  File.rename(Rails.root.to_s, @new_path)
131
116
  puts 'Done!'
132
117
  puts "New application path is '#{@new_path}'"
@@ -1,3 +1,3 @@
1
1
  module Rename
2
- VERSION = '1.0.11'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rename
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morshed Alam