Skip to content

Commit

Permalink
Merge 7a543d4 into 1895365
Browse files Browse the repository at this point in the history
  • Loading branch information
seanhuber committed Sep 21, 2017
2 parents 1895365 + 7a543d4 commit 3d7f90e
Show file tree
Hide file tree
Showing 84 changed files with 528 additions and 1,807 deletions.
21 changes: 11 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.bundle/
log/*.log
pkg/
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3-journal
spec/dummy/log/*.log
spec/dummy/tmp/
spec/dummy/.sass-cache
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

*.log
Gemfile.lock
# rspec failure tracking
.rspec_status
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--color
--require spec_helper
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false
language: ruby
rvm:
- 2.1.10
- 2.3.3
before_install: gem install bundler -v 1.15.4
16 changes: 4 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
source 'https://rubygems.org'

#ruby=ruby-2.1.10
#ruby=ruby-2.3.3
#ruby-gemset=db-clone

# Declare your gem's dependencies in db-clone.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# To use a debugger
# gem 'byebug', group: [:development, :test]
# Specify your gem's dependencies in db-clone.gemspec
gemspec
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Sean Huber

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
20 changes: 0 additions & 20 deletions MIT-LICENSE

This file was deleted.

41 changes: 22 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
DbClone
==============
[![Gem Version](https://badge.fury.io/rb/db-clone.svg)](https://badge.fury.io/rb/db-clone)
[![Build Status](https://travis-ci.org/seanhuber/db-clone.svg?branch=master)](https://travis-ci.org/seanhuber/db-clone)
[![Coverage Status](https://coveralls.io/repos/github/seanhuber/db-clone/badge.svg?branch=master)](https://coveralls.io/github/seanhuber/db-clone?branch=master)

![Screenshot](https://cdn.rawgit.com/seanhuber/db-clone/master/screenshot.png)

Requirements
-----------------

Rails >= 4.0 and Ruby >= 2.1.
# db-clone

DbClone requires `mysqldump` (for MySQL) and/or `pg_dump` (for PostgreSQL).
![Screenshot](https://cdn.rawgit.com/seanhuber/db-clone/master/screenshot.png)

## Requirements

Installation
-----------------
Ruby >= 2.3

Add to `gem 'db-clone', require: 'db_clone'` to your `Gemfile` and `bundle install`.
db-clone requires `mysqldump` (for MySQL) and/or `pg_dump` (for PostgreSQL).

## Installation

Add to `gem 'db-clone', '~> 2.0'` to your `Gemfile` and `bundle install`.

Usage
-----------------
## Usage

To clone your `production` database to `development`, run:

rake db:clone
```
rake db:clone
```

If you have more database blocks (besides `production` and `development`) defined in `config/database.yml`, you can clone between these databases using DbClone's CLI:

rake db:clone[manual]
```
rake db:clone[manual]
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/seanhuber/db-clone.

License
-----------------
## License

MIT-LICENSE.
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
33 changes: 13 additions & 20 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

Bundler::GemHelper.install_tasks

APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
load 'rails/tasks/engine.rake'

Bundler::GemHelper.install_tasks

Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }

require 'rspec/core'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'db/clone'

desc 'Run all specs in spec directory (excluding plugin specs)'
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
RSpec::Core::RakeTask.new(:spec)

task default: :spec
task :default => :spec

Db::Clone.setup do |config|
config.database_yml_path = File.join 'spec', 'sample_database.yml'
# config.default_source_database = 'production'
# config.default_destination_database = 'development'
# config.default_source_database = 'uat2'
# config.default_destination_database = 'test'
config.ignore_tables = ['first_ignore', 'second_ignore']
end
Empty file removed app/assets/images/db_clone/.keep
Empty file.
13 changes: 0 additions & 13 deletions app/assets/javascripts/db_clone/application.js

This file was deleted.

15 changes: 0 additions & 15 deletions app/assets/stylesheets/db_clone/application.css

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/db_clone/application_controller.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/helpers/db_clone/application_helper.rb

This file was deleted.

14 changes: 0 additions & 14 deletions app/views/layouts/db_clone/application.html.erb

This file was deleted.

14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "db/clone"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
12 changes: 0 additions & 12 deletions bin/rails

This file was deleted.

8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
2 changes: 0 additions & 2 deletions config/routes.rb

This file was deleted.

5 changes: 0 additions & 5 deletions coverage/.last_run.json

This file was deleted.

0 comments on commit 3d7f90e

Please sign in to comment.