gittyup 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gittyup.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Paul Morganthall
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,76 @@
1
+ ## introduction
2
+
3
+ New users to **git** and **Heroku** sometimes have trouble
4
+ with the syntax and arguments of the git commands required
5
+ to deploy an application to Heroku. This wrapper combines
6
+ the git *add*, *commit*, and *push* commands.
7
+
8
+ The command has no arguments. The user is prompted for a
9
+ commit message. The wrapper contains no error handling,
10
+ so the user will receive standard errors from git.
11
+
12
+ ## installation
13
+ If you have a Gemfile, add **gittyup**. Otherwise, install it like this:
14
+
15
+ $ gem install gittyup
16
+
17
+ ## usage
18
+
19
+ typical usage:
20
+
21
+ $ gittyup
22
+ enter commit message (blank to exit)> New site title
23
+ [master 318bd11] New site title
24
+ 1 files changed, 2 insertions(+), 0 deletions(-)
25
+
26
+ *wait for push to start, then*
27
+
28
+ *lots of messages from Heroku*
29
+
30
+ *until the push ends like this*
31
+
32
+ To git@heroku.com:awesomeproject.git
33
+ 13f987c..aceaf78 master -> master
34
+ $
35
+
36
+ ## detailed operation
37
+ All code is in [bin/gittyup](https://github.com/slothbear/gittyup/blob/master/bin/gittyup).
38
+ An error from any system command causes the script to exit.
39
+
40
+ Since the script is designed for beginning users, it assumes
41
+ you are committing to and pushing the **master** branch.
42
+ If you know enough to have multiple
43
+ branches, you probably don't need this script.
44
+
45
+ The script performs these steps:
46
+
47
+ 1. `git status` If this command fails, the current directory is
48
+ probably not a git repository.
49
+ 1. `git status` If this command provides no output, then there
50
+ are no changed files to commit.
51
+ 1. `git add --all` Add new, changed, and removed files to the index.
52
+ 1. Prompt the user for a commit message. If no message is entered, the script exits.
53
+ 1. `git commit --message <message>` Record changes to the repository.
54
+ 1. `git push heroku master` Deploy the updated repository to Heroku.
55
+
56
+ For every system command performed, the exit status of the
57
+ operation is passed back via `exit $?.exitstatus`. The status
58
+
59
+ ## tests
60
+ A nicely formatted test suite is available at
61
+ [Relish](http://relishapp.com/slothbear/gittyup).
62
+
63
+ To run the tests:
64
+ ```
65
+ $ cd gittyup
66
+ $ bundle
67
+ $ rake
68
+ ```
69
+
70
+ ## contributing
71
+
72
+ 1. Fork it
73
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
74
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
75
+ 4. Push to the branch (`git push origin my-new-feature`)
76
+ 5. Create new Pull Request
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ require 'cucumber'
3
+ require 'cucumber/rake/task'
4
+
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ Cucumber::Rake::Task.new(:features) do |t|
8
+ t.cucumber_opts = "features --format pretty -x"
9
+ t.fork = false
10
+ end
11
+
12
+ task :default => 'features'
13
+
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'readline'
3
+
4
+ # Perform git add, commit, and push to Heroku.
5
+
6
+ status_command = 'git status --porcelain'
7
+ puts "\nChecking git status with: #{status_command}"
8
+ status = %x[#{status_command}]
9
+ exit $?.exitstatus unless $?.success?
10
+
11
+ if status.empty?
12
+ puts '** No files have been changed, created, or removed.'
13
+ exit 1
14
+ end
15
+
16
+ git_add_command = 'git add --all'
17
+ puts "\nStaging files for commit with: #{git_add_command}"
18
+ exit $?.exitstatus unless system(git_add_command)
19
+
20
+ message = Readline.readline('enter commit message (blank to exit)> ')
21
+ git_commit_command_args = ['git', 'commit', '--message', message]
22
+ puts "\nCommiting files with: #{git_commit_command_args.join(' ')}"
23
+ exit $?.exitstatus unless system(*git_commit_command_args)
24
+
25
+ git_push_command = 'git push heroku master'
26
+ puts "\nPushing to heroku with: #{git_push_command}"
27
+ system 'git push heroku master'
28
+ exit $?.exitstatus
29
+
@@ -0,0 +1,46 @@
1
+ Feature: Combine git add, commit, and push into one command
2
+ As an aspiring web developer with little 'git' experience
3
+ I want to deploy my changes to Heroku with one command
4
+ So that everyone in the world can see them
5
+
6
+ Scenario: Successfully add, commit, and (fake) push
7
+ Given a git repository with pending changes
8
+ And there is a git remote named heroku
9
+ When I run `gittyup` interactively
10
+ And I type "more golden retriever puppies"
11
+ # This is not a successful push, but it does talk to Heroku.
12
+ # TODO: the push requires prior Heroku auth setup.
13
+ Then the output should contain "No such app"
14
+ And the exit status should not be 0
15
+
16
+ Scenario: The git repository does not exist
17
+ Given a blank directory
18
+ When I run `gittyup`
19
+ Then the exit status should not be 0
20
+ And the output should contain "Not a git repository"
21
+
22
+ Scenario: No files changed (nothing to commit)
23
+ Given an initialized git repository
24
+ When I run `gittyup`
25
+ Then the exit status should not be 0
26
+ And the output should contain "No files have been changed"
27
+
28
+ Scenario: Errors from git add
29
+ # The exit code from git add could be non-zero if there were
30
+ # errors adding files to the index. How to test?
31
+
32
+ Scenario: Cannot commit without commit message
33
+ Given a git repository with pending changes
34
+ When I run `gittyup` interactively
35
+ And I type ""
36
+ Then the output should contain "empty commit message"
37
+ And the exit status should not be 0
38
+
39
+ Scenario: Cannot push without a remote named 'heroku'
40
+ Given a git repository with indexed changes
41
+ But there is no remote named heroku
42
+ When I run `gittyup` interactively
43
+ And I type "railsbridge workshop changes"
44
+ Then the exit status should not be 0
45
+ And the output should contain "'heroku' does not appear"
46
+
@@ -0,0 +1,7 @@
1
+ New users to git and Heroku sometimes have trouble with the syntax of
2
+ the git commands required to deploy an application to Heroku. This
3
+ wrapper combines the git add, commit, and push commands needed.
4
+
5
+ The command has no arguments. The user is prompted for a commit message.
6
+ The wrapper contains no error handling, so the user will receive errors
7
+ from git.
@@ -0,0 +1,41 @@
1
+ Given /^a blank directory$/ do
2
+ blank_directory
3
+ end
4
+
5
+ Given /^an initialized git repository$/ do
6
+ blank_directory
7
+ run 'git init'
8
+ end
9
+
10
+ Given /^a git repository with pending changes$/ do
11
+ blank_directory
12
+ run 'git init'
13
+ write_file('railsbridge-boston.rb', '')
14
+ end
15
+
16
+ Given /^a git repository with indexed changes$/ do
17
+ blank_directory
18
+ run 'git init'
19
+ write_file('railsbridge-boston.rb', '')
20
+ run 'git add -all'
21
+ end
22
+
23
+ Given /^there is no remote named heroku$/ do
24
+ run_simple(unescape('git remote rm heroku'), false)
25
+ end
26
+
27
+ Given /^there is a git remote named heroku$/ do
28
+ # The only the step that uses the heroku remote needs more time.
29
+ # Tried 'run for up to 15 seconds', still failed at 3 seconds.
30
+ @aruba_timeout_seconds = 15
31
+
32
+ steps %Q{
33
+ Given I successfully run `git remote add heroku git@heroku.com:gittyup_test_app.git`
34
+ }
35
+ end
36
+
37
+ def blank_directory
38
+ create_dir('repository')
39
+ cd('repository')
40
+ end
41
+
@@ -0,0 +1,16 @@
1
+ require 'aruba/cucumber'
2
+
3
+ Before do
4
+ # The default ./tmp/aruba directory can't be used because it is a
5
+ # subdir of the gem directory, already part of a git repository.
6
+ # We are responsible for cleaning the directory on startup.
7
+ # Being careful, we only clean items we know we created.
8
+ temp_dir = '/tmp/aruba/gittyup/'
9
+ FileUtils.rm_rf(temp_dir + 'repository/.git', :secure => true)
10
+ FileUtils.rm_f(temp_dir + 'repository/railsbridge-boston.rb')
11
+ FileUtils.rmdir(temp_dir + 'repository')
12
+ FileUtils.rmdir(temp_dir)
13
+
14
+ @dirs = [temp_dir]
15
+ end
16
+
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gittyup/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "gittyup"
8
+ gem.version = Gittyup::VERSION
9
+ gem.authors = ["Paul Morganthall"]
10
+ gem.email = ["pcm@morganthall.com"]
11
+ gem.description = %q{New users to git and Heroku sometimes have trouble
12
+ with the syntax of the git commands required to deploy
13
+ an application to Heroku. This wrapper combines
14
+ the git add, commit, and push commands needed. The
15
+ command has no arguments. The user is prompted for a
16
+ commit message. The wrapper contains no error handling,
17
+ so the user will receive errors from git.
18
+ }
19
+ gem.summary = %q{wrapper for git add/commit/push to Heroku}
20
+ gem.homepage = "http://github.com/slothbear/gittyup"
21
+
22
+ gem.files = `git ls-files`.split($/)
23
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
24
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
25
+ gem.require_paths = ["lib"]
26
+
27
+ gem.add_development_dependency('aruba', '~> 0.5.1')
28
+ end
@@ -0,0 +1,5 @@
1
+ require "gittyup/version"
2
+
3
+ module Gittyup
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Gittyup
2
+ VERSION = "1.0.3"
3
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gittyup
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Paul Morganthall
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: aruba
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.5.1
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.5.1
30
+ description: ! "New users to git and Heroku sometimes have trouble\n with
31
+ the syntax of the git commands required to deploy\n an application
32
+ to Heroku. This wrapper combines\n the git add, commit,
33
+ and push commands needed. The\n command has no arguments.
34
+ The user is prompted for a\n commit message. The wrapper
35
+ contains no error handling,\n so the user will receive errors
36
+ from git.\n "
37
+ email:
38
+ - pcm@morganthall.com
39
+ executables:
40
+ - gittyup
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE.txt
47
+ - README.md
48
+ - Rakefile
49
+ - bin/gittyup
50
+ - features/adcopu.feature
51
+ - features/readme.md
52
+ - features/step_definitions/adcopu_steps.rb
53
+ - features/support/env.rb
54
+ - gittyup.gemspec
55
+ - lib/gittyup.rb
56
+ - lib/gittyup/version.rb
57
+ homepage: http://github.com/slothbear/gittyup
58
+ licenses: []
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 1.8.24
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: wrapper for git add/commit/push to Heroku
81
+ test_files:
82
+ - features/adcopu.feature
83
+ - features/readme.md
84
+ - features/step_definitions/adcopu_steps.rb
85
+ - features/support/env.rb