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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1264cb5dea4b509ad96bd84a0f65b0f4fc811ae
4
- data.tar.gz: 1143ce6e50660b5784778ee3d15c6854792ea312
3
+ metadata.gz: 466b75dc220dec1b17dcfc70fbed895b9946e9ba
4
+ data.tar.gz: a76d51ce9d8302350da2a8bc052800afb9ae071c
5
5
  SHA512:
6
- metadata.gz: e254fc02698414ea7ff89df86773b3ddabf20e1d01570c0792c1006eaa7d2efb99d3e6de1b29b30eae0d05c319a39b4df2472586ea7b9340d04e2c5bada9f181
7
- data.tar.gz: a3b6df001bdf0afa61b088a8a8b8b4cfe98a85b3d5237c0e7f8989e3774aba80a5329efe51cc9a6cac43749789795bf038e61cffb4a2275eb4e96358219a0a35
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
- Simply type the following into the command line:
23
+ Run rails console and use the following command:
24
24
 
25
- $ model_renamer OldName NewName
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 ModelRenamerRunner
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 replace_and_generate_migration
11
+ def rename_and_generate_migrations
12
+ rename
13
+ generate_migrations
14
+ end
15
+
16
+ def rename
12
17
  replace_all_occurrences
13
- # Taken out for initial release
14
- # MigrationGenerator.new(@variations_generator.underscore_variations).create_migration_file
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
@@ -1,3 +1,3 @@
1
1
  module ModelRenamer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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 = "A gem that renames your ActiveRecord models and generates corresponding migrations"
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.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/model_renamer_runner.rb
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
data/bin/model_renamer DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'model_renamer'
4
-
5
- ModelRenamerRunner.new(ARGV[0], ARGV[1]).replace_and_generate_migration