standalone_migrations 5.2.6 → 5.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/lib/standalone_migrations/configurator.rb +1 -0
- data/lib/standalone_migrations/generator.rb +11 -0
- data/spec/standalone_migrations_spec.rb +10 -5
- data/standalone_migrations.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1986b7008c08a82adc6dbd07e8731ad127014200
|
4
|
+
data.tar.gz: 22956c9490c328faad68aa63c47081aa7b146aa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6b4fbf516b740a3486bba884cb352db9a7eef4600158b28f8750559153235edc126315623f23f01256edc4c041d87ea6ec27a7b450a6582445e1a8593ea8231
|
7
|
+
data.tar.gz: af3bc755672e629d99df9a092089696dceb8dd3e654be182c57169031e20be2c31a10485ee67cb345df66e651d3f9c94e41fdf86a552785b4103a15a28900c22
|
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ gem 'activerecord', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 5.3.0"]
|
|
5
5
|
gem 'railties', ENV['AR'] ? ENV['AR'].split(",") : [">= 4.2.7", "< 5.3.0"]
|
6
6
|
|
7
7
|
group :dev do
|
8
|
-
gem 'sqlite3'
|
8
|
+
gem 'sqlite3', '~> 1.3.6'
|
9
9
|
gem 'rspec', '>= 2.99.0'
|
10
10
|
gem 'jeweler'
|
11
11
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.2.
|
1
|
+
5.2.7
|
@@ -42,6 +42,7 @@ module StandaloneMigrations
|
|
42
42
|
}
|
43
43
|
@options = load_from_file(defaults.dup) || defaults.merge(options)
|
44
44
|
|
45
|
+
ENV['SCHEMA'] = schema
|
45
46
|
Rails.application.config.root = root
|
46
47
|
Rails.application.config.paths["config/database"] = config
|
47
48
|
Rails.application.config.paths["db/migrate"] = migrate_dir
|
@@ -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,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?
|
@@ -87,6 +90,7 @@ end
|
|
87
90
|
`rm -rf spec/tmp` if File.exist?('spec/tmp')
|
88
91
|
`mkdir spec/tmp`
|
89
92
|
write_rakefile
|
93
|
+
write(schema, '')
|
90
94
|
write 'db/config.yml', <<-TXT
|
91
95
|
development:
|
92
96
|
adapter: sqlite3
|
@@ -254,16 +258,15 @@ test:
|
|
254
258
|
|
255
259
|
describe 'schema:dump' do
|
256
260
|
it "dumps the schema" do
|
257
|
-
write(
|
261
|
+
write(schema, '')
|
258
262
|
run('rake db:schema:dump')
|
259
|
-
expect(read(
|
263
|
+
expect(read(schema)).to match(/ActiveRecord/)
|
260
264
|
end
|
261
265
|
end
|
262
266
|
|
263
267
|
describe 'db:schema:load' do
|
264
268
|
it "loads the schema" do
|
265
269
|
run('rake db:schema:dump')
|
266
|
-
schema = "db/schema.rb"
|
267
270
|
write(schema, read(schema)+"\nputs 'LOADEDDD'")
|
268
271
|
result = run('rake db:schema:load')
|
269
272
|
expect(result).to match(/LOADEDDD/)
|
@@ -292,11 +295,13 @@ test:
|
|
292
295
|
|
293
296
|
describe 'db:test:load' do
|
294
297
|
it 'loads' do
|
295
|
-
write(
|
298
|
+
write(schema, "puts 'LOADEDDD'")
|
296
299
|
expect(run("rake db:test:load")).to match(/LOADEDDD/)
|
297
300
|
end
|
298
301
|
|
299
302
|
it "fails without schema" do
|
303
|
+
schema_path = "spec/tmp/#{schema}"
|
304
|
+
`rm -rf #{schema_path}` if File.exist?(schema_path)
|
300
305
|
expect(lambda{ run("rake db:test:load") }).to raise_error(/try again/)
|
301
306
|
end
|
302
307
|
end
|
@@ -2,16 +2,16 @@
|
|
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
|
+
# stub: standalone_migrations 5.2.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "standalone_migrations"
|
9
|
-
s.version = "5.2.
|
9
|
+
s.version = "5.2.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Todd Huss", "Michael Grosser"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2019-02-08"
|
15
15
|
s.email = "thuss@gabrito.com"
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
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.
|
4
|
+
version: 5.2.7
|
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:
|
12
|
+
date: 2019-02-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|