GithubHelp home page GithubHelp logo

slothbear / gittyup Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 255 KB

RailsBridge wrapper for git add/commit/push to Heroku

Home Page: http://www.railsbridgeboston.org/curriculum/deploy_to_heroku

License: MIT License

Ruby 100.00%

gittyup's Introduction

Gem Version

introduction

New users to git and Heroku sometimes have trouble with the syntax and arguments of the git commands required to deploy an application to Heroku. This wrapper combines the git add, commit, and push commands.

The command has no arguments. The user is prompted for a commit message. The wrapper contains no error handling, so the user will receive standard errors from git.

installation

If you have a Gemfile, add gittyup. Otherwise, install it like this:

$ gem install gittyup

usage

typical usage:

$ gittyup
enter commit message (blank to exit)> New site title
[master 318bd11] New site title
 1 files changed, 2 insertions(+), 0 deletions(-)

wait for push to start, then

lots of messages from Heroku

until the push ends like this

To [email protected]:awesomeproject.git
   13f987c..aceaf78  master -> master
$

detailed operation

All code is in bin/gittyup. An error from any system command causes the script to exit.

Since the script is designed for beginning users, it assumes you are committing to and pushing the master branch. If you know enough to have multiple branches, you probably don't need this script.

The script performs these steps:

  1. git status If this command fails, the current directory is probably not a git repository.
  2. git status If this command provides no output, then there are no changed files to commit.
  3. git add --all Add new, changed, and removed files to the index.
  4. Prompt the user for a commit message. If no message is entered, the script exits.
  5. git commit --message <message> Record changes to the repository.
  6. git push heroku master Deploy the updated repository to Heroku.

For every system command performed, the exit status of the operation is passed back via exit $?.exitstatus. That status is used by the tests.

tests

A nicely formatted test suite is available at Relish.

To run the tests:

    $ cd gittyup
    $ bundle
    $ rake

contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

gittyup's People

Contributors

dpickett avatar slothbear avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bcarreno dpickett

gittyup's Issues

Enable push of previously committed changed

There are a couple of cases where gittyup will not push changes to Heroku, even though there are changes available to push.

  • If you add and commit your changes by hand, then call gittyup, it quits with the message ** No files have been changed, created, or removed. This happens because gittyup exits if git status returns no files (it is only examining the working area and the index).
  • If gittyup was used previously, and the push did not complete, another invocation of gittyup would yield the same message as above.

If it makes sense to fix this hole, git diff --shortstat heroku/master could be added. Exit only if both git status and git diff return nothing. Is there a better way to check for un-pushed changes?

Include rake db:migrate?

In both the February and March workshops, some students had trouble with their applications on Heroku. They had forgotten to heroku run rake db:migrate

A couple students using gittyup thought it should include the migration. Students sitting right next to them thought the migration was better done manually to give them an idea of what's going on.

Since the error message (missing table, missing column) is easy to recognize (for a TA), I currently favor leaving the migration as a manual step. Other opinions are very welcome. ๐ŸŒŸ

Mock the test call to Heroku.

Since the push to Heroku is designed to fail (with a random repository name), it makes sense to mock the call. The extended timeout can be removed too.

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.