merge_db 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/README +0 -0
- data/Rakefile +2 -0
- data/bin/merge_db +38 -0
- data/config/database.yml +29 -0
- data/config/merge.rb +3 -0
- data/db.thor +24 -0
- data/features/merge.feature +94 -0
- data/features/step_definitions/database_steps.rb +77 -0
- data/features/support/env.rb +27 -0
- data/features/support/hooks.rb +5 -0
- data/features/support/models.rb +11 -0
- data/features/support/schema.rb +8 -0
- data/lib/merge_db/configuration.rb +16 -0
- data/lib/merge_db/merger.rb +190 -0
- data/lib/merge_db/version.rb +3 -0
- data/lib/merge_db.rb +19 -0
- data/merge_db.gemspec +32 -0
- metadata +174 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.2-p290@merge-db
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
guard 'cucumber', :cli => '-c --drb --no-profile --format pretty' do
|
2
|
+
watch(%r{^features/.+\.feature$})
|
3
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
4
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
5
|
+
end
|
data/README
ADDED
File without changes
|
data/Rakefile
ADDED
data/bin/merge_db
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
4
|
+
|
5
|
+
require "rubygems"
|
6
|
+
require "thor"
|
7
|
+
require 'merge_db'
|
8
|
+
|
9
|
+
class Db < Thor
|
10
|
+
desc "merge", "merge two databases"
|
11
|
+
method_option :source, :aliases => "-s", :required => true, :desc => "Records will be copied from this database"
|
12
|
+
method_option :target, :aliases => "-t", :required => true, :desc => "Records will be inserted into this database"
|
13
|
+
|
14
|
+
def merge
|
15
|
+
source = options[:source]
|
16
|
+
target = options[:target]
|
17
|
+
|
18
|
+
MergeDb::Merger.new(:source => source, :target => target).merge
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "restore", "restore associations"
|
22
|
+
method_option :target, :aliases => "-t", :required => true, :desc => "Database for restoring"
|
23
|
+
def restore
|
24
|
+
target = options[:target]
|
25
|
+
|
26
|
+
MergeDb::Merger.new(:target => target).restore_associations
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "prepare", "creates columns to store ids from source database"
|
30
|
+
method_option :target, :aliases => "-t", :required => true, :desc => "database into which data will be copied"
|
31
|
+
def prepare
|
32
|
+
target = options[:target]
|
33
|
+
|
34
|
+
MergeDb::Merger.new(:target => target).prepare
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Db.start
|
data/config/database.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
adapter: mysql2
|
3
|
+
encoding: utf8
|
4
|
+
host: localhost
|
5
|
+
reconnect: false
|
6
|
+
|
7
|
+
db_first:
|
8
|
+
database: db_first
|
9
|
+
username: root
|
10
|
+
password: ''
|
11
|
+
<<: *defaults
|
12
|
+
|
13
|
+
db_second:
|
14
|
+
database: db_second
|
15
|
+
username: root
|
16
|
+
password: ''
|
17
|
+
<<: *defaults
|
18
|
+
|
19
|
+
db_third:
|
20
|
+
database: db_third
|
21
|
+
username: root
|
22
|
+
password: ''
|
23
|
+
<<: *defaults
|
24
|
+
|
25
|
+
db_target:
|
26
|
+
database: db_target
|
27
|
+
username: root
|
28
|
+
password: ''
|
29
|
+
<<: *defaults
|
data/config/merge.rb
ADDED
data/db.thor
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib')
|
2
|
+
|
3
|
+
require 'merge_db'
|
4
|
+
|
5
|
+
class Db < Thor
|
6
|
+
desc "merge", "merge two databases"
|
7
|
+
method_option :source, :aliases => "-s", :required => true, :desc => "Records will be copied from this database"
|
8
|
+
method_option :target, :aliases => "-t", :required => true, :desc => "Records will be inserted into this database"
|
9
|
+
|
10
|
+
def merge
|
11
|
+
source = options[:source]
|
12
|
+
target = options[:target]
|
13
|
+
|
14
|
+
MergeDb::Merger.new(:source => source, :target => target).merge
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "prepare", "creates columns to store ids from source database"
|
18
|
+
method_option :target, :aliases => "-t", :required => true, :desc => "database into which data will be copied"
|
19
|
+
def prepare
|
20
|
+
target = options[:target]
|
21
|
+
|
22
|
+
MergeDb::Merger.new(:target => target).prepare
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
Feature: Background
|
2
|
+
In order to migrate from multiple databases to single database in my application
|
3
|
+
As a developer
|
4
|
+
I want to merge all databases
|
5
|
+
|
6
|
+
Scenario:
|
7
|
+
Given a schema "old.rb":
|
8
|
+
"""
|
9
|
+
Schema.define do
|
10
|
+
create_table "users" do |t|
|
11
|
+
t.integer "id"
|
12
|
+
t.string "name"
|
13
|
+
t.integer "group_id"
|
14
|
+
end
|
15
|
+
|
16
|
+
create_table "groups", :force => true do |t|
|
17
|
+
t.integer "id"
|
18
|
+
t.string "name"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
"""
|
22
|
+
Given a schema "new.rb":
|
23
|
+
"""
|
24
|
+
Schema.define do
|
25
|
+
create_table "users" do |t|
|
26
|
+
t.integer "id"
|
27
|
+
t.string "name"
|
28
|
+
t.integer "group_id"
|
29
|
+
end
|
30
|
+
|
31
|
+
create_table "groups", :force => true do |t|
|
32
|
+
t.integer "id"
|
33
|
+
t.string "name"
|
34
|
+
end
|
35
|
+
|
36
|
+
create_table "studios", :force => true do |t|
|
37
|
+
t.integer "id"
|
38
|
+
t.string "db_name"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
"""
|
42
|
+
Given a database named "db_first" with schema "old.rb"
|
43
|
+
And a database named "db_second" with schema "old.rb"
|
44
|
+
And a database named "db_third" with schema "old.rb"
|
45
|
+
And a database named "db_target" with schema "new.rb"
|
46
|
+
And a table "users" in "db_first" with:
|
47
|
+
| id | name | group_id |
|
48
|
+
| 1 | John | 1 |
|
49
|
+
| 2 | Marry | 2 |
|
50
|
+
| 3 | Jane | 2 |
|
51
|
+
And a table "groups" in "db_first" with:
|
52
|
+
| id | name |
|
53
|
+
| 1 | First |
|
54
|
+
| 2 | Second |
|
55
|
+
And a table "users" in "db_second" with:
|
56
|
+
| id | name | group_id |
|
57
|
+
| 1 | Jeff | 1 |
|
58
|
+
| 2 | Frank | 1 |
|
59
|
+
| 3 | Adam | 2 |
|
60
|
+
And a table "groups" in "db_second" with:
|
61
|
+
| id | name |
|
62
|
+
| 1 | First 2 |
|
63
|
+
| 2 | Second 2 |
|
64
|
+
And a table "users" in "db_third" with:
|
65
|
+
| id | name | group_id |
|
66
|
+
| 1 | Piter | 1 |
|
67
|
+
| 2 | James | 2 |
|
68
|
+
| 3 | Bill | 3 |
|
69
|
+
And a table "groups" in "db_third" with:
|
70
|
+
| id | name |
|
71
|
+
| 1 | One |
|
72
|
+
| 2 | Two |
|
73
|
+
| 3 | Three |
|
74
|
+
When I prepare "db_target"
|
75
|
+
When I merge "db_first" into "db_target"
|
76
|
+
And I merge "db_second" into "db_target"
|
77
|
+
And I merge "db_third" into "db_target"
|
78
|
+
# When I run in shell "thor db:merge -s db_source -t db_target"
|
79
|
+
# Then I should see "Databases were merged."
|
80
|
+
When I connected to "db_target"
|
81
|
+
Then 9 users should exist
|
82
|
+
And 7 groups should exist
|
83
|
+
Then the following users should exist:
|
84
|
+
| name | groups.name | studios.db_name |
|
85
|
+
| Piter | One | db_third |
|
86
|
+
| James | Two | db_third |
|
87
|
+
| Bill | Three | db_third |
|
88
|
+
| John | First | db_first |
|
89
|
+
| Marry | Second | db_first |
|
90
|
+
| Jane | Second | db_first |
|
91
|
+
| Jeff | First 2 | db_second |
|
92
|
+
| Frank | First 2 | db_second |
|
93
|
+
| Adam | Second 2 | db_second |
|
94
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
Given /^a schema "([^"]*)":$/ do |schema_name, string|
|
2
|
+
Given %|a file named "temp/#{schema_name}" with:|, string
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^a database named "([^"]*)" with schema "([^"]*)"$/ do |db_name, schema_name|
|
6
|
+
connection.drop_database db_name
|
7
|
+
connection.create_database db_name
|
8
|
+
|
9
|
+
created_databases << db_name
|
10
|
+
|
11
|
+
connection.execute("use #{db_name}")
|
12
|
+
|
13
|
+
schema = File.read("./tmp/aruba/temp/#{schema_name}")
|
14
|
+
|
15
|
+
instance_eval schema
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I run in shell "([^"]*)"$/ do |command|
|
19
|
+
@output = `#{command}`
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I prepare "([^"]*)"$/ do |target|
|
23
|
+
MergeDb::Merger.new(:target => target).prepare
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^I merge "([^"]*)" into "([^"]*)"$/ do |source, target|
|
27
|
+
MergeDb::Merger.new(:source => source, :target => target).merge
|
28
|
+
end
|
29
|
+
|
30
|
+
Then /^I should see "([^"]*)"$/ do |str|
|
31
|
+
@output.should include(str)
|
32
|
+
end
|
33
|
+
|
34
|
+
Then /^I should see the output$/ do
|
35
|
+
puts @output
|
36
|
+
end
|
37
|
+
|
38
|
+
Given /^a table "([^"]*)" in "([^"]*)" with:$/ do |table_name, db_name, data|
|
39
|
+
connection.execute("use #{db_name}")
|
40
|
+
|
41
|
+
data.hashes.each do |fixture|
|
42
|
+
connection.insert_fixture(fixture, table_name)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
When /^I use "([^"]*)"$/ do |arg1|
|
47
|
+
pending # express the regexp above with the code you wish you had
|
48
|
+
end
|
49
|
+
|
50
|
+
When /^I connected to "([^"]*)"$/ do |db_name|
|
51
|
+
connection.execute("use #{db_name}")
|
52
|
+
end
|
53
|
+
|
54
|
+
Then /^(\d+) (\w+)?s should exist$/ do |count, model_name|
|
55
|
+
model = model_name.camelize.constantize
|
56
|
+
model.count.should == count.to_i
|
57
|
+
end
|
58
|
+
|
59
|
+
Then /^the following (\w+)?s should exist:$/ do |model_name, table|
|
60
|
+
model = model_name.camelize.constantize
|
61
|
+
|
62
|
+
join_tables = table.column_names.collect { |name| name.split(".").first.singularize.to_sym if name =~ /\w+\.\w+/ }.delete_if(&:nil?)
|
63
|
+
|
64
|
+
table.hashes.each do |attributes|
|
65
|
+
model.joins(join_tables).where(attributes).should_not be_empty, "expected to find a record with attributes: #{attributes}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Then /^the following groups should exist:$/ do |table|
|
70
|
+
# table is a Cucumber::Ast::Table
|
71
|
+
pending # express the regexp above with the code you wish you had
|
72
|
+
end
|
73
|
+
|
74
|
+
Then /debug/ do
|
75
|
+
debugger
|
76
|
+
a = 1
|
77
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
+
require 'aruba/cucumber'
|
3
|
+
require 'active_record'
|
4
|
+
require 'ruby-debug'
|
5
|
+
require 'merge_db'
|
6
|
+
|
7
|
+
module CustomData
|
8
|
+
def connection
|
9
|
+
ActiveRecord::Base.establish_connection(connection_params) unless ActiveRecord::Base.connected?
|
10
|
+
ActiveRecord::Base.connection
|
11
|
+
end
|
12
|
+
|
13
|
+
def connection_params
|
14
|
+
{
|
15
|
+
:adapter => 'mysql2',
|
16
|
+
:host => 'localhost',
|
17
|
+
:username => 'root',
|
18
|
+
:password => '',
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def created_databases
|
23
|
+
@databases ||= []
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
World(CustomData)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module MergeDb
|
2
|
+
class Configuration
|
3
|
+
class << self
|
4
|
+
attr_accessor :scope_name, :scoped_tables
|
5
|
+
|
6
|
+
def scoped_tables
|
7
|
+
@scoped_tables || []
|
8
|
+
end
|
9
|
+
|
10
|
+
def database
|
11
|
+
require 'erb'
|
12
|
+
YAML::load(ERB.new(IO.read('./config/database.yml')).result)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
module MergeDb
|
2
|
+
class Source < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
|
5
|
+
class Target < ActiveRecord::Base
|
6
|
+
end
|
7
|
+
|
8
|
+
class Merger
|
9
|
+
|
10
|
+
def initialize(params)
|
11
|
+
@source_name = params[:source]
|
12
|
+
@target_name = params[:target]
|
13
|
+
end
|
14
|
+
|
15
|
+
def prepare
|
16
|
+
prepare_tables_in_target
|
17
|
+
end
|
18
|
+
|
19
|
+
def merge
|
20
|
+
add_db_to_scope
|
21
|
+
copy_data_from_source_to_target
|
22
|
+
restore_association_references
|
23
|
+
clean_backedup_primary_keys
|
24
|
+
end
|
25
|
+
|
26
|
+
def restore_associations
|
27
|
+
restore_association_references
|
28
|
+
clean_backedup_primary_keys
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def prepare_tables_in_target
|
34
|
+
puts "Prepare target"
|
35
|
+
|
36
|
+
pbar = ProgressBar.new("tables", targte.tables.size)
|
37
|
+
|
38
|
+
target.tables.each do |table|
|
39
|
+
|
40
|
+
pbar.inc
|
41
|
+
|
42
|
+
add_scope_id_column(table) if Configuration.scoped_tables.include? table
|
43
|
+
|
44
|
+
target.columns(table)
|
45
|
+
.find_all {|column| column.name =~ /id$/}
|
46
|
+
.each do |column|
|
47
|
+
add_backup_id_column(table, column)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
pbar.finish
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_db_to_scope
|
55
|
+
@scope_id = target.insert("insert into #{Configuration.scope_name.pluralize} (db_name) values ('#{@source_name}')")
|
56
|
+
end
|
57
|
+
|
58
|
+
def copy_data_from_source_to_target
|
59
|
+
puts "Copy data into target"
|
60
|
+
|
61
|
+
source.tables.each do |table|
|
62
|
+
puts "\nCopy #{table} records "
|
63
|
+
query = "select * from #{table}"
|
64
|
+
|
65
|
+
records = source.select_all(query)
|
66
|
+
|
67
|
+
pbar = ProgressBar.new("#{table}", records.size)
|
68
|
+
|
69
|
+
records.each do |fixture|
|
70
|
+
|
71
|
+
pbar.inc
|
72
|
+
|
73
|
+
fixture_with_saved_ids = prepare_for_merge(fixture)
|
74
|
+
|
75
|
+
if Configuration.scoped_tables.include? table
|
76
|
+
fixture_with_saved_ids[scope_id_column] = @scope_id
|
77
|
+
end
|
78
|
+
|
79
|
+
target.insert_fixture(fixture_with_saved_ids, table)
|
80
|
+
end
|
81
|
+
|
82
|
+
pbar.finish
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def restore_association_references
|
87
|
+
puts "Restore association references"
|
88
|
+
|
89
|
+
target.tables.each do |table|
|
90
|
+
query = "select * from #{table}"
|
91
|
+
|
92
|
+
restored_columns = Hash.new {|hash, key| hash[key] = [] }
|
93
|
+
|
94
|
+
records = target.select_all(query)
|
95
|
+
|
96
|
+
pbar = ProgressBar.new("#{table}", records.size)
|
97
|
+
|
98
|
+
records.each do |record|
|
99
|
+
pbar.inc
|
100
|
+
record.each do |column, old_id|
|
101
|
+
if column =~ /__id$/ && !old_id.nil? && !restored_columns[column].include?(old_id)
|
102
|
+
|
103
|
+
restored_columns[column] << old_id
|
104
|
+
|
105
|
+
if association = find_association_by_old_id(column, old_id)
|
106
|
+
|
107
|
+
new_id = association["id"]
|
108
|
+
|
109
|
+
update_query = "update #{table} set #{normalize_column_name(column)} = #{new_id} where #{column} = #{old_id}"
|
110
|
+
target.update(update_query)
|
111
|
+
else
|
112
|
+
ActiveRecord::Base.logger.error "Can't find #{column} with old id: #{old_id}"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
pbar.finish
|
119
|
+
|
120
|
+
unless restored_columns.empty?
|
121
|
+
columns_with_null = restored_columns.keys.collect {|column| "#{column} = NULL"}.join(", ")
|
122
|
+
query = "update #{table} set #{columns_with_null}"
|
123
|
+
target.execute(query)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def clean_backedup_primary_keys
|
129
|
+
source.tables.each do |table|
|
130
|
+
query = "update #{table} set _id = NULL"
|
131
|
+
|
132
|
+
target.execute(query)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def add_backup_id_column(table, column)
|
137
|
+
target.add_column(table, backup_column_name(column.name), column.type)
|
138
|
+
end
|
139
|
+
|
140
|
+
def add_scope_id_column(table)
|
141
|
+
target.add_column(table, scope_id_column, :integer)
|
142
|
+
end
|
143
|
+
|
144
|
+
def scope_id_column
|
145
|
+
Configuration.scope_name + "_id"
|
146
|
+
end
|
147
|
+
|
148
|
+
def find_association_by_old_id(column, value)
|
149
|
+
association_table = column.split("__").first.pluralize
|
150
|
+
query = "select * from #{association_table} where _id = #{value}"
|
151
|
+
association = target.select_one(query)
|
152
|
+
end
|
153
|
+
|
154
|
+
def prepare_for_merge(fixture)
|
155
|
+
{}.tap do |new_fixture|
|
156
|
+
fixture.each do |key, value|
|
157
|
+
new_fixture[backup_column_name(key)] = value
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def backup_column_name(name)
|
163
|
+
if name =~ /id$/
|
164
|
+
name = name.gsub(/id$/, "_id")
|
165
|
+
else
|
166
|
+
name
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def normalize_column_name(name)
|
171
|
+
name.gsub(/__id$/, '_id')
|
172
|
+
end
|
173
|
+
|
174
|
+
def target
|
175
|
+
@target_connection ||= connect(Target, @target_name)
|
176
|
+
end
|
177
|
+
|
178
|
+
def source
|
179
|
+
@source_connection ||= connect(Source, @source_name)
|
180
|
+
end
|
181
|
+
|
182
|
+
def connect(constant, db_name)
|
183
|
+
if db_name
|
184
|
+
constant.establish_connection(Configuration.database[db_name])
|
185
|
+
constant.connection
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
data/lib/merge_db.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'active_record'
|
7
|
+
# require 'ruby-debug'
|
8
|
+
require 'logger'
|
9
|
+
require 'progressbar'
|
10
|
+
|
11
|
+
require 'merge_db/configuration'
|
12
|
+
require 'merge_db/merger'
|
13
|
+
|
14
|
+
ActiveRecord::Base.logger = Logger.new('log.txt')
|
15
|
+
|
16
|
+
module MergeDb
|
17
|
+
end
|
18
|
+
|
19
|
+
require "./config/merge.rb"
|
data/merge_db.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "merge_db/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "merge_db"
|
7
|
+
s.version = MergeDb::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Pavel Gabriel"]
|
10
|
+
s.email = ["alovak@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Merge your Rails databases}
|
13
|
+
s.description = %q{With merge db you can easily merge your databases and save all associations}
|
14
|
+
|
15
|
+
s.rubyforge_project = "merge_db"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_development_dependency "cucumber"
|
23
|
+
s.add_development_dependency "aruba"
|
24
|
+
s.add_development_dependency "guard"
|
25
|
+
s.add_development_dependency "guard-cucumber"
|
26
|
+
s.add_development_dependency "ruby-debug19"
|
27
|
+
|
28
|
+
s.add_runtime_dependency "thor"
|
29
|
+
s.add_runtime_dependency "activerecord"
|
30
|
+
s.add_runtime_dependency "mysql2"
|
31
|
+
s.add_runtime_dependency "ruby-progressbar"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: merge_db
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pavel Gabriel
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-04 00:00:00.000000000 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cucumber
|
17
|
+
requirement: &2157140920 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2157140920
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: aruba
|
28
|
+
requirement: &2157140480 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2157140480
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: guard
|
39
|
+
requirement: &2157140060 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2157140060
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: guard-cucumber
|
50
|
+
requirement: &2157139640 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2157139640
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: ruby-debug19
|
61
|
+
requirement: &2157139180 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *2157139180
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: thor
|
72
|
+
requirement: &2157138760 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *2157138760
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: activerecord
|
83
|
+
requirement: &2157138280 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *2157138280
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: mysql2
|
94
|
+
requirement: &2157137760 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :runtime
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *2157137760
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: ruby-progressbar
|
105
|
+
requirement: &2157137300 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :runtime
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *2157137300
|
114
|
+
description: With merge db you can easily merge your databases and save all associations
|
115
|
+
email:
|
116
|
+
- alovak@gmail.com
|
117
|
+
executables:
|
118
|
+
- merge_db
|
119
|
+
extensions: []
|
120
|
+
extra_rdoc_files: []
|
121
|
+
files:
|
122
|
+
- .gitignore
|
123
|
+
- .rvmrc
|
124
|
+
- Gemfile
|
125
|
+
- Guardfile
|
126
|
+
- README
|
127
|
+
- Rakefile
|
128
|
+
- bin/merge_db
|
129
|
+
- config/database.yml
|
130
|
+
- config/merge.rb
|
131
|
+
- db.thor
|
132
|
+
- features/merge.feature
|
133
|
+
- features/step_definitions/database_steps.rb
|
134
|
+
- features/support/env.rb
|
135
|
+
- features/support/hooks.rb
|
136
|
+
- features/support/models.rb
|
137
|
+
- features/support/schema.rb
|
138
|
+
- lib/merge_db.rb
|
139
|
+
- lib/merge_db/configuration.rb
|
140
|
+
- lib/merge_db/merger.rb
|
141
|
+
- lib/merge_db/version.rb
|
142
|
+
- merge_db.gemspec
|
143
|
+
has_rdoc: true
|
144
|
+
homepage: ''
|
145
|
+
licenses: []
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
none: false
|
158
|
+
requirements:
|
159
|
+
- - ! '>='
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubyforge_project: merge_db
|
164
|
+
rubygems_version: 1.6.2
|
165
|
+
signing_key:
|
166
|
+
specification_version: 3
|
167
|
+
summary: Merge your Rails databases
|
168
|
+
test_files:
|
169
|
+
- features/merge.feature
|
170
|
+
- features/step_definitions/database_steps.rb
|
171
|
+
- features/support/env.rb
|
172
|
+
- features/support/hooks.rb
|
173
|
+
- features/support/models.rb
|
174
|
+
- features/support/schema.rb
|