standalone_migrations 5.2.3 → 6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 219a7433481076edbe318711aa0c867f957876fa
4
- data.tar.gz: 4b0dee79a2d43daa7b49829438e04b5670767fe7
2
+ SHA256:
3
+ metadata.gz: da230149d03a3c1a2c9d615df88599e690f4c916c67118ddfe5ea8a29aaa3bd3
4
+ data.tar.gz: 4a064b52613d1298de969a468b2d56673d63e62bb3dadf8ef66c458663f35e47
5
5
  SHA512:
6
- metadata.gz: 155dfb9ca6c264fc2b23c72f7d9aaada1097640eb7206cc01b3b1ca4cde2aa09d6631ef03b0cd4e4c85442ea720cbffb7fb6a06ec9429ba6cdb52dcd69afc86d
7
- data.tar.gz: 1a3eab8e50448b2ac611b1af4224905929f3825321d9116344d1dad269eb8250468745637bfa8c41d7aa385ecec890ccde18f34db1cdc640d6493af45c85c0ca
6
+ metadata.gz: 6afd779861221a5e6aadbfce173998a420eaa4f98a4ea8a4245f6551e27c4365b936c16df0ce4d2ca9845c5c649582226388fdf882f5549efac25eda25208cb6
7
+ data.tar.gz: 416811724fc812df39bdbf3a250b83548f08480020ab7f2a0cb3c58fb4991d325a9ba75e1d8ddf2e384388b1db26997393eac721829784c51e79d30288b82be9
@@ -1,8 +1,15 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
3
+ - 2.5.7
4
+ - 2.6.5
4
5
  env:
5
- - AR="~> 4.2.0" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
6
- - AR="~> 5.0.0" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
7
- - AR=">= 5.1.0.rc2,< 5.2" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
6
+ - AR="~> 4.2.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
7
+ - AR="~> 5.0.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
8
+ - AR=">= 5.1.0.rc2,< 5.2" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
9
+ - AR=">= 5.2.0.rc2,< 5.3,!= 5.2.3,!=5.2.3.rc1" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
10
+ - AR="~> 6.0.0" SQL="~>1.4" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
11
+ jobs:
12
+ exclude:
13
+ - rvm: 2.6.5
14
+ env: AR="~> 4.2.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
8
15
  script: bundle exec rake specs:travis
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake', '>= 10.0'
4
- gem 'activerecord', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 5.2.0"]
5
- gem 'railties', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 5.2.0"]
4
+ gem 'activerecord', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 6.1.0", "!= 5.2.3", "!=5.2.3.rc1"]
5
+ gem 'railties', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 6.1.0", "!= 5.2.3", "!=5.2.3.rc1"]
6
6
 
7
7
  group :dev do
8
- gem 'sqlite3'
8
+ gem 'sqlite3', ENV['SQL'] ? ENV['SQL'].split(",") : ['~> 1.4']
9
9
  gem 'rspec', '>= 2.99.0'
10
10
  gem 'jeweler'
11
11
  end
@@ -8,11 +8,11 @@ In the 5.x release we have moved to using Rails 5 migrations instead of maintain
8
8
 
9
9
  CONTRIBUTE
10
10
  ==========
11
- [Standalone Migrations](https://github.com/thuss/standalone-migrations) relies on the contributions of the open-source community! To submit a fix or an enhancement fork the repository, checkout the *develop* branch, make your changes, add your name to the *Contributors* section in README.markdown, and send us a pull request! If you're active and do good work we'll add you as a collaborator!
11
+ [Standalone Migrations](https://github.com/thuss/standalone-migrations) relies on the contributions of the open-source community! To submit a fix or an enhancement fork the repository, make your changes, add your name to the *Contributors* section in README.markdown, and send us a pull request! If you're active and do good work we'll add you as a collaborator!
12
12
 
13
13
  USAGE
14
14
  =====
15
- Install Ruby, RubyGems and a ruby-database driver (e.g. `gem install mysql`) then:
15
+ Install Ruby, RubyGems and a ruby-database driver (e.g. `gem install mysql` or `gem install mysql2`) then:
16
16
 
17
17
  $ gem install standalone_migrations
18
18
 
@@ -264,3 +264,6 @@ Contributors
264
264
  - [Yi Wen](https://github.com/ywen)
265
265
  - [Jonathan Rochkind](https://github.com/jrochkind)
266
266
  - [Michael Mikhailov](https://github.com/yohanson)
267
+ - [Benjamin Dobell](https://github.com/Benjamin-Dobell)
268
+ - [Hassan Mahmoud](https://github.com/HassanTC)
269
+ - [Marco Adkins](https://github.com/marcoadkins)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.2.3
1
+ 6.0.0
@@ -21,7 +21,6 @@ module StandaloneMigrations
21
21
 
22
22
  class Configurator
23
23
  def self.load_configurations
24
- self.new
25
24
  @env_config ||= Rails.application.config.database_configuration
26
25
  ActiveRecord::Base.configurations = @env_config
27
26
  @env_config
@@ -33,17 +32,21 @@ module StandaloneMigrations
33
32
  end
34
33
 
35
34
  def initialize(options = {})
35
+ default_schema = ENV['SCHEMA'] || ActiveRecord::Tasks::DatabaseTasks.schema_file(ActiveRecord::Base.schema_format)
36
36
  defaults = {
37
37
  :config => "db/config.yml",
38
38
  :migrate_dir => "db/migrate",
39
+ :root => Pathname.pwd,
39
40
  :seeds => "db/seeds.rb",
40
- :schema => "db/schema.rb"
41
+ :schema => default_schema
41
42
  }
42
43
  @options = load_from_file(defaults.dup) || defaults.merge(options)
43
- ENV['SCHEMA'] = ENV['SCHEMA'] || File.expand_path(schema)
44
44
 
45
- Rails.application.config.root = Pathname.pwd
45
+ ENV['SCHEMA'] = schema
46
+ Rails.application.config.root = root
46
47
  Rails.application.config.paths["config/database"] = config
48
+ Rails.application.config.paths["db/migrate"] = migrate_dir
49
+ Rails.application.config.paths["db/seeds.rb"] = seeds
47
50
  end
48
51
 
49
52
  def config
@@ -54,6 +57,10 @@ module StandaloneMigrations
54
57
  @options[:migrate_dir]
55
58
  end
56
59
 
60
+ def root
61
+ @options[:root]
62
+ end
63
+
57
64
  def seeds
58
65
  @options[:seeds]
59
66
  end
@@ -86,6 +93,7 @@ module StandaloneMigrations
86
93
  {
87
94
  :config => config["config"] ? config["config"]["database"] : defaults[:config],
88
95
  :migrate_dir => (config["db"] || {})["migrate"] || defaults[:migrate_dir],
96
+ :root => config["root"] || defaults[:root],
89
97
  :seeds => (config["db"] || {})["seeds"] || defaults[:seeds],
90
98
  :schema => (config["db"] || {})["schema"] || defaults[:schema]
91
99
  }
@@ -1,5 +1,6 @@
1
1
  # these generators are backed by rails' generators
2
2
  require "rails/generators"
3
+ require 'rails/generators/active_record/migration/migration_generator'
3
4
  module StandaloneMigrations
4
5
  class Generator
5
6
  def self.migration(name, options="")
@@ -8,4 +9,14 @@ module StandaloneMigrations
8
9
  :destination_root => Rails.root
9
10
  end
10
11
  end
12
+
13
+ class CacheMigrationGenerator < ActiveRecord::Generators::MigrationGenerator
14
+ source_root File.join(File.dirname(ActiveRecord::Generators::MigrationGenerator.instance_method(:create_migration_file).source_location.first), "templates")
15
+
16
+ def create_migration_file
17
+ set_local_assigns!
18
+ validate_file_name!
19
+ migration_template @migration_template, Rails.application.config.paths["db/migrate"]
20
+ end
21
+ end
11
22
  end
@@ -1,17 +1,13 @@
1
1
  module StandaloneMigrations
2
2
  class Tasks
3
3
  class << self
4
- def configure
4
+ def configure(options = {})
5
5
  Deprecations.new.call
6
- configurator = Configurator.new
7
- paths = Rails.application.config.paths
8
- paths.add "config/database", :with => configurator.config
9
- paths.add "db/migrate", :with => configurator.migrate_dir
10
- paths.add "db/seeds.rb", :with => configurator.seeds
6
+ Configurator.new options
11
7
  end
12
8
 
13
- def load_tasks
14
- configure
9
+ def load_tasks(options = {})
10
+ configure(options)
15
11
  Configurator.environments_config do |proxy|
16
12
  ActiveRecord::Tasks::DatabaseTasks.database_configuration = proxy.configurations
17
13
  end
@@ -105,7 +105,7 @@ module StandaloneMigrations
105
105
  end
106
106
 
107
107
  it "use db/schema.rb" do
108
- expect(configurator.schema).to eq("db/schema.rb")
108
+ expect(configurator.schema).to end_with("/db/schema.rb")
109
109
  end
110
110
 
111
111
  end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
-
3
2
  describe 'Standalone migrations' do
4
3
 
5
4
  def write(file, content)
@@ -23,6 +22,10 @@ describe 'Standalone migrations' do
23
22
  "spec/tmp/#{file}"
24
23
  end
25
24
 
25
+ def schema
26
+ ENV['SCHEMA']
27
+ end
28
+
26
29
  def run(cmd)
27
30
  result = `cd spec/tmp && #{cmd} 2>&1`
28
31
  raise result unless $?.success?
@@ -84,9 +87,11 @@ end
84
87
  end
85
88
 
86
89
  before do
90
+ StandaloneMigrations::Configurator.instance_variable_set(:@env_config, nil)
87
91
  `rm -rf spec/tmp` if File.exist?('spec/tmp')
88
92
  `mkdir spec/tmp`
89
93
  write_rakefile
94
+ write(schema, '')
90
95
  write 'db/config.yml', <<-TXT
91
96
  development:
92
97
  adapter: sqlite3
@@ -94,6 +99,9 @@ development:
94
99
  test:
95
100
  adapter: sqlite3
96
101
  database: db/test.sql
102
+ production:
103
+ adapter: sqlite3
104
+ database: db/production.sql
97
105
  TXT
98
106
  end
99
107
 
@@ -117,7 +125,7 @@ test:
117
125
 
118
126
  describe 'callbacks' do
119
127
  it 'runs the callbacks' do
120
- expect(StandaloneMigrations::Tasks).to receive(:configure)
128
+ expect(StandaloneMigrations::Tasks).to receive(:configure).and_call_original
121
129
 
122
130
  connection_established = false
123
131
  expect(ActiveRecord::Base).to receive(:establish_connection) do
@@ -254,16 +262,15 @@ test:
254
262
 
255
263
  describe 'schema:dump' do
256
264
  it "dumps the schema" do
257
- write('db/schema.rb', '')
265
+ write(schema, '')
258
266
  run('rake db:schema:dump')
259
- expect(read('db/schema.rb')).to match(/ActiveRecord/)
267
+ expect(read(schema)).to match(/ActiveRecord/)
260
268
  end
261
269
  end
262
270
 
263
271
  describe 'db:schema:load' do
264
272
  it "loads the schema" do
265
273
  run('rake db:schema:dump')
266
- schema = "db/schema.rb"
267
274
  write(schema, read(schema)+"\nputs 'LOADEDDD'")
268
275
  result = run('rake db:schema:load')
269
276
  expect(result).to match(/LOADEDDD/)
@@ -292,11 +299,13 @@ test:
292
299
 
293
300
  describe 'db:test:load' do
294
301
  it 'loads' do
295
- write("db/schema.rb", "puts 'LOADEDDD'")
302
+ write(schema, "puts 'LOADEDDD'")
296
303
  expect(run("rake db:test:load")).to match(/LOADEDDD/)
297
304
  end
298
305
 
299
306
  it "fails without schema" do
307
+ schema_path = "spec/tmp/#{schema}"
308
+ `rm -rf #{schema_path}` if File.exist?(schema_path)
300
309
  expect(lambda{ run("rake db:test:load") }).to raise_error(/try again/)
301
310
  end
302
311
  end
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: standalone_migrations 5.2.3 ruby lib
5
+ # stub: standalone_migrations 6.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "standalone_migrations"
9
- s.version = "5.2.3"
8
+ s.name = "standalone_migrations".freeze
9
+ s.version = "6.0.0"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Todd Huss", "Michael Grosser"]
14
- s.date = "2017-06-10"
15
- s.email = "thuss@gabrito.com"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Todd Huss".freeze, "Michael Grosser".freeze]
14
+ s.date = "2020-06-11"
15
+ s.email = "thuss@gabrito.com".freeze
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
18
18
  "README.markdown"
@@ -49,27 +49,23 @@ Gem::Specification.new do |s|
49
49
  "vendor/migration_helpers/init.rb",
50
50
  "vendor/migration_helpers/lib/migration_helper.rb"
51
51
  ]
52
- s.homepage = "http://github.com/thuss/standalone-migrations"
53
- s.licenses = ["MIT"]
54
- s.rubygems_version = "2.4.8"
55
- s.summary = "A thin wrapper to use Rails Migrations in non Rails projects"
52
+ s.homepage = "http://github.com/thuss/standalone-migrations".freeze
53
+ s.licenses = ["MIT".freeze]
54
+ s.rubygems_version = "3.1.2".freeze
55
+ s.summary = "A thin wrapper to use Rails Migrations in non Rails projects".freeze
56
56
 
57
57
  if s.respond_to? :specification_version then
58
58
  s.specification_version = 4
59
+ end
59
60
 
60
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
61
- s.add_runtime_dependency(%q<rake>, [">= 10.0"])
62
- s.add_runtime_dependency(%q<activerecord>, ["< 5.2.0", ">= 4.2.7"])
63
- s.add_runtime_dependency(%q<railties>, ["< 5.2.0", ">= 4.2.7"])
64
- else
65
- s.add_dependency(%q<rake>, [">= 10.0"])
66
- s.add_dependency(%q<activerecord>, ["< 5.2.0", ">= 4.2.7"])
67
- s.add_dependency(%q<railties>, ["< 5.2.0", ">= 4.2.7"])
68
- end
61
+ if s.respond_to? :add_runtime_dependency then
62
+ s.add_runtime_dependency(%q<rake>.freeze, [">= 10.0"])
63
+ s.add_runtime_dependency(%q<activerecord>.freeze, [">= 4.2.7", "< 6.1.0", "!= 5.2.3", "!= 5.2.3.rc1"])
64
+ s.add_runtime_dependency(%q<railties>.freeze, [">= 4.2.7", "< 6.1.0", "!= 5.2.3", "!= 5.2.3.rc1"])
69
65
  else
70
- s.add_dependency(%q<rake>, [">= 10.0"])
71
- s.add_dependency(%q<activerecord>, ["< 5.2.0", ">= 4.2.7"])
72
- s.add_dependency(%q<railties>, ["< 5.2.0", ">= 4.2.7"])
66
+ s.add_dependency(%q<rake>.freeze, [">= 10.0"])
67
+ s.add_dependency(%q<activerecord>.freeze, [">= 4.2.7", "< 6.1.0", "!= 5.2.3", "!= 5.2.3.rc1"])
68
+ s.add_dependency(%q<railties>.freeze, [">= 4.2.7", "< 6.1.0", "!= 5.2.3", "!= 5.2.3.rc1"])
73
69
  end
74
70
  end
75
71
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standalone_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.3
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Huss
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-06-10 00:00:00.000000000 Z
12
+ date: 2020-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -29,42 +29,66 @@ dependencies:
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "<"
33
- - !ruby/object:Gem::Version
34
- version: 5.2.0
35
32
  - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: 4.2.7
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: 6.1.0
38
+ - - "!="
39
+ - !ruby/object:Gem::Version
40
+ version: 5.2.3
41
+ - - "!="
42
+ - !ruby/object:Gem::Version
43
+ version: 5.2.3.rc1
38
44
  type: :runtime
39
45
  prerelease: false
40
46
  version_requirements: !ruby/object:Gem::Requirement
41
47
  requirements:
42
- - - "<"
43
- - !ruby/object:Gem::Version
44
- version: 5.2.0
45
48
  - - ">="
46
49
  - !ruby/object:Gem::Version
47
50
  version: 4.2.7
51
+ - - "<"
52
+ - !ruby/object:Gem::Version
53
+ version: 6.1.0
54
+ - - "!="
55
+ - !ruby/object:Gem::Version
56
+ version: 5.2.3
57
+ - - "!="
58
+ - !ruby/object:Gem::Version
59
+ version: 5.2.3.rc1
48
60
  - !ruby/object:Gem::Dependency
49
61
  name: railties
50
62
  requirement: !ruby/object:Gem::Requirement
51
63
  requirements:
52
- - - "<"
53
- - !ruby/object:Gem::Version
54
- version: 5.2.0
55
64
  - - ">="
56
65
  - !ruby/object:Gem::Version
57
66
  version: 4.2.7
67
+ - - "<"
68
+ - !ruby/object:Gem::Version
69
+ version: 6.1.0
70
+ - - "!="
71
+ - !ruby/object:Gem::Version
72
+ version: 5.2.3
73
+ - - "!="
74
+ - !ruby/object:Gem::Version
75
+ version: 5.2.3.rc1
58
76
  type: :runtime
59
77
  prerelease: false
60
78
  version_requirements: !ruby/object:Gem::Requirement
61
79
  requirements:
62
- - - "<"
63
- - !ruby/object:Gem::Version
64
- version: 5.2.0
65
80
  - - ">="
66
81
  - !ruby/object:Gem::Version
67
82
  version: 4.2.7
83
+ - - "<"
84
+ - !ruby/object:Gem::Version
85
+ version: 6.1.0
86
+ - - "!="
87
+ - !ruby/object:Gem::Version
88
+ version: 5.2.3
89
+ - - "!="
90
+ - !ruby/object:Gem::Version
91
+ version: 5.2.3.rc1
68
92
  description:
69
93
  email: thuss@gabrito.com
70
94
  executables: []
@@ -122,8 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
146
  - !ruby/object:Gem::Version
123
147
  version: '0'
124
148
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.4.8
149
+ rubygems_version: 3.1.2
127
150
  signing_key:
128
151
  specification_version: 4
129
152
  summary: A thin wrapper to use Rails Migrations in non Rails projects