datafix 0.0.2
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 +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +54 -0
- data/Rakefile +2 -0
- data/datafix.gemspec +26 -0
- data/lib/datafix.rb +56 -0
- data/lib/datafix/railtie.rb +7 -0
- data/lib/datafix/version.rb +3 -0
- data/lib/datafixes.rb +2 -0
- data/lib/generators/datafix/USAGE.md +22 -0
- data/lib/generators/datafix/datafix_generator.rb +20 -0
- data/lib/generators/datafix/install/USAGE.md +14 -0
- data/lib/generators/datafix/install/install_generator.rb +25 -0
- data/lib/generators/datafix/install/templates/migration.rb +14 -0
- data/lib/generators/datafix/templates/datafix_spec_template.rb.erb +12 -0
- data/lib/generators/datafix/templates/datafix_template.rb.erb +7 -0
- data/lib/tasks/db/datafix.rake +41 -0
- data/spec/lib/datafix_spec.rb +69 -0
- data/spec/lib/tasks/datafix_rspec.rb +42 -0
- data/spec/spec_helper.rb +75 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c2e3e8da571a3bd7df4b2a46867f39f48afa96ea
|
4
|
+
data.tar.gz: 20869acf6db09da707ac2909a012eeb83c0a5d16
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 963e3bbbb5f71310d6103242ac5f73ea4b60bc5e4d05d2eb6230290ed994bb1602de8002fd73a09c08c8ad64bd8c64372e317cc1136a71f7f3cd1e8f2db2d7b1
|
7
|
+
data.tar.gz: 2432646f4fa4b89a1dff3729e21f7624ccf58a2299a4e2f1083378d688bd6c2668189b70b51b63e84f9a57031a788c5a36e6a40b079f235e9eeff40fa5399d85
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 TODO: Case Commons, LLC
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Datafix
|
2
|
+
|
3
|
+
Datafix provides a template generator for documenting and testing database hotfixes
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'datafix', :github => 'Casecommons/datafix'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
$ rails g datafix:install
|
15
|
+
$ rake db:migrate
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Generate a timestamped datafix script with some boilerplate for execution.
|
20
|
+
|
21
|
+
rails g datafix MyGroovyName
|
22
|
+
|
23
|
+
This will create:
|
24
|
+
|
25
|
+
db/datafixes/YYYYMMDDhhmmss_my_groovy_name.rb
|
26
|
+
|
27
|
+
and
|
28
|
+
|
29
|
+
spec/db/datafixes/YYYYMMDDhhmmss_my_groovy_name_spec.rb
|
30
|
+
|
31
|
+
To run it, execute:
|
32
|
+
|
33
|
+
rake db:datafix[:up] NAME=my_groovy_name
|
34
|
+
|
35
|
+
or
|
36
|
+
|
37
|
+
rake db:datafix[:up] NAME=MyGroovyName
|
38
|
+
|
39
|
+
run the down with:
|
40
|
+
|
41
|
+
rake db:datafix:down NAME=my_groovy_name
|
42
|
+
|
43
|
+
To run the spec, execute:
|
44
|
+
|
45
|
+
rspec spec/db/datafixes/YYYYMMDDhhmmss_my_groovy_name_spec.rb
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create new Pull Request
|
54
|
+
|
data/Rakefile
ADDED
data/datafix.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/datafix/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Case Commons, LLC"]
|
6
|
+
gem.email = ['casecommons-dev@googlegroups.com', 'andrew@johnandrewmarshall.com']
|
7
|
+
gem.description = %q{Datafix provides a generator for documenting and testing database hotfixes}
|
8
|
+
gem.summary = %q{Datafix provides a generator for documenting and testing database hotfixes}
|
9
|
+
gem.homepage = "https://github.com/Casecommons/datafix"
|
10
|
+
|
11
|
+
gem.add_dependency "activerecord"
|
12
|
+
gem.add_dependency "railties"
|
13
|
+
gem.add_dependency "pg"
|
14
|
+
|
15
|
+
gem.add_development_dependency "rspec"
|
16
|
+
gem.add_development_dependency "database_cleaner"
|
17
|
+
gem.add_development_dependency "rake"
|
18
|
+
gem.add_development_dependency "pry"
|
19
|
+
|
20
|
+
gem.files = `git ls-files`.split($\)
|
21
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
22
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
23
|
+
gem.name = "datafix"
|
24
|
+
gem.require_paths = ["lib"]
|
25
|
+
gem.version = Datafix::VERSION
|
26
|
+
end
|
data/lib/datafix.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "datafixes"
|
2
|
+
require "datafix/version"
|
3
|
+
require "datafix/railtie" if defined?(Rails)
|
4
|
+
|
5
|
+
class Datafix
|
6
|
+
class << self
|
7
|
+
DIRECTIONS = %w[up down]
|
8
|
+
|
9
|
+
def migrate(direction)
|
10
|
+
raise ArgumentError unless DIRECTIONS.include?(direction)
|
11
|
+
|
12
|
+
ActiveRecord::Base.transaction do
|
13
|
+
send(direction.to_sym)
|
14
|
+
log_run(direction)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def log_run(direction)
|
21
|
+
name = self.name.camelize.split('::').tap(&:shift).join('::')
|
22
|
+
puts "migrating #{name} #{direction}"
|
23
|
+
|
24
|
+
execute(<<-SQL)
|
25
|
+
INSERT INTO datafix_log
|
26
|
+
(direction, script, timestamp)
|
27
|
+
VALUES ('#{direction}', '#{name.camelize}', NOW())
|
28
|
+
SQL
|
29
|
+
end
|
30
|
+
|
31
|
+
def connection
|
32
|
+
@connection ||= ActiveRecord::Base.connection
|
33
|
+
end
|
34
|
+
|
35
|
+
def execute(*args)
|
36
|
+
connection.execute(*args)
|
37
|
+
end
|
38
|
+
|
39
|
+
def table_exists?(table_name)
|
40
|
+
ActiveRecord::Base.connection.table_exists? table_name
|
41
|
+
end
|
42
|
+
|
43
|
+
def archive_table(table_name)
|
44
|
+
log "Archive #{table_name} for Rollback" if self.respond_to?(:log)
|
45
|
+
execute "CREATE TABLE archived_#{table_name} ( LIKE #{table_name} INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES )"
|
46
|
+
execute "INSERT INTO archived_#{table_name} SELECT * FROM #{table_name}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def revert_archive_table(table_name)
|
50
|
+
log "Move old #{table_name} back" if self.respond_to?(:log)
|
51
|
+
execute "TRUNCATE TABLE #{table_name}"
|
52
|
+
execute "INSERT INTO #{table_name} SELECT * FROM archived_#{table_name}"
|
53
|
+
execute "DROP TABLE archived_#{table_name}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/datafixes.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
## Description
|
2
|
+
This generator will create a timestamped script with some boilerplate for execution.
|
3
|
+
|
4
|
+
## Example
|
5
|
+
|
6
|
+
rails generate datafix MyGroovyName
|
7
|
+
|
8
|
+
This will create:
|
9
|
+
|
10
|
+
db/datafixes/YYYYMMDDhhmmss_my_groovy_name.rb
|
11
|
+
|
12
|
+
To run it, execute:
|
13
|
+
|
14
|
+
rake db:datafix NAME=my_groovy_name
|
15
|
+
|
16
|
+
or
|
17
|
+
|
18
|
+
rake db:datafix NAME=MyGroovyName
|
19
|
+
|
20
|
+
run the down with:
|
21
|
+
|
22
|
+
rake db:datafix:down NAME=my_groovy_name
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class DatafixGenerator < Rails::Generators::NamedBase
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
PATH = 'db/datafixes'
|
4
|
+
|
5
|
+
def generate
|
6
|
+
raise "Datafix with name '#{file_name}' already exists" if Dir.glob("#{PATH}/*_#{file_name}.rb").any?
|
7
|
+
|
8
|
+
template "datafix_template.rb.erb", "#{PATH}/#{timestamp}_#{file_name}.rb"
|
9
|
+
|
10
|
+
if Rails.application.config.generators.rails[:test_framework] == :rspec
|
11
|
+
template "datafix_spec_template.rb.erb", "spec/#{PATH}/#{timestamp}_#{file_name}_spec.rb"
|
12
|
+
else
|
13
|
+
puts "Datafix test was not generated. Datafix requires rspec."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def timestamp
|
18
|
+
@timestamp ||= Time.now.strftime("%Y%m%d%H%M%S")
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
## Description
|
2
|
+
This generates a migration to create the datafix\_log table necessary for the datafix tasks and specs
|
3
|
+
|
4
|
+
## Example
|
5
|
+
|
6
|
+
rails generate datafix:install
|
7
|
+
|
8
|
+
This will create:
|
9
|
+
|
10
|
+
db/migrate/YYYYMMDDhhmmss_create_datafix_log.rb
|
11
|
+
|
12
|
+
To run it, execute:
|
13
|
+
|
14
|
+
rake db:migrate
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
class Datafix
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
extend ActiveRecord::Generators::Migration
|
8
|
+
|
9
|
+
# Implement the required interface for Rails::Generators::Migration.
|
10
|
+
|
11
|
+
source_root File.expand_path("../templates", __FILE__)
|
12
|
+
|
13
|
+
def generate
|
14
|
+
migration_dir = "db/migrate"
|
15
|
+
migration_name = "create_datafix_log"
|
16
|
+
if ActiveRecord::Generators::Base.migration_exists?(migration_dir, migration_name)
|
17
|
+
raise "Another migration is already named #{migration_name}: #{migration_dir}"
|
18
|
+
else
|
19
|
+
migration_number = ActiveRecord::Generators::Base.next_migration_number(migration_dir)
|
20
|
+
copy_file "migration.rb", "#{migration_dir}/#{migration_number}_#{migration_name}.rb"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require Rails.root.join("db", "datafixes", "<%= "#{timestamp}_#{file_name}" %>")
|
3
|
+
|
4
|
+
describe Datafixes::<%= file_name.camelize %> do
|
5
|
+
describe ".up" do
|
6
|
+
pending "Needs tests"
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ".down" do
|
10
|
+
pending "Needs tests"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
namespace :db do
|
2
|
+
namespace :datafix do
|
3
|
+
|
4
|
+
desc "Run the 'up' on the passed datafix"
|
5
|
+
task :up => :environment do
|
6
|
+
name = ENV['NAME']
|
7
|
+
raise 'NAME required' if name.blank?
|
8
|
+
|
9
|
+
require path_from_name(name)
|
10
|
+
klass_from_name(name).migrate('up')
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Run the 'down' operation on the passed datafix"
|
14
|
+
task :down => :environment do
|
15
|
+
name = ENV['NAME']
|
16
|
+
raise 'NAME required' if name.blank?
|
17
|
+
|
18
|
+
require path_from_name(name)
|
19
|
+
klass_from_name(name).migrate('down')
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def klass_from_name(name)
|
25
|
+
name = name.split(File::SEPARATOR).last.gsub(/^\d+_/, '').gsub(/.rb$/, '').camelize
|
26
|
+
"Datafixes::#{name}".constantize
|
27
|
+
end
|
28
|
+
|
29
|
+
def path_from_name(name)
|
30
|
+
unless name =~ %r(^db/datafixes/)
|
31
|
+
name = name.underscore
|
32
|
+
name = Dir.glob("db/datafixes/*_#{name}.rb").first
|
33
|
+
end
|
34
|
+
Rails.root.join(name)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Run the 'up' on the passed datafix"
|
40
|
+
task :datafix => 'datafix:up'
|
41
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
class Datafixes::FixKittens < Datafix
|
4
|
+
def self.up
|
5
|
+
table_name = Kitten.table_name
|
6
|
+
archive_table(table_name)
|
7
|
+
execute %Q{ UPDATE #{table_name} SET fixed = 't'; }
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
table_name = Kitten.table_name
|
12
|
+
revert_archive_table(table_name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe Datafix do
|
17
|
+
|
18
|
+
let(:kitten_names) { %w[nyan hobbes stimpy tigger garfield] }
|
19
|
+
let(:table_name) { Kitten.table_name }
|
20
|
+
let(:archived_table_name) { "archived_#{table_name}" }
|
21
|
+
|
22
|
+
before do
|
23
|
+
kitten_names.each do |name|
|
24
|
+
Kitten.create!(name: name)
|
25
|
+
end
|
26
|
+
Kitten.where(fixed: true).should be_empty
|
27
|
+
end
|
28
|
+
|
29
|
+
context "after running fix kittens up" do
|
30
|
+
before do
|
31
|
+
Datafixes::FixKittens.migrate('up')
|
32
|
+
end
|
33
|
+
|
34
|
+
it "fixes all kittens should" do
|
35
|
+
Kitten.where(fixed: false).should be_empty
|
36
|
+
end
|
37
|
+
|
38
|
+
it "creates a kittens archive table" do
|
39
|
+
Kitten.connection.table_exists?(archived_table_name).should be_true
|
40
|
+
Kitten.connection.select_value("SELECT COUNT(*) FROM #{archived_table_name}").to_i.should == kitten_names.size
|
41
|
+
end
|
42
|
+
|
43
|
+
it "updates the datafix log" do
|
44
|
+
datafix_log = DatafixLog.last
|
45
|
+
datafix_log.direction.should == 'up'
|
46
|
+
datafix_log.script.should == 'FixKittens'
|
47
|
+
end
|
48
|
+
|
49
|
+
context "after running fix kittens down" do
|
50
|
+
before do
|
51
|
+
Datafixes::FixKittens.migrate('down')
|
52
|
+
end
|
53
|
+
|
54
|
+
it "unfixes the kittens" do
|
55
|
+
Kitten.where(fixed: true).should be_empty
|
56
|
+
end
|
57
|
+
|
58
|
+
it "removes the kittens archive table" do
|
59
|
+
Kitten.connection.table_exists?("archived_kittens").should be_false
|
60
|
+
end
|
61
|
+
|
62
|
+
it "updates the datafix log" do
|
63
|
+
datafix_log = DatafixLog.last
|
64
|
+
datafix_log.direction.should == 'down'
|
65
|
+
datafix_log.script.should == 'FixKittens'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rake"
|
3
|
+
require "rails/generators"
|
4
|
+
require "generators/datafix/datafix_generator"
|
5
|
+
|
6
|
+
describe "datafix rake tasks" do
|
7
|
+
let(:fix_name) { "fix_kittens" }
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
@rake = Rake::Application.new
|
11
|
+
Rake.application = @rake
|
12
|
+
Rake.application.rake_require "tasks/db/datafix"
|
13
|
+
Rake::Task.define_task(:environment)
|
14
|
+
|
15
|
+
@old_path = Dir.pwd
|
16
|
+
Dir.chdir(Rails.root)
|
17
|
+
Rails::Generators.invoke("datafix", [fix_name])
|
18
|
+
end
|
19
|
+
|
20
|
+
after(:all) do
|
21
|
+
Dir.chdir(@old_path)
|
22
|
+
@old_path = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "up" do
|
26
|
+
it "runs the migration" do
|
27
|
+
require Dir.glob(Rails.root.join("db/datafixes/*_#{fix_name}.rb")).first
|
28
|
+
Datafixes::FixKittens.should_receive(:up)
|
29
|
+
ENV['NAME'] = fix_name
|
30
|
+
@rake["db:datafix:up"].invoke
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "down" do
|
35
|
+
it "runs the migration" do
|
36
|
+
require Dir.glob(Rails.root.join("db/datafixes/*_#{fix_name}.rb")).first
|
37
|
+
Datafixes::FixKittens.should_receive(:down)
|
38
|
+
ENV['NAME'] = fix_name
|
39
|
+
@rake["db:datafix:down"].invoke
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'active_record'
|
5
|
+
require 'database_cleaner'
|
6
|
+
require 'pry'
|
7
|
+
|
8
|
+
require 'pg'
|
9
|
+
require 'datafix'
|
10
|
+
|
11
|
+
PG_SPEC = {
|
12
|
+
:adapter => 'postgresql',
|
13
|
+
:host => 'localhost',
|
14
|
+
:database => 'datafix_test',
|
15
|
+
:username => ENV['USER'],
|
16
|
+
:encoding => 'utf8'
|
17
|
+
}
|
18
|
+
|
19
|
+
ActiveRecord::Base.establish_connection(PG_SPEC.merge('database' => 'postgres', 'schema_search_path' => 'public'))
|
20
|
+
# drops and create need to be performed with a connection to the 'postgres' (system) database
|
21
|
+
# drop the old database (if it exists)
|
22
|
+
ActiveRecord::Base.connection.drop_database PG_SPEC[:database] rescue nil
|
23
|
+
# create new
|
24
|
+
ActiveRecord::Base.connection.create_database(PG_SPEC[:database])
|
25
|
+
ActiveRecord::Base.establish_connection(PG_SPEC)
|
26
|
+
|
27
|
+
ActiveRecord::Migration.create_table :datafix_log do |t|
|
28
|
+
t.string :direction
|
29
|
+
t.string :script
|
30
|
+
t.timestamp :timestamp
|
31
|
+
end
|
32
|
+
|
33
|
+
class DatafixLog < ActiveRecord::Base
|
34
|
+
self.table_name = "datafix_log"
|
35
|
+
end
|
36
|
+
|
37
|
+
ActiveRecord::Migration.create_table :kittens do |t|
|
38
|
+
t.string :name
|
39
|
+
t.boolean :fixed, default: false
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
|
43
|
+
class Kitten < ActiveRecord::Base; end
|
44
|
+
|
45
|
+
require "action_controller/railtie"
|
46
|
+
class TestRailsApp < Rails::Application
|
47
|
+
config.secret_token = "random_secret_token"
|
48
|
+
end
|
49
|
+
|
50
|
+
Rails.application.config.root = File.expand_path("../tmp_rails_app",__FILE__)
|
51
|
+
|
52
|
+
|
53
|
+
RSpec.configure do |config|
|
54
|
+
config.color_enabled = true
|
55
|
+
config.formatter = 'documentation'
|
56
|
+
|
57
|
+
config.before(:suite) do
|
58
|
+
FileUtils.rm_rf(Rails.root)
|
59
|
+
Dir.mkdir(Rails.root)
|
60
|
+
TestRailsApp.initialize!
|
61
|
+
DatabaseCleaner.strategy = :transaction
|
62
|
+
end
|
63
|
+
|
64
|
+
config.before(:each) do
|
65
|
+
DatabaseCleaner.start
|
66
|
+
end
|
67
|
+
|
68
|
+
config.after(:each) do
|
69
|
+
DatabaseCleaner.clean
|
70
|
+
end
|
71
|
+
|
72
|
+
config.after(:suite) do
|
73
|
+
FileUtils.rm_rf(Rails.root)
|
74
|
+
end
|
75
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: datafix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Case Commons, LLC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: railties
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pg
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: database_cleaner
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Datafix provides a generator for documenting and testing database hotfixes
|
112
|
+
email:
|
113
|
+
- casecommons-dev@googlegroups.com
|
114
|
+
- andrew@johnandrewmarshall.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- datafix.gemspec
|
125
|
+
- lib/datafix.rb
|
126
|
+
- lib/datafix/railtie.rb
|
127
|
+
- lib/datafix/version.rb
|
128
|
+
- lib/datafixes.rb
|
129
|
+
- lib/generators/datafix/USAGE.md
|
130
|
+
- lib/generators/datafix/datafix_generator.rb
|
131
|
+
- lib/generators/datafix/install/USAGE.md
|
132
|
+
- lib/generators/datafix/install/install_generator.rb
|
133
|
+
- lib/generators/datafix/install/templates/migration.rb
|
134
|
+
- lib/generators/datafix/templates/datafix_spec_template.rb.erb
|
135
|
+
- lib/generators/datafix/templates/datafix_template.rb.erb
|
136
|
+
- lib/tasks/db/datafix.rake
|
137
|
+
- spec/lib/datafix_spec.rb
|
138
|
+
- spec/lib/tasks/datafix_rspec.rb
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
homepage: https://github.com/Casecommons/datafix
|
141
|
+
licenses: []
|
142
|
+
metadata: {}
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.2.2
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: Datafix provides a generator for documenting and testing database hotfixes
|
163
|
+
test_files:
|
164
|
+
- spec/lib/datafix_spec.rb
|
165
|
+
- spec/lib/tasks/datafix_rspec.rb
|
166
|
+
- spec/spec_helper.rb
|
167
|
+
has_rdoc:
|