requires_shunt 0.0.1
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.
- data/Gemfile +4 -0
- data/Gemfile.lock +92 -0
- data/README.md +33 -0
- data/Rakefile +2 -0
- data/lib/requires_shunt/databases.rake +22 -0
- data/lib/requires_shunt/migration.rb +17 -0
- data/lib/requires_shunt/migration_proxy.rb +10 -0
- data/lib/requires_shunt/railtie.rb +19 -0
- data/lib/requires_shunt/version.rb +10 -0
- data/lib/requires_shunt.rb +7 -0
- data/requires_shunt.gemspec +19 -0
- metadata +79 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
requires_shunt (0.0.1)
|
5
|
+
rails (~> 3.2.8)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (3.2.9)
|
11
|
+
actionpack (= 3.2.9)
|
12
|
+
mail (~> 2.4.4)
|
13
|
+
actionpack (3.2.9)
|
14
|
+
activemodel (= 3.2.9)
|
15
|
+
activesupport (= 3.2.9)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
journey (~> 1.0.4)
|
19
|
+
rack (~> 1.4.0)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.2.1)
|
23
|
+
activemodel (3.2.9)
|
24
|
+
activesupport (= 3.2.9)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
activerecord (3.2.9)
|
27
|
+
activemodel (= 3.2.9)
|
28
|
+
activesupport (= 3.2.9)
|
29
|
+
arel (~> 3.0.2)
|
30
|
+
tzinfo (~> 0.3.29)
|
31
|
+
activeresource (3.2.9)
|
32
|
+
activemodel (= 3.2.9)
|
33
|
+
activesupport (= 3.2.9)
|
34
|
+
activesupport (3.2.9)
|
35
|
+
i18n (~> 0.6)
|
36
|
+
multi_json (~> 1.0)
|
37
|
+
arel (3.0.2)
|
38
|
+
builder (3.0.4)
|
39
|
+
erubis (2.7.0)
|
40
|
+
hike (1.2.1)
|
41
|
+
i18n (0.6.1)
|
42
|
+
journey (1.0.4)
|
43
|
+
json (1.7.4)
|
44
|
+
mail (2.4.4)
|
45
|
+
i18n (>= 0.4.0)
|
46
|
+
mime-types (~> 1.16)
|
47
|
+
treetop (~> 1.4.8)
|
48
|
+
mime-types (1.19)
|
49
|
+
multi_json (1.3.7)
|
50
|
+
polyglot (0.3.3)
|
51
|
+
rack (1.4.1)
|
52
|
+
rack-cache (1.2)
|
53
|
+
rack (>= 0.4)
|
54
|
+
rack-ssl (1.3.2)
|
55
|
+
rack
|
56
|
+
rack-test (0.6.2)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rails (3.2.9)
|
59
|
+
actionmailer (= 3.2.9)
|
60
|
+
actionpack (= 3.2.9)
|
61
|
+
activerecord (= 3.2.9)
|
62
|
+
activeresource (= 3.2.9)
|
63
|
+
activesupport (= 3.2.9)
|
64
|
+
bundler (~> 1.0)
|
65
|
+
railties (= 3.2.9)
|
66
|
+
railties (3.2.9)
|
67
|
+
actionpack (= 3.2.9)
|
68
|
+
activesupport (= 3.2.9)
|
69
|
+
rack-ssl (~> 1.3.2)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
rdoc (~> 3.4)
|
72
|
+
thor (>= 0.14.6, < 2.0)
|
73
|
+
rake (0.9.4)
|
74
|
+
rdoc (3.12)
|
75
|
+
json (~> 1.4)
|
76
|
+
sprockets (2.2.1)
|
77
|
+
hike (~> 1.2)
|
78
|
+
multi_json (~> 1.0)
|
79
|
+
rack (~> 1.0)
|
80
|
+
tilt (~> 1.1, != 1.3.0)
|
81
|
+
thor (0.16.0)
|
82
|
+
tilt (1.3.3)
|
83
|
+
treetop (1.4.12)
|
84
|
+
polyglot
|
85
|
+
polyglot (>= 0.3.1)
|
86
|
+
tzinfo (0.3.35)
|
87
|
+
|
88
|
+
PLATFORMS
|
89
|
+
ruby
|
90
|
+
|
91
|
+
DEPENDENCIES
|
92
|
+
requires_shunt!
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# requires_shunt_
|
2
|
+
|
3
|
+
Allows you to flag your migrations as disruptive to production service. Provides a rake task to inspect if any pending migrations require shunt.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
In your Gemfile, add this line:
|
8
|
+
|
9
|
+
gem "requires_shunt"
|
10
|
+
|
11
|
+
### Usage
|
12
|
+
|
13
|
+
To mark a migration as requiring shunt:
|
14
|
+
|
15
|
+
class DropColumns < ActiveRecord::Migration
|
16
|
+
requires_shunt
|
17
|
+
|
18
|
+
def up
|
19
|
+
# ...
|
20
|
+
end
|
21
|
+
|
22
|
+
def down
|
23
|
+
# ...
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
To determine if migrations if any pending migrations require shunt:
|
28
|
+
|
29
|
+
$ rake db:migrate_requires_shunt?
|
30
|
+
These pending migrations require shunt:
|
31
|
+
20121128212505 DropColumns
|
32
|
+
|
33
|
+
If a shunt is required, the rake task with exit with code 1.
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
namespace :db do
|
4
|
+
|
5
|
+
task :migrate_requires_shunt? => [:environment, :load_config] do
|
6
|
+
pending_migrations = ActiveRecord::Migrator.new(:up, ActiveRecord::Migrator.migrations_paths).pending_migrations
|
7
|
+
migrations_requiring_shunt = pending_migrations.select(&:shunt_required?)
|
8
|
+
|
9
|
+
if migrations_requiring_shunt.any?
|
10
|
+
puts "These pending migrations require shunt:"
|
11
|
+
|
12
|
+
migrations_requiring_shunt.each do |pending_migration|
|
13
|
+
puts ' %4d %s' % [pending_migration.version, pending_migration.name]
|
14
|
+
end
|
15
|
+
|
16
|
+
abort
|
17
|
+
else
|
18
|
+
puts "No pending migrations require shunt."
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RequiresShunt
|
2
|
+
module Migration
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
class_attribute :shunt_required, :instance_writer => false
|
7
|
+
self.shunt_required = false
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def requires_shunt
|
12
|
+
self.shunt_required = true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'requires_shunt'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module RequiresShunt
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
|
7
|
+
rake_tasks do
|
8
|
+
load "requires_shunt/databases.rake"
|
9
|
+
end
|
10
|
+
|
11
|
+
initializer "requires_shunt.initialize" do
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
ActiveRecord::Migration.send(:include, RequiresShunt::Migration)
|
14
|
+
ActiveRecord::MigrationProxy.send(:include, RequiresShunt::MigrationProxy)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'lib/requires_shunt/version')
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'requires_shunt'
|
5
|
+
s.version = RequiresShunt::VERSION::STRING
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.authors = ['David Doan']
|
8
|
+
s.email = ['davedoan@gmail.com']
|
9
|
+
s.homepage = 'https://github.com/davedoan/requires_shunt'
|
10
|
+
s.summary = 'A basic plugin for marking disruptive migrations'
|
11
|
+
s.description = 'Allows marking migrations as requiring shunt'
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
|
16
|
+
s.licenses = ['MIT']
|
17
|
+
|
18
|
+
s.add_dependency 'rails', ['~> 3.2.8']
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: requires_shunt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- David Doan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.8
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.8
|
30
|
+
description: Allows marking migrations as requiring shunt
|
31
|
+
email:
|
32
|
+
- davedoan@gmail.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- Gemfile
|
38
|
+
- Gemfile.lock
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- lib/requires_shunt.rb
|
42
|
+
- lib/requires_shunt/databases.rake
|
43
|
+
- lib/requires_shunt/migration.rb
|
44
|
+
- lib/requires_shunt/migration_proxy.rb
|
45
|
+
- lib/requires_shunt/railtie.rb
|
46
|
+
- lib/requires_shunt/version.rb
|
47
|
+
- requires_shunt.gemspec
|
48
|
+
homepage: https://github.com/davedoan/requires_shunt
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
hash: -475336536989971356
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
hash: -475336536989971356
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.8.24
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: A basic plugin for marking disruptive migrations
|
79
|
+
test_files: []
|