rails-rename 1.0.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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/Rakefile +1 -0
- data/lib/generators/rename_generator.rb +56 -0
- data/lib/rails-rename.rb +0 -0
- data/rails-rename.gemspec +20 -0
- data/readme.md +17 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 64a6b4b58a21117b85b1d8fdd9c55d33f0382dfe
|
4
|
+
data.tar.gz: 652f38964151134da1e0266224e708247e2fa496
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1c6dc97c13f662ee177e7afe34acc19a6df9e9287bebfe0b209f25bb0a62cb2825c85ef3903dce769fa3a5aafe82e243f597fa040c3abea18d599c02ee044c48
|
7
|
+
data.tar.gz: 6d985da9363c5e1d81729ff92496b90bae25be9dfa247c1a7af00be23f6e7ffe8137f01845264622e8e8a590654d10e9aaacdc03c542865a3850f1356a93eafd
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Mark Miyashita
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class RenameGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
argument :new_name, type: :string, default: "#{Rails.application.class.parent}"
|
4
|
+
|
5
|
+
def rename
|
6
|
+
old_name = "#{Rails.application.class.parent}"
|
7
|
+
new_name_capitalized = new_name.gsub(/\s/, "_").camelize
|
8
|
+
|
9
|
+
puts "Renaming app from #{old_name} to #{new_name_capitalized}"
|
10
|
+
|
11
|
+
in_root do
|
12
|
+
gsub_file 'config/application.rb', /(module) (#{Regexp.escape(old_name)})/mi do |match|
|
13
|
+
"module #{new_name_capitalized}"
|
14
|
+
end
|
15
|
+
|
16
|
+
gsub_file 'config/environment.rb', /(#{Regexp.escape(old_name)})(::Application.initialize!)/mi do |match|
|
17
|
+
"#{new_name_capitalized}::Application.initialize!"
|
18
|
+
end
|
19
|
+
|
20
|
+
environments = ['development', 'production','test']
|
21
|
+
environments.each do |environment_name|
|
22
|
+
gsub_file "config/environments/#{environment_name}.rb", /(#{Regexp.escape(old_name)})(::Application.configure)/mi do |match|
|
23
|
+
"#{new_name_capitalized}::Application.configure"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
gsub_file 'config/routes.rb', /(#{Regexp.escape(old_name)})(::Application.routes)/mi do |match|
|
28
|
+
"#{new_name_capitalized}::Application.routes"
|
29
|
+
end
|
30
|
+
|
31
|
+
gsub_file 'config.ru', /(run) (#{Regexp.escape(old_name)})(::Application)/mi do |match|
|
32
|
+
"run #{new_name_capitalized}::Application"
|
33
|
+
end
|
34
|
+
|
35
|
+
gsub_file 'Rakefile', /(run) (#{Regexp.escape(old_name)})(::Application)/mi do |match|
|
36
|
+
"run #{new_name_capitalized}::Application"
|
37
|
+
end
|
38
|
+
|
39
|
+
gsub_file 'config/initializers/secret_token.rb', /(#{Regexp.escape(old_name)})(::Application.config.secret_key_base)/mi do |match|
|
40
|
+
"#{new_name_capitalized}::Application.config.secret_key_base"
|
41
|
+
end
|
42
|
+
|
43
|
+
gsub_file 'config/initializers/session_store.rb', /(#{Regexp.escape(old_name)})(::Application.config.session_store)/mi do |match|
|
44
|
+
"#{new_name_capitalized}::Application.config.session_store"
|
45
|
+
end
|
46
|
+
|
47
|
+
gsub_file 'config/initializers/session_store.rb', /#{Regexp.escape(old_name.underscore)}/ do |match|
|
48
|
+
"#{new_name_capitalized.underscore}"
|
49
|
+
end
|
50
|
+
|
51
|
+
gsub_file 'Rakefile', /(#{Regexp.escape(old_name.capitalize)})(::Application.load_tasks)/mi do |match|
|
52
|
+
"#{new_name_capitalized}::Application.load_tasks"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/rails-rename.rb
ADDED
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
Gem::Specification.new do |gem|
|
3
|
+
gem.name = 'rails-rename'
|
4
|
+
gem.version = '1.0.0'
|
5
|
+
gem.license = 'MIT'
|
6
|
+
gem.authors = ['Mark Miyashita']
|
7
|
+
gem.email = %w(negativetwelve@gmail.com)
|
8
|
+
gem.homepage = 'https://github.com/negativetwelve/rails-rename'
|
9
|
+
gem.description = 'This library allows you to rename Rails 4 application using a single command.'
|
10
|
+
gem.summary = 'A library to rename your Rails 4 application.'
|
11
|
+
|
12
|
+
gem.add_dependency 'rails','>= 4.0.0'
|
13
|
+
gem.add_development_dependency "rake"
|
14
|
+
|
15
|
+
gem.rubyforge_project = 'rails-rename'
|
16
|
+
|
17
|
+
gem.files = `git ls-files`.split("\n")
|
18
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
gem.require_paths = %w(lib)
|
20
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Rename Gem for Rails 4
|
2
|
+
|
3
|
+
Based off of [Rename](https://github.com/get/Rename) which worked with Rails 3 apps.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
__Rename__ is a gem for Rails 4+ applications which renames the app. To run, simply install the gem by adding this line to your gemfile:
|
8
|
+
|
9
|
+
gem 'rails-rename', git: 'git://github.com/negativetwelve/rails-rename.git'
|
10
|
+
|
11
|
+
Then, run `bundle install` to install the gem.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
rails g rename NewAppName
|
16
|
+
|
17
|
+
where NewAppName is the new name for your application in camelcase.
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-rename
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Miyashita
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: This library allows you to rename Rails 4 application using a single
|
42
|
+
command.
|
43
|
+
email:
|
44
|
+
- negativetwelve@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- Rakefile
|
53
|
+
- lib/generators/rename_generator.rb
|
54
|
+
- lib/rails-rename.rb
|
55
|
+
- rails-rename.gemspec
|
56
|
+
- readme.md
|
57
|
+
homepage: https://github.com/negativetwelve/rails-rename
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project: rails-rename
|
77
|
+
rubygems_version: 2.1.11
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: A library to rename your Rails 4 application.
|
81
|
+
test_files: []
|