ridgepoler-rails 1.0.0 → 1.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
- SHA1:
3
- metadata.gz: cc5bf61b19055f85a8e25f0736c4151318b018f7
4
- data.tar.gz: 9a5c5f3d5a2c5be8cc9ffce54a457143b8cb7ba1
2
+ SHA256:
3
+ metadata.gz: 7136c32334302e2751002581b1d5bc8a11f6c864d990c1e8eaa0c339a6c20f33
4
+ data.tar.gz: 1705db54f143a01fed319308eb4caf0baade7416307134198e87560d7ea990c0
5
5
  SHA512:
6
- metadata.gz: 71abbabdd349d48bcdfac8078d5ed6f7a67aeafbd0e339cc21acbd536e7e7d1b334132291d689dcb6cf2a2640280e9eb28398112b90fb31afa1b744439095acd
7
- data.tar.gz: 88c5d2689c6a2b7f63629fbcc6e2d058ec00ffd3c1ddb8944d8223e585e5cf9ead3e25022a082b593591a5ec18a605e365ee5ac4ec910af5476b580f63ab828f
6
+ metadata.gz: 22fd9791977bb3af644df0bd53e5bdcc65f4833f48878e051b9c83b932b8fe4c46f393f82e601542918e1f68e35e2469055564e96defae19bdda16d3c1a79cc5
7
+ data.tar.gz: 5286f23129601c9859c67c33e9c896f103800531a857d6ba62a6d6740256c0bbbc30f50f9d15b120e0f30529340e8edb2701e6cd21546f228cbc1d693f470a12
data/README.md CHANGED
@@ -23,7 +23,7 @@ Once installed, Ridgepoler will generate migration files instead of ActiveRecord
23
23
 
24
24
  ## Rake tasks
25
25
 
26
- Ridgepoler will replace or clear some db tasks. If you doesn't need that overrides, you can set `config.ridgepoler.override_db_tasks = false`.
26
+ Ridgepoler will replace or clear some db tasks. If you doesn't need that overrides, you can set `config.ridgepole.override_db_tasks = false`.
27
27
 
28
28
  ### Clear tasks
29
29
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'bundler/setup'
3
5
  rescue LoadError
@@ -5,6 +5,8 @@ require 'rails/generators/active_record/model/model_generator'
5
5
  module Rails
6
6
  module Generators
7
7
  class RidgepoleGenerator < ActiveRecord::Generators::ModelGenerator
8
+ IGNORE_ATTRIBUTE_OPTIONS = %i[foreign_key]
9
+
8
10
  def self.source_paths
9
11
  [ActiveRecord::Generators::ModelGenerator.source_root, File.expand_path('../templates', __FILE__)]
10
12
  end
@@ -15,6 +17,17 @@ module Rails
15
17
 
16
18
  template 'schema.rb', File.join('db/schema', class_path, "#{file_name}.rb")
17
19
  end
20
+
21
+ private
22
+
23
+ def options_for_attribute(attribute)
24
+ opts = attribute.options_for_migration.
25
+ except(*IGNORE_ATTRIBUTE_OPTIONS).
26
+ map { |k, v| "#{k}: #{v.inspect}" }.
27
+ join(', ')
28
+
29
+ opts.present? ? ", #{opts}" : ""
30
+ end
18
31
  end
19
32
  end
20
33
  end
@@ -7,7 +7,7 @@ create_table :<%= table_name %><%= primary_key_type %>, force: :cascade do |t|
7
7
  <% elsif attribute.token? -%>
8
8
  t.string :<%= attribute.name %><%= attribute.inject_options %>
9
9
  <% else -%>
10
- t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
10
+ t.<%= attribute.type %> :<%= attribute.name %><%= options_for_attribute(attribute) %>
11
11
  <% end -%>
12
12
  <% end -%>
13
13
  <% if options[:timestamps] %>
@@ -23,8 +23,8 @@ namespace :db do
23
23
  end
24
24
 
25
25
  {
26
- :migrate => 'ridgepole:apply',
27
- :setup => 'ridgepole:setup',
26
+ migrate: 'ridgepole:apply',
27
+ setup: 'ridgepole:setup'
28
28
  }.each_pair do |new, old|
29
29
  alias_task(new, old)
30
30
  end
@@ -18,7 +18,14 @@ namespace :ridgepole do
18
18
  private
19
19
 
20
20
  def ridgepole(env: Rails.env, dry_run: false)
21
- args = ['ridgepole', '-a', '-c', 'config/database.yml', '-E', env]
21
+ args = ['ridgepole', '-a']
22
+
23
+ args += if ENV['DATABASE_URL'].to_s.empty?
24
+ ['-c', 'config/database.yml', '-E', env]
25
+ else
26
+ ['-c', ENV['DATABASE_URL']]
27
+ end
28
+
22
29
  args.push('--dry-run') if dry_run
23
30
  args.push('--debug') if config.debug
24
31
  args.push('--verbose') if config.verbose
@@ -1,5 +1,5 @@
1
1
  module Ridgepoler
2
2
  module Rails
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '1.1.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridgepoler-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-05 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 5.0.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5.3'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 5.0.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '5.3'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: ridgepole
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +82,7 @@ homepage: https://github.com/space-pirates-llc/ridgepoler-rails
88
82
  licenses:
89
83
  - MIT
90
84
  metadata: {}
91
- post_install_message:
85
+ post_install_message:
92
86
  rdoc_options: []
93
87
  require_paths:
94
88
  - lib
@@ -103,9 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
97
  - !ruby/object:Gem::Version
104
98
  version: '0'
105
99
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.6.8
108
- signing_key:
100
+ rubygems_version: 3.2.3
101
+ signing_key:
109
102
  specification_version: 4
110
103
  summary: Provides integration between ridgepole and rails 5 newer
111
104
  test_files: []