forked from lostapathy/yaml_db
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98e9a5d
commit bc2560c
Showing
10 changed files
with
222 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
branches: | ||
only: | ||
- 'master' | ||
rvm: | ||
- 1.9.2 | ||
script: "bundle exec rspec spec" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source "http://rubygems.org" | ||
|
||
group :development do | ||
gem 'jeweler' | ||
gem 'rspec' | ||
gem 'rake' | ||
gem 'rails' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
actionmailer (3.2.9) | ||
actionpack (= 3.2.9) | ||
mail (~> 2.4.4) | ||
actionpack (3.2.9) | ||
activemodel (= 3.2.9) | ||
activesupport (= 3.2.9) | ||
builder (~> 3.0.0) | ||
erubis (~> 2.7.0) | ||
journey (~> 1.0.4) | ||
rack (~> 1.4.0) | ||
rack-cache (~> 1.2) | ||
rack-test (~> 0.6.1) | ||
sprockets (~> 2.2.1) | ||
activemodel (3.2.9) | ||
activesupport (= 3.2.9) | ||
builder (~> 3.0.0) | ||
activerecord (3.2.9) | ||
activemodel (= 3.2.9) | ||
activesupport (= 3.2.9) | ||
arel (~> 3.0.2) | ||
tzinfo (~> 0.3.29) | ||
activeresource (3.2.9) | ||
activemodel (= 3.2.9) | ||
activesupport (= 3.2.9) | ||
activesupport (3.2.9) | ||
i18n (~> 0.6) | ||
multi_json (~> 1.0) | ||
arel (3.0.2) | ||
builder (3.0.4) | ||
diff-lcs (1.1.3) | ||
erubis (2.7.0) | ||
git (1.2.5) | ||
hike (1.2.1) | ||
i18n (0.6.1) | ||
jeweler (1.8.4) | ||
bundler (~> 1.0) | ||
git (>= 1.2.5) | ||
rake | ||
rdoc | ||
journey (1.0.4) | ||
json (1.7.5) | ||
mail (2.4.4) | ||
i18n (>= 0.4.0) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
mime-types (1.19) | ||
multi_json (1.5.0) | ||
polyglot (0.3.3) | ||
rack (1.4.1) | ||
rack-cache (1.2) | ||
rack (>= 0.4) | ||
rack-ssl (1.3.2) | ||
rack | ||
rack-test (0.6.2) | ||
rack (>= 1.0) | ||
rails (3.2.9) | ||
actionmailer (= 3.2.9) | ||
actionpack (= 3.2.9) | ||
activerecord (= 3.2.9) | ||
activeresource (= 3.2.9) | ||
activesupport (= 3.2.9) | ||
bundler (~> 1.0) | ||
railties (= 3.2.9) | ||
railties (3.2.9) | ||
actionpack (= 3.2.9) | ||
activesupport (= 3.2.9) | ||
rack-ssl (~> 1.3.2) | ||
rake (>= 0.8.7) | ||
rdoc (~> 3.4) | ||
thor (>= 0.14.6, < 2.0) | ||
rake (10.0.3) | ||
rdoc (3.12) | ||
json (~> 1.4) | ||
rspec (2.12.0) | ||
rspec-core (~> 2.12.0) | ||
rspec-expectations (~> 2.12.0) | ||
rspec-mocks (~> 2.12.0) | ||
rspec-core (2.12.2) | ||
rspec-expectations (2.12.1) | ||
diff-lcs (~> 1.1.3) | ||
rspec-mocks (2.12.1) | ||
sprockets (2.2.2) | ||
hike (~> 1.2) | ||
multi_json (~> 1.0) | ||
rack (~> 1.0) | ||
tilt (~> 1.1, != 1.3.0) | ||
thor (0.16.0) | ||
tilt (1.3.3) | ||
treetop (1.4.12) | ||
polyglot | ||
polyglot (>= 0.3.1) | ||
tzinfo (0.3.35) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
jeweler | ||
rails | ||
rake | ||
rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.2.2 | ||
1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Generated by jeweler | ||
# DO NOT EDIT THIS FILE DIRECTLY | ||
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' | ||
# -*- encoding: utf-8 -*- | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "gitlab_yaml_db" | ||
s.version = "1.0.0" | ||
|
||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
s.authors = ["Adam Wiggins", "Orion Henry"] | ||
s.date = "2012-12-28" | ||
s.description = "\nGitLab fork. YamlDb is a database-independent format for dumping and restoring data. It complements the the database-independent schema format found in db/schema.rb. The data is saved into db/data.yml.\nThis can be used as a replacement for mysqldump or pg_dump, but only for the databases typically used by Rails apps. Users, permissions, schemas, triggers, and other advanced database features are not supported - by design.\nAny database that has an ActiveRecord adapter should work\n" | ||
s.email = "nate@ludicast.com" | ||
s.extra_rdoc_files = [ | ||
"README.markdown" | ||
] | ||
s.files = [ | ||
"README.markdown", | ||
"Rakefile", | ||
"VERSION", | ||
"about.yml", | ||
"init.rb", | ||
"lib/csv_db.rb", | ||
"lib/serialization_helper.rb", | ||
"lib/tasks/yaml_db_tasks.rake", | ||
"lib/yaml_db.rb", | ||
"spec/base.rb", | ||
"spec/serialization_helper_base_spec.rb", | ||
"spec/serialization_helper_dump_spec.rb", | ||
"spec/serialization_helper_load_spec.rb", | ||
"spec/serialization_utils_spec.rb", | ||
"spec/yaml_dump_spec.rb", | ||
"spec/yaml_load_spec.rb", | ||
"spec/yaml_utils_spec.rb" | ||
] | ||
s.homepage = "http://github.com/ludicast/yaml_db" | ||
s.require_paths = ["lib"] | ||
s.rubygems_version = "1.8.23" | ||
s.summary = "yaml_db allows export/import of database into/from yaml files" | ||
|
||
if s.respond_to? :specification_version then | ||
s.specification_version = 3 | ||
|
||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then | ||
s.add_development_dependency(%q<jeweler>, [">= 0"]) | ||
s.add_development_dependency(%q<rspec>, [">= 0"]) | ||
s.add_development_dependency(%q<rake>, [">= 0"]) | ||
s.add_development_dependency(%q<rails>, [">= 0"]) | ||
else | ||
s.add_dependency(%q<jeweler>, [">= 0"]) | ||
s.add_dependency(%q<rspec>, [">= 0"]) | ||
s.add_dependency(%q<rake>, [">= 0"]) | ||
s.add_dependency(%q<rails>, [">= 0"]) | ||
end | ||
else | ||
s.add_dependency(%q<jeweler>, [">= 0"]) | ||
s.add_dependency(%q<rspec>, [">= 0"]) | ||
s.add_dependency(%q<rake>, [">= 0"]) | ||
s.add_dependency(%q<rails>, [">= 0"]) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,50 @@ | ||
require File.dirname(__FILE__) + '/base' | ||
|
||
describe YamlDb::Dump do | ||
|
||
before do | ||
silence_warnings { ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true) } | ||
ActiveRecord::Base.stub(:connection).and_return(stub('connection').as_null_object) | ||
ActiveRecord::Base.connection.stub!(:tables).and_return([ 'mytable', 'schema_info', 'schema_migrations' ]) | ||
ActiveRecord::Base.connection.stub!(:columns).with('mytable').and_return([ mock('a',:name => 'a', :type => :string), mock('b', :name => 'b', :type => :string) ]) | ||
ActiveRecord::Base.connection.stub!(:select_one).and_return({"count"=>"2"}) | ||
ActiveRecord::Base.connection.stub!(:select_all).and_return([ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ]) | ||
YamlDb::Utils.stub!(:quote_table).with('mytable').and_return('mytable') | ||
end | ||
|
||
before(:each) do | ||
File.stub!(:new).with('dump.yml', 'w').and_return(StringIO.new) | ||
@io = StringIO.new | ||
end | ||
|
||
it "should return a formatted string" do | ||
YamlDb::Dump.table_record_header(@io) | ||
@io.rewind | ||
@io.read.should == " records: \n" | ||
end | ||
|
||
|
||
it "should return a yaml string that contains a table header and column names" do | ||
YamlDb::Dump.stub!(:table_column_names).with('mytable').and_return([ 'a', 'b' ]) | ||
YamlDb::Dump.dump_table_columns(@io, 'mytable') | ||
@io.rewind | ||
@io.read.should == <<EOYAML | ||
--- | ||
mytable: | ||
columns: | ||
before do | ||
silence_warnings { ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true) } | ||
ActiveRecord::Base.stub(:connection).and_return(stub('connection').as_null_object) | ||
ActiveRecord::Base.connection.stub!(:tables).and_return([ 'mytable', 'schema_info', 'schema_migrations' ]) | ||
ActiveRecord::Base.connection.stub!(:columns).with('mytable').and_return([ mock('a',:name => 'a', :type => :string), mock('b', :name => 'b', :type => :string) ]) | ||
ActiveRecord::Base.connection.stub!(:select_one).and_return({"count"=>"2"}) | ||
ActiveRecord::Base.connection.stub!(:select_all).and_return([ { 'a' => 1, 'b' => 2 }, { 'a' => 3, 'b' => 4 } ]) | ||
YamlDb::Utils.stub!(:quote_table).with('mytable').and_return('mytable') | ||
end | ||
|
||
before(:each) do | ||
File.stub!(:new).with('dump.yml', 'w').and_return(StringIO.new) | ||
@io = StringIO.new | ||
end | ||
|
||
it "should return a formatted string" do | ||
YamlDb::Dump.table_record_header(@io) | ||
@io.rewind | ||
@io.read.should == " records: \n" | ||
end | ||
|
||
it "should return a yaml string that contains a table header and column names" do | ||
YamlDb::Dump.stub!(:table_column_names).with('mytable').and_return([ 'a', 'b' ]) | ||
YamlDb::Dump.dump_table_columns(@io, 'mytable') | ||
@io.rewind | ||
@io.read.should == <<EOYAML | ||
--- | ||
mytable: | ||
columns: | ||
- a | ||
- b | ||
EOYAML | ||
end | ||
end | ||
|
||
it "should return dump the records for a table in yaml to a given io stream" do | ||
YamlDb::Dump.dump_table_records(@io, 'mytable') | ||
@io.rewind | ||
@io.read.should == <<EOYAML | ||
it "should return dump the records for a table in yaml to a given io stream" do | ||
YamlDb::Dump.dump_table_records(@io, 'mytable') | ||
@io.rewind | ||
@io.read.should == <<EOYAML | ||
records: | ||
- - 1 | ||
- 2 | ||
- - 3 | ||
- 4 | ||
EOYAML | ||
end | ||
|
||
|
||
|
||
end | ||
end |
This file was deleted.
Oops, something went wrong.