model_renamer 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/model_renamer/{model_renamer_runner.rb → model_renamer.rb} +11 -4
- data/lib/model_renamer/version.rb +1 -1
- data/model_renamer.gemspec +1 -2
- metadata +3 -5
- data/bin/model_renamer +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 466b75dc220dec1b17dcfc70fbed895b9946e9ba
|
4
|
+
data.tar.gz: a76d51ce9d8302350da2a8bc052800afb9ae071c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df75d798655bc4a9e1acb5104fdc190533b83b471fa71c78c22328edc9f2aa25cbbd6c3b1931de3a8aceea5b70840f95fce7de1e0a345a40f0e0aa5dbab89e45
|
7
|
+
data.tar.gz: 020ce49833ed66cacc1fc5cfcbaf87d5bdb114de2c41bd43265c35568c13cd9754ef2eba84bf46db7a9a8f3abd34c1e8576b6486bd8ce05ff2f09319fb939c10
|
data/README.md
CHANGED
@@ -20,6 +20,20 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
Run rails console and use the following command:
|
24
24
|
|
25
|
-
|
25
|
+
```ruby
|
26
|
+
ModelRenamer.new("OldName", "NewName").rename_and_generate_migrations
|
27
|
+
```
|
28
|
+
|
29
|
+
This will rename everything in the codebase as well as generate the migrations. If you only want to rename in the codebase, run:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
ModelRenamer.new("OldName", "NewName").rename
|
33
|
+
```
|
34
|
+
|
35
|
+
To only generate migrations, you guessed it:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
ModelRenamer.new("OldName", "NewName").generate_migrations
|
39
|
+
```
|
@@ -2,16 +2,23 @@
|
|
2
2
|
# Uses VariationsGenerator output to first change all the occurences of the model name in the files,
|
3
3
|
# then to create new directories and rename files. Then uses MigrationGenerator to create a migration
|
4
4
|
#
|
5
|
-
class
|
5
|
+
class ModelRenamer
|
6
6
|
|
7
7
|
def initialize old_name, new_name
|
8
8
|
@variations_generator = VariationsGenerator.new(old_name, new_name)
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def rename_and_generate_migrations
|
12
|
+
rename
|
13
|
+
generate_migrations
|
14
|
+
end
|
15
|
+
|
16
|
+
def rename
|
12
17
|
replace_all_occurrences
|
13
|
-
|
14
|
-
|
18
|
+
end
|
19
|
+
|
20
|
+
def generate_migrations
|
21
|
+
MigrationGenerator.new(@variations_generator.underscore_variations).create_migration_file
|
15
22
|
end
|
16
23
|
|
17
24
|
private
|
data/model_renamer.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["pg@vts.com"]
|
11
11
|
spec.homepage = "https://rubygems.org/gems/model_renamer"
|
12
12
|
spec.summary = "Renames any model"
|
13
|
-
spec.description
|
13
|
+
spec.description = "A gem that renames your ActiveRecord models and generates corresponding migrations"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
end
|
23
23
|
|
24
24
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
-
spec.executables = ["model_renamer"]
|
26
25
|
spec.require_paths = ["lib"]
|
27
26
|
|
28
27
|
spec.add_development_dependency "bundler", "~> 1.9"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_renamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Gut
|
@@ -42,8 +42,7 @@ description: A gem that renames your ActiveRecord models and generates correspon
|
|
42
42
|
migrations
|
43
43
|
email:
|
44
44
|
- pg@vts.com
|
45
|
-
executables:
|
46
|
-
- model_renamer
|
45
|
+
executables: []
|
47
46
|
extensions: []
|
48
47
|
extra_rdoc_files: []
|
49
48
|
files:
|
@@ -51,10 +50,9 @@ files:
|
|
51
50
|
- Gemfile
|
52
51
|
- LICENSE.txt
|
53
52
|
- README.md
|
54
|
-
- bin/model_renamer
|
55
53
|
- lib/model_renamer.rb
|
56
54
|
- lib/model_renamer/migration_generator.rb
|
57
|
-
- lib/model_renamer/
|
55
|
+
- lib/model_renamer/model_renamer.rb
|
58
56
|
- lib/model_renamer/variations_generator.rb
|
59
57
|
- lib/model_renamer/version.rb
|
60
58
|
- model_renamer.gemspec
|