Giter Club home page Giter Club logo

reflection's Introduction

Reflection

Reflection is designed to keep your development system in sync with your production system’s files and database (by dumping). It uses a shared git repository to store these files, which allows you to mirror your production environment without the need of direct access to your production servers.

It provides two main command modes:

  • Stash: Indented to be run on the server side, adds a specified directory and, optionally, a database dump to a shared Git repository

  • Apply: To be used on a local development machine, gets content from the repository, copies it to a specified directory and optionally loads the database dump into your local database

Get it

Reflection is a gem, hosted on Gemcutter:

gem install reflection

Stashing your production data

The simplest form:

$ reflection --stash --directory /path/to/your/assets --repository [email protected]

This will clone [email protected] and add the directory /path/to/your/assets to the repository. Reflection keeps a local version of your repository in HOME/.reflection/stash. So the next time you run the command, there is no need of cloning it again.

Now, lets include a database dump

$ reflection  --stash \ 
              --directory /path/to/your/assets \ 
              --repository [email protected] \ 
              --rails /rails/root \
              --rails-env production

This does the same as above, but additionally dumps your production database and adds the fresh dump to your repository.

I’m lazy..

You too, aren’t you? So Reflection allows you to store all command line options in a config file.

$ reflection  --stash \ 
              --directory /path/to/your/assets \ 
              --repository [email protected] \ 
              --rails /rails/root \ 
              --rails-env production \ 
              --write /path/to/your/config

The next time you want to run the same command as above (useful for cron), you could simply call Reflection with:

$ reflection /path/to/your/config

Getting the production stuff on your local development machine

This works exactly the same as describe above, but you would use –apply instead of –stash:

$ reflection  --apply \ 
              --directory /path/to/your/assets \ 
              --repository [email protected] \ 
              --rails /rails/root \ 
              --rails-env development

This clones or pulls [email protected] (again, Reflection keeps a version of your Repository in HOME/.reflection/apply), copies the content to the specified directory (e.g. rails/application/public/assets) and optionally loads the dump into your database.

As you may have noticed, the Reflection command above got called with --rails-env development, which loads the dump in your development database (as defined by /rails/root/config/database.yml).

A little productivity hint

If you have a reflection.yml config file in your current application-development-directory, syncing your server-production environment is as easy as running:

$ reflection

reflection –help

$ reflection --help
Usage: reflection --COMMAND --repository=GIT_REPO --directory=PATH
 -or-
Usage: reflection /path/to/reflection-config-file.yml

On the server side:
    -s, --stash                      Store your assets and/or a database dump in a git-repository.
On the client side:
    -a, --apply                      Apply assets and/or a database dump loaded from a git-repository.

Required options for both:
    -r, --repository GIT_URL         A Git repository(url) to be used as storage
    -d, --directory PATH             Path to your asset directory

Additional options for both:
        --rails [RAILS_ROOT]         Enable dumping/applying of a Rails managed MySQL database
        --rails-env [ENV]            Rails environment to instrument
        --write [FILE]               Create a configuration FILE from the current commandline options
        --force                      Hide tedious warnings
    -v, --verbose                    Include debug information in output
        --version                    Show version

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add specs for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2009 Andreas Wolff. See LICENSE for details.

reflection's People

Contributors

basiszwo avatar

Stargazers

Angus H. avatar Pantelis Koukousoulas avatar Nathan Doyle avatar Ali Thanikkal avatar Tai Hoang avatar Satsang Nation avatar Dennis Rogenius avatar Benjamin Fleischer avatar Venu Keesari avatar John Jansen avatar Embado avatar Lin He avatar Oleg Efimov avatar Peter P. Gengler avatar Eric Kreutzer avatar Ole-Morten Duesund avatar Moises Eskinazi avatar  avatar mlzboy avatar Wong Liang Zan avatar Kirk A. Howard avatar Vlad Semenov avatar Andrew McElroy avatar Chris Irish avatar Hans verschooten avatar Lance Pollard avatar andy kvamme avatar Jan Varwig avatar  avatar Preston Lee avatar Maurizio De Magnis avatar Lee Hambley avatar Nick Hammond avatar Simon Chiu avatar Justin Smestad avatar Reiner Dieterich avatar Filipe Rocha avatar Sam Mingo avatar Logan avatar Manuel Vidaurre avatar Carlos Paramio avatar  avatar Y0rTz avatar Attila Györffy avatar Ravi Duvvuri avatar Henry Hamon avatar Aaron Glenn avatar raecoo avatar Nilesh Chaudhari avatar Stewart Laufer avatar David Wabnitz avatar ROhan Kini avatar Andriy Tyurnikov avatar Allen Bargi avatar Fabio Akita avatar Matt avatar Alain Ravet avatar Orlin M Bozhinov avatar Libin Pan avatar Zeke Sikelianos avatar Andreas Wolff avatar Gustavo Barron avatar Timothy Johnson avatar Frank Oxener avatar Greg Weber avatar Ant Ramm avatar PabloC avatar Christos Zisopoulos avatar Nicholas Mulder avatar Joao Vitor Lacerda Guimaraes avatar Ravil Bayramgalin avatar

Watchers

James Cloos avatar  avatar

Forkers

basiszwo nviennot

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.