Giter Club home page Giter Club logo

data_sync's Introduction

Data sync

Rails plugin for syncing production database and files to local development server.

Install

To install, just add Data sync to your vendor/plugins directory:

rails plugin install git://github.com/carr/data_sync.git

Requirements

  • Capistrano
  • add gem capistrano to your Gemfile

Usage

For pulling the database of the remote server

rake db:pull

For pulling the database and the files of the remote server

rake data:pull

MongoDB

If you're planning to use this with MongoDB your config/database.yml should use mongodb as adapter value.

  • development:
  • adapter: mongodb
  • database: surveys-development
  • host: localhost
  • ...

And initalizer for MongoDB in config/initializers/mongo.rb default_mongodb_port = 27107

database_configurations = YAML::load(File.read(Rails.root.join('config', 'database.yml')))

if database_configurations[Rails.env] && database_configurations[Rails.env]['adapter'] == 'mongodb'
    database = database_configurations[Rails.env]
    database['port'] ||= default_mongodb_port

    MongoMapper.connection = Mongo::Connection.new(database['hostname'], database['port'])
    MongoMapper.database = database['database']

    if defined?(PhusionPassenger)
        PhusionPassenger.on_event(:starting_worker_process) do |forked|
            MongoMapper.connection.connect_to_master if forked
        end
    end
end

TODO

  • Prompt ("All files will be overwritten..")
  • database and files push
  • change usage to "push:files", "push:db", "push:data", "pull:files", "pull:db", "pull:files"
  • refactor rake task, duplicate code

data_sync's People

Contributors

carr avatar nixa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.