standalone_migrations 5.2.5 → 6.1.0

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: 5a1e7dcd9d5df67c60398500f174035b8ca33474
4
- data.tar.gz: e66f06ac0406b0c043a90011cdbf8ccc248cbd1a
2
+ SHA256:
3
+ metadata.gz: b8e8591f80bdab9e910865a8c59db8310ae4113a5e2d0609f87970c0a8299ffe
4
+ data.tar.gz: d7e46d10c47fc90262b2d199a9c266c7956638ff07fcf5a65dd7014f7aafde5f
5
5
  SHA512:
6
- metadata.gz: 3e9181b171630becd1244858b7b0f52b3fa9e2d3d99c0d560d6f638c2fe217b66d0ef914c282104786ddbf8782b7638eb518060c2d39698a9c03683b2975114c
7
- data.tar.gz: 39f32cdb7b1047f04adfd48acbd12026664c31f03c5a325630db1cd786672a1ad856674c47cdb8c8483c51acc4bf0812c9db9ac72c8a33d1907e063d030e09c5
6
+ metadata.gz: 666fcce50aaeef0bc6a9cc392b099a8b79226f3efcf5cd67fbaf38f0773280800e5cb1a312eaaedec4ef411df8606a8b73ac1f4e7b9edf5c7d2e02141168c166
7
+ data.tar.gz: b1bf542f8bb7c50ce32db5792afcca79e76cc20d4dbab2dc1e585dbe7b06f61faf2a4a82af62a09ab566e5bdc135113ab2b4c79e183d38003094fc56483d36c2
data/.travis.yml CHANGED
@@ -1,9 +1,25 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
3
+ - 2.5.7
4
+ - 2.6.5
5
+ - 2.7.3
4
6
  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
8
- - AR=">= 5.2.0.rc2,< 5.3" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
7
+ - AR="~> 4.2.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
8
+ - AR="~> 5.0.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
9
+ - AR=">= 5.1.0.rc2,< 5.2" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
10
+ - AR=">= 5.2.0.rc2,< 5.3,!= 5.2.3,!=5.2.3.rc1" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
11
+ - AR="~> 6.0.0" SQL="~>1.4" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
12
+ - AR="~> 6.1.0" SQL="~>1.4" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
13
+ jobs:
14
+ exclude:
15
+ - rvm: 2.6.5
16
+ env: AR="~> 4.2.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
17
+ - rvm: 2.7.3
18
+ env: AR="~> 4.2.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
19
+ - rvm: 2.7.3
20
+ env: AR="~> 5.0.0" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
21
+ - rvm: 2.7.3
22
+ env: AR=">= 5.1.0.rc2,< 5.2" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
23
+ - rvm: 2.7.3
24
+ env: AR=">= 5.2.0.rc2,< 5.3,!= 5.2.3,!=5.2.3.rc1" SQL="~>1.3.6" NOKOGIRI_USE_SYSTEM_LIBRARIES=1
9
25
  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.3.0"]
5
- gem 'railties', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 5.3.0"]
4
+ gem 'activerecord', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 6.2.0", "!= 5.2.3", "!=5.2.3.rc1"]
5
+ gem 'railties', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 6.2.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
data/README.markdown CHANGED
@@ -4,6 +4,8 @@ Rails migrations in non-Rails (and non Ruby) projects.
4
4
 
5
5
  WHAT'S NEW
6
6
  ==========
7
+ In the 6.x release we've added support for Rails 6 migrations thanks to [Marco Adkins](https://github.com/marcoadkins).
8
+
7
9
  In the 5.x release we have moved to using Rails 5 migrations instead of maintaining our own migration related code. Just about anything you can do with Rails 5 migrations you can now do with [Standalone Migrations](https://github.com/thuss/standalone-migrations) too!
8
10
 
9
11
  CONTRIBUTE
@@ -12,7 +14,7 @@ CONTRIBUTE
12
14
 
13
15
  USAGE
14
16
  =====
15
- Install Ruby, RubyGems and a ruby-database driver (e.g. `gem install mysql`) then:
17
+ Install Ruby, RubyGems and a ruby-database driver (e.g. `gem install mysql` or `gem install mysql2`) then:
16
18
 
17
19
  $ gem install standalone_migrations
18
20
 
@@ -264,3 +266,7 @@ Contributors
264
266
  - [Yi Wen](https://github.com/ywen)
265
267
  - [Jonathan Rochkind](https://github.com/jrochkind)
266
268
  - [Michael Mikhailov](https://github.com/yohanson)
269
+ - [Benjamin Dobell](https://github.com/Benjamin-Dobell)
270
+ - [Hassan Mahmoud](https://github.com/HassanTC)
271
+ - [Marco Adkins](https://github.com/marcoadkins)
272
+ - [Mithun James](https://github.com/drtechie)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.2.5
1
+ 6.1.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
@@ -37,13 +36,17 @@ module StandaloneMigrations
37
36
  defaults = {
38
37
  :config => "db/config.yml",
39
38
  :migrate_dir => "db/migrate",
39
+ :root => Pathname.pwd,
40
40
  :seeds => "db/seeds.rb",
41
41
  :schema => default_schema
42
42
  }
43
43
  @options = load_from_file(defaults.dup) || defaults.merge(options)
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
@@ -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.5 ruby lib
5
+ # stub: standalone_migrations 6.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "standalone_migrations"
9
- s.version = "5.2.5"
8
+ s.name = "standalone_migrations".freeze
9
+ s.version = "6.1.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 = "2018-03-26"
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 = "2021-11-12"
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.4".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.3.0", ">= 4.2.7"])
63
- s.add_runtime_dependency(%q<railties>, ["< 5.3.0", ">= 4.2.7"])
64
- else
65
- s.add_dependency(%q<rake>, [">= 10.0"])
66
- s.add_dependency(%q<activerecord>, ["< 5.3.0", ">= 4.2.7"])
67
- s.add_dependency(%q<railties>, ["< 5.3.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.2.0", "!= 5.2.3", "!= 5.2.3.rc1"])
64
+ s.add_runtime_dependency(%q<railties>.freeze, [">= 4.2.7", "< 6.2.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.3.0", ">= 4.2.7"])
72
- s.add_dependency(%q<railties>, ["< 5.3.0", ">= 4.2.7"])
66
+ s.add_dependency(%q<rake>.freeze, [">= 10.0"])
67
+ s.add_dependency(%q<activerecord>.freeze, [">= 4.2.7", "< 6.2.0", "!= 5.2.3", "!= 5.2.3.rc1"])
68
+ s.add_dependency(%q<railties>.freeze, [">= 4.2.7", "< 6.2.0", "!= 5.2.3", "!= 5.2.3.rc1"])
73
69
  end
74
70
  end
75
71
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standalone_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.5
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Huss
8
8
  - Michael Grosser
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-26 00:00:00.000000000 Z
12
+ date: 2021-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -29,43 +29,67 @@ dependencies:
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "<"
33
- - !ruby/object:Gem::Version
34
- version: 5.3.0
35
32
  - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: 4.2.7
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: 6.2.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.3.0
45
48
  - - ">="
46
49
  - !ruby/object:Gem::Version
47
50
  version: 4.2.7
51
+ - - "<"
52
+ - !ruby/object:Gem::Version
53
+ version: 6.2.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.3.0
55
64
  - - ">="
56
65
  - !ruby/object:Gem::Version
57
66
  version: 4.2.7
67
+ - - "<"
68
+ - !ruby/object:Gem::Version
69
+ version: 6.2.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.3.0
65
80
  - - ">="
66
81
  - !ruby/object:Gem::Version
67
82
  version: 4.2.7
68
- description:
83
+ - - "<"
84
+ - !ruby/object:Gem::Version
85
+ version: 6.2.0
86
+ - - "!="
87
+ - !ruby/object:Gem::Version
88
+ version: 5.2.3
89
+ - - "!="
90
+ - !ruby/object:Gem::Version
91
+ version: 5.2.3.rc1
92
+ description:
69
93
  email: thuss@gabrito.com
70
94
  executables: []
71
95
  extensions: []
@@ -107,7 +131,7 @@ homepage: http://github.com/thuss/standalone-migrations
107
131
  licenses:
108
132
  - MIT
109
133
  metadata: {}
110
- post_install_message:
134
+ post_install_message:
111
135
  rdoc_options: []
112
136
  require_paths:
113
137
  - lib
@@ -122,9 +146,8 @@ 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
127
- signing_key:
149
+ rubygems_version: 3.1.4
150
+ signing_key:
128
151
  specification_version: 4
129
152
  summary: A thin wrapper to use Rails Migrations in non Rails projects
130
153
  test_files: []