Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reflection

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reflection

  • 0.5.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= 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 git@your-shared-repository.git

This will clone git@your-shared-repository.git 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 git@your-shared-repository.git \ --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 git@your-shared-repository.git \ --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 git@your-shared-repository.git \ --rails /rails/root \ --rails-env development

This clones or pulls git@your-shared-repository.git (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

Copyright (c) 2009 Andreas Wolff. See LICENSE for details.

FAQs

Package last updated on 01 Dec 2009

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc