gitx 2.13.1
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.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/CONTRIBUTING.md +67 -0
- data/Gemfile +4 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +87 -0
- data/Rakefile +5 -0
- data/bin/git-buildtag +6 -0
- data/bin/git-cleanup +7 -0
- data/bin/git-integrate +6 -0
- data/bin/git-nuke +6 -0
- data/bin/git-release +6 -0
- data/bin/git-review +6 -0
- data/bin/git-share +6 -0
- data/bin/git-start +6 -0
- data/bin/git-track +6 -0
- data/bin/git-update +6 -0
- data/gitx.gemspec +37 -0
- data/lib/gitx.rb +8 -0
- data/lib/gitx/cli/base_command.rb +56 -0
- data/lib/gitx/cli/buildtag_command.rb +39 -0
- data/lib/gitx/cli/cleanup_command.rb +45 -0
- data/lib/gitx/cli/integrate_command.rb +94 -0
- data/lib/gitx/cli/nuke_command.rb +62 -0
- data/lib/gitx/cli/release_command.rb +40 -0
- data/lib/gitx/cli/review_command.rb +93 -0
- data/lib/gitx/cli/share_command.rb +15 -0
- data/lib/gitx/cli/start_command.rb +37 -0
- data/lib/gitx/cli/track_command.rb +14 -0
- data/lib/gitx/cli/update_command.rb +35 -0
- data/lib/gitx/configuration.rb +44 -0
- data/lib/gitx/extensions/string.rb +12 -0
- data/lib/gitx/extensions/thor.rb +39 -0
- data/lib/gitx/github.rb +178 -0
- data/lib/gitx/version.rb +3 -0
- data/spec/fixtures/vcr_cassettes/pull_request_does_exist_with_failure_status.yml +135 -0
- data/spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status.yml +149 -0
- data/spec/fixtures/vcr_cassettes/pull_request_does_not_exist.yml +133 -0
- data/spec/gitx/cli/base_command_spec.rb +41 -0
- data/spec/gitx/cli/buildtag_command_spec.rb +70 -0
- data/spec/gitx/cli/cleanup_command_spec.rb +37 -0
- data/spec/gitx/cli/integrate_command_spec.rb +290 -0
- data/spec/gitx/cli/nuke_command_spec.rb +165 -0
- data/spec/gitx/cli/release_command_spec.rb +172 -0
- data/spec/gitx/cli/review_command_spec.rb +356 -0
- data/spec/gitx/cli/share_command_spec.rb +32 -0
- data/spec/gitx/cli/start_command_spec.rb +96 -0
- data/spec/gitx/cli/track_command_spec.rb +31 -0
- data/spec/gitx/cli/update_command_spec.rb +79 -0
- data/spec/spec_helper.rb +86 -0
- data/spec/support/global_config.rb +26 -0
- data/spec/support/home_env.rb +11 -0
- data/spec/support/matchers/meet_expectations_matcher.rb +7 -0
- data/spec/support/pry.rb +1 -0
- data/spec/support/stub_execution.rb +14 -0
- data/spec/support/timecop.rb +9 -0
- data/spec/support/vcr.rb +6 -0
- data/spec/support/webmock.rb +1 -0
- metadata +348 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ae23c0140c764302c1c7cc84a1f05344f50f4459
|
4
|
+
data.tar.gz: fde7992a4535128773c335cf41ee88dc84de6487
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d77a7dd2291a7978410485d2dd2c470892aa65bd4be6688678f2b539b23024acd2975250e5a11595d28ab7e77a62efa9b885b182207c0a1494de896e645f653
|
7
|
+
data.tar.gz: 7fbde0cd2c143ce9230e5a8d0f898b342e213562469a1ea50ed25b1f077dee461b91de67e96258a0465108e65e24c20a4785958b69bebc8b659085daacd3f2cd
|
data/.gitignore
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## GIT
|
17
|
+
*.orig
|
18
|
+
|
19
|
+
## PROJECT::GENERAL
|
20
|
+
coverage
|
21
|
+
rdoc
|
22
|
+
pkg
|
23
|
+
|
24
|
+
## bundler
|
25
|
+
Gemfile.lock
|
26
|
+
|
27
|
+
## RSpec temp files
|
28
|
+
spec/tmp
|
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.2
|
data/.travis.yml
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Development Workflow
|
2
|
+
|
3
|
+
## Resources
|
4
|
+
* [Git Workflow Presentation](https://docs.google.com/presentation/d/1euOiki_e4OQ4jymGhS-o3xcET8-KZhDONUolDlOVT30/edit?usp=sharing)
|
5
|
+
* [git extensions gem](https://github.com/wireframe/gitx)
|
6
|
+
|
7
|
+
## Step 1: Create feature branch...
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ git start my-feature-branch
|
11
|
+
```
|
12
|
+
|
13
|
+
* The `start` command ensures your branch name is valid and your codebase is uptodate.
|
14
|
+
* Use a descriptive branch name to help other developers (ex: fix-login-screen, api-refactor, payment-reconcile, etc)
|
15
|
+
|
16
|
+
## Step 2: Implement the requested change...
|
17
|
+
Use [Test Driven Development](http://en.wikipedia.org/wiki/Test-driven_development) to ensure that the feature has proper code coverage.
|
18
|
+
|
19
|
+
* **RED** - Write tests for the desired behavior...
|
20
|
+
* **GREEN** - Write just enough code to get the tests to pass...
|
21
|
+
* **REFACTOR** - Cleanup for clarity and DRY-ness...
|
22
|
+
|
23
|
+
|
24
|
+
### Development Protips™
|
25
|
+
* Follow [best practices](http://robots.thoughtbot.com/post/48933156625/5-useful-tips-for-a-better-commit-message) for git commit messages to communicate your changes.
|
26
|
+
* Add [ticket references to commits to automatically trigger product management workflows](http://help.sprint.ly/knowledgebase/articles/108139-available-scm-vcs-commands)
|
27
|
+
* Only write the **minimal** amount of code necessary to accomplish the given task.
|
28
|
+
* Ensure branch stays up-to-date with latest changes that are merged into master by using: `$ git update`
|
29
|
+
* Changes that are not directly related to the current feature should be cherry-picked into their own branch and merged separately.
|
30
|
+
|
31
|
+
### Testing Protips™
|
32
|
+
* Every line of code should have associated unit tests. If it's not tested, it's probably broken and you just don't know it yet...
|
33
|
+
* Use [BetterSpecs.org](http://betterspecs.org/) as reference for writing readable and maintainable unit tests.
|
34
|
+
|
35
|
+
|
36
|
+
## Step 3: Peer Review (aka Pull Request)...
|
37
|
+
|
38
|
+
```
|
39
|
+
$ git review
|
40
|
+
```
|
41
|
+
|
42
|
+
* Describe high level overview of the branch in pull request description. Include links to relevant resources.
|
43
|
+
* Record **artifacts** created by this feature (ex: screenshots of UI changes, screencasts of UX changes, logs from database migrations, etc)
|
44
|
+
* Document **follow-up** items/tasks that need to be addressed post-release
|
45
|
+
|
46
|
+
### Questions to ask...
|
47
|
+
* Is there a simpler way to accomplish the task at hand?
|
48
|
+
* Are we solving the problems of today and not over engineering for the problems of tomorrow?
|
49
|
+
|
50
|
+
## Step 4: QA
|
51
|
+
|
52
|
+
> With great power comes great responsibility…
|
53
|
+
|
54
|
+
* You are responsible to test your changes locally and in production environments as necessary
|
55
|
+
* Test changes in local development environment using the same process used by Continuous Integration with: `$ rake ci`
|
56
|
+
* Smoketest all changes locally and in staging environment when appropriate with: `$ git integrate staging`
|
57
|
+
|
58
|
+
## Step 5: Sign-off and release
|
59
|
+
|
60
|
+
```
|
61
|
+
$ git release
|
62
|
+
```
|
63
|
+
|
64
|
+
* Ensure that build is green before releasing branch
|
65
|
+
* Pull requests must be signed off by team leads before release (preferrably via :shipit: emoji)
|
66
|
+
|
67
|
+
## Step 5: Profit?
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec, cmd: 'bundle exec rspec', failed_mode: :keep do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
8
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Ryan Sonnek
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
[](https://travis-ci.org/wireframe/gitx)
|
2
|
+
[](https://coveralls.io/r/wireframe/gitx)
|
3
|
+
[](https://codeclimate.com/github/wireframe/gitx)
|
4
|
+
|
5
|
+
# GitX
|
6
|
+
|
7
|
+
> Useful Git eXtensions for improved development workflows
|
8
|
+
|
9
|
+
### Global Options
|
10
|
+
* `--trace` or `-v` = verbose output for debugging commands
|
11
|
+
* `--pretend` or `-p` = dry run commands and do not actually invoke operations
|
12
|
+
|
13
|
+
## git start <new_branch_name (optional)>
|
14
|
+
|
15
|
+
update local repository with latest upstream changes and create a new feature branch
|
16
|
+
|
17
|
+
## git update
|
18
|
+
|
19
|
+
update the local feature branch with latest remote changes plus upstream released changes.
|
20
|
+
|
21
|
+
## git integrate <aggregate_branch_name (optional, default: staging)>
|
22
|
+
|
23
|
+
integrate the current feature branch into an aggregate branch (ex: prototype, staging)
|
24
|
+
|
25
|
+
## git review <feature_branch_name (optional, default: current_branch)>
|
26
|
+
|
27
|
+
create a pull request on github for peer review of the current branch. This command is re-runnable
|
28
|
+
in order to re-assign pull requests.
|
29
|
+
|
30
|
+
options:
|
31
|
+
* `--assign` or `-a` = assign pull request to github user
|
32
|
+
* `--open` or `-o` = open pull request in default web browser.
|
33
|
+
* `--bump` or `-b` = bump an existing pull request by posting a comment to re-review new changes
|
34
|
+
* `--approve` = approve/signoff on pull request (with optional feedback)
|
35
|
+
* `--reject` = reject pull request (with details)
|
36
|
+
|
37
|
+
NOTE: the `--bump` option will also update the pull request commit status to mark the branch as 'pending peer review'.
|
38
|
+
This setting is cleared when a reviewer approves or rejects the pull request.
|
39
|
+
|
40
|
+
## git release <feature_branch_name (optional, default: current_branch)
|
41
|
+
|
42
|
+
release the feature branch to master. This operation will perform the following:
|
43
|
+
|
44
|
+
* pull latest code from remote feature branch
|
45
|
+
* pull latest code from master branch
|
46
|
+
* prompt user to confirm they actually want to perform the release
|
47
|
+
* check if pull request commit status is currently successful
|
48
|
+
* merge current branch into master
|
49
|
+
* (optional) cleanup merged branches from remote server
|
50
|
+
|
51
|
+
options:
|
52
|
+
* `--cleanup` = automatically cleanup merged branches after release complete
|
53
|
+
|
54
|
+
# Extra Utility Git Extensions
|
55
|
+
|
56
|
+
## git cleanup
|
57
|
+
|
58
|
+
delete released branches after they have been merged into master.
|
59
|
+
|
60
|
+
## git nuke <aggregate_branch_name>
|
61
|
+
|
62
|
+
reset an aggregate branch (ex: prototype, staging) back to a known good state.
|
63
|
+
|
64
|
+
## git buildtag
|
65
|
+
|
66
|
+
create a build tag for the current Travis-CI build and push it back to origin
|
67
|
+
|
68
|
+
|
69
|
+
## Contributing
|
70
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
71
|
+
|
72
|
+
* Fork the project.
|
73
|
+
* Make your feature addition or bug fix.
|
74
|
+
* Add tests for it. This is important so I don't break it in a
|
75
|
+
future version unintentionally.
|
76
|
+
* Commit, do not mess with rakefile, version, or history.
|
77
|
+
(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)
|
78
|
+
* Send me a pull request. Bonus points for topic branches.
|
79
|
+
|
80
|
+
## Related Projects
|
81
|
+
* [socialcast-git-extensions](https://github.com/socialcast/socialcast-git-extensions)
|
82
|
+
* [thegarage-gitx](https://github.com/thegarage/thegarage-gitx)
|
83
|
+
|
84
|
+
|
85
|
+
## Copyright
|
86
|
+
See [LICENSE.txt](LICENSE.txt)
|
87
|
+
|
data/Rakefile
ADDED
data/bin/git-buildtag
ADDED
data/bin/git-cleanup
ADDED
data/bin/git-integrate
ADDED
data/bin/git-nuke
ADDED
data/bin/git-release
ADDED
data/bin/git-review
ADDED
data/bin/git-share
ADDED
data/bin/git-start
ADDED
data/bin/git-track
ADDED
data/bin/git-update
ADDED
data/gitx.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gitx/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'gitx'
|
8
|
+
spec.version = Gitx::VERSION
|
9
|
+
spec.authors = ['Ryan Sonnek']
|
10
|
+
spec.email = ['ryan.sonnek@gmail.com']
|
11
|
+
spec.description = %q{Git eXtensions for improved development workflow}
|
12
|
+
spec.summary = %q{Utility scripts for Git to increase productivity for common operations}
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'rugged', '~> 0.21.0'
|
22
|
+
spec.add_runtime_dependency 'thor'
|
23
|
+
spec.add_runtime_dependency 'octokit'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'pry', '>= 0'
|
29
|
+
spec.add_development_dependency 'webmock', '>= 0'
|
30
|
+
spec.add_development_dependency 'timecop', '~> 0.7.0'
|
31
|
+
spec.add_development_dependency 'vcr'
|
32
|
+
spec.add_development_dependency 'guard'
|
33
|
+
spec.add_development_dependency 'guard-rspec'
|
34
|
+
spec.add_development_dependency 'coveralls'
|
35
|
+
spec.add_development_dependency 'terminal-notifier'
|
36
|
+
spec.add_development_dependency 'terminal-notifier-guard'
|
37
|
+
end
|
data/lib/gitx.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'pathname'
|
3
|
+
require 'rugged'
|
4
|
+
require 'gitx'
|
5
|
+
|
6
|
+
module Gitx
|
7
|
+
module Cli
|
8
|
+
class BaseCommand < Thor
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
class MergeError < Thor::Error; end
|
12
|
+
|
13
|
+
add_runtime_options!
|
14
|
+
|
15
|
+
method_option :trace, :type => :boolean, :aliases => '-v'
|
16
|
+
def initialize(*args)
|
17
|
+
super(*args)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def repo
|
23
|
+
@repo ||= begin
|
24
|
+
path = Dir.pwd
|
25
|
+
Rugged::Repository.discover(path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def checkout_branch(branch_name)
|
30
|
+
run_cmd "git checkout #{branch_name}"
|
31
|
+
end
|
32
|
+
|
33
|
+
# lookup the current branch of the repo
|
34
|
+
def current_branch
|
35
|
+
repo.branches.find(&:head?)
|
36
|
+
end
|
37
|
+
|
38
|
+
def assert_aggregate_branch!(target_branch)
|
39
|
+
fail "Invalid aggregate branch: #{target_branch} must be one of supported aggregate branches #{config.aggregate_branches}" unless config.aggregate_branch?(target_branch)
|
40
|
+
end
|
41
|
+
|
42
|
+
def assert_not_protected_branch!(branch, action)
|
43
|
+
raise "Cannot #{action} reserved branch" if config.reserved_branch?(branch) || config.aggregate_branch?(branch)
|
44
|
+
end
|
45
|
+
|
46
|
+
# helper to invoke other CLI commands
|
47
|
+
def execute_command(command_class, method, args = [])
|
48
|
+
command_class.new.send(method, *args)
|
49
|
+
end
|
50
|
+
|
51
|
+
def config
|
52
|
+
@configuration ||= Gitx::Configuration.new(repo.workdir)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'gitx'
|
3
|
+
require 'gitx/cli/base_command'
|
4
|
+
|
5
|
+
module Gitx
|
6
|
+
module Cli
|
7
|
+
class BuildtagCommand < BaseCommand
|
8
|
+
|
9
|
+
desc 'buildtag', 'create a tag for the current build and push it back to origin (supports Travis CI and Codeship)'
|
10
|
+
def buildtag
|
11
|
+
fail 'Unknown branch. Environment variables TRAVIS_BRANCH or CI_BRANCH are required' unless branch_name
|
12
|
+
fail "Branch must be one of the supported taggable branches: #{config.taggable_branches}" unless config.taggable_branch?(branch_name)
|
13
|
+
|
14
|
+
label = "buildtag generated by build #{build_number}"
|
15
|
+
create_build_tag(branch_name, label)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# pull the current branch name from environment variables
|
21
|
+
# supports Travis CI or Codeship variables
|
22
|
+
# see https://www.codeship.io/documentation/continuous-integration/set-environment-variables/
|
23
|
+
def branch_name
|
24
|
+
ENV['TRAVIS_BRANCH'] || ENV['CI_BRANCH']
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_number
|
28
|
+
ENV['TRAVIS_BUILD_NUMBER'] || ENV['CI_BUILD_NUMBER']
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_build_tag(branch, label)
|
32
|
+
timestamp = Time.now.utc.strftime '%Y-%m-%d-%H-%M-%S'
|
33
|
+
git_tag = "build-#{branch}-#{timestamp}"
|
34
|
+
run_cmd "git tag #{git_tag} -a -m '#{label}'"
|
35
|
+
run_cmd "git push origin #{git_tag}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|