Skip to content

Commit

Permalink
travis, gemfile etc
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaporozhets committed Dec 21, 2012
1 parent 98e9a5d commit bc2560c
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 109 deletions.
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color
6 changes: 6 additions & 0 deletions .travis.yml
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"
8 changes: 8 additions & 0 deletions Gemfile
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
104 changes: 104 additions & 0 deletions Gemfile.lock
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
10 changes: 1 addition & 9 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
# YamlDb
# GitLab fork | YamlDb [![build status](https://secure.travis-ci.org/gitlabhq/yaml_db.png)](https://secure.travis-ci.org/gitlabhq/yaml_db)

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.

This 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.

Any database that has an ActiveRecord adapter should work. This gem is now Rails 3 only. For Rails 2, clone and checkout the Rails2 branch.

## Installation

Simply add to your Gemfile:

gem 'yaml_db'

All rake tasks will then be available to you.

## Usage

rake db:data:dump -> Dump contents of Rails database to db/data.yml
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ require "rspec/core/rake_task"
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "yaml_db"
gem.name = "gitlab_yaml_db"
gem.summary = %Q{yaml_db allows export/import of database into/from yaml files}
gem.description = %Q{
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.
GitLab 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.
This 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.
Any database that has an ActiveRecord adapter should work
}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.2
1.0.0
63 changes: 63 additions & 0 deletions gitlab_yaml_db.gemspec
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

77 changes: 36 additions & 41 deletions spec/yaml_dump_spec.rb
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
56 changes: 0 additions & 56 deletions yaml_db.gemspec

This file was deleted.

0 comments on commit bc2560c

Please sign in to comment.