git-helpers 0.2.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 82e6414a87935574c740f9d98767652b1c025da8
4
+ data.tar.gz: 5f015b8462fbba630f4d3707d867f0f2a351d829
5
+ SHA512:
6
+ metadata.gz: 92f619ab95515a29e3d0e4b75b824784ebb85dcff7dc6c5e0d9e159383ccb0d51249dc8865b7372152c4c09566106762c2cd45e01357ad14c6abefdd76081200
7
+ data.tar.gz: 1bfcc829bb713f1da03ad088dc367a681fcf1ec0b192cedbb426b0576a534cf343a7fc9673859a67ba3d46285d9070bae2b1b49c68c4d9648376d726628906bc
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'coveralls', require: false
4
+
5
+ # Specify your gem's dependencies in git-helpers.gemspec
6
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { 'spec' }
5
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Kierran McPherson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Git-Helpers
2
+
3
+ [![Build Status](https://travis-ci.org/KierranM/git-helpers.svg?branch=master)](https://travis-ci.org/KierranM/git-helpers) [![Code Climate](https://codeclimate.com/github/KierranM/git-helpers/badges/gpa.svg)](https://codeclimate.com/github/KierranM/git-helpers) [![Dependency Status](https://gemnasium.com/KierranM/git-helpers.svg)](https://gemnasium.com/KierranM/git-helpers) [![Documentation Coverage](http://inch-ci.org/github/kierranm/git-helpers.svg?branch=master)](http://inch-ci.org/github/kierranm/git-helpers?branch=master)
4
+
5
+ Git-Helpers is a small library of commands to extend `git` to help improve your git workflow
6
+
7
+ ## Installation
8
+
9
+ Install it using:
10
+
11
+ $ gem install git-helpers
12
+
13
+ ## Usage
14
+
15
+ Thanks to the way `git` finds extension commands on the path, once the gem is installed
16
+ all of the commands are available in the usual `git <command>` manner.
17
+
18
+ ## Available Commands
19
+
20
+ ### Update
21
+ Running `git update` will pull down the latest changes for your current branch
22
+ from the upstream remote (or origin if you don't have an upstream), and pushes
23
+ the changes to your origin (or not at all if it was pulled from origin).
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bundle` to install dependencies. Then, run `bundle exec rake spec` to run the tests.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then push your changes to your fork, and create a pull request into [KierranM/git-helpers](https://github.com/KierranM/git-helpers). Once merged a release will be
30
+ created and the gem pushed to upstream
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/KierranM/git-helpers.
35
+
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+ require 'reek/rake/task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ desc 'Run RuboCop on the lib directory'
9
+ RuboCop::RakeTask.new(:rubocop) do |task|
10
+ task.patterns = ['lib/**/*.rb']
11
+ # only show the files with failures
12
+ task.formatters = ['files']
13
+ # don't abort rake on failure
14
+ task.fail_on_error = false
15
+ end
16
+
17
+ Reek::Rake::Task.new do |t|
18
+ t.fail_on_error = false
19
+ end
20
+
21
+ task quality: [:rubocop, :reek]
22
+
23
+ task default: [:spec, :quality]
data/exe/git-update ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ require 'git/helpers'
3
+ require 'optparse'
4
+
5
+ OptionParser.new do |opts|
6
+ opts.banner = "Git-Helpers git update\n"\
7
+ "Updates the current branch from upstream and pushes the changes to origin\n"\
8
+ 'Usage: git update'
9
+ opts.on_tail '-h', '--help', 'Shows this help message' do
10
+ puts opts
11
+ exit 0
12
+ end
13
+ opts.on_tail '-v', '--version', 'Shows the version of git-helpers' do
14
+ puts "Git-Helpers version #{Git::Helpers::VERSION}"
15
+ exit 0
16
+ end
17
+ end.parse!
18
+
19
+ Git::Helpers.update_repository
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'git/helpers/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'git-helpers'
8
+ spec.version = Git::Helpers::VERSION
9
+ spec.authors = ['Kierran McPherson']
10
+ spec.email = ['kierranm@gmail.com']
11
+
12
+ spec.summary = 'A few helpful git commands to make life easier'
13
+ spec.description = <<-eof
14
+ git-helpers is a library of helpful command extensions for git that will
15
+ help make git workflow slightly faster, and hopefully a little more enjoyable.
16
+ eof
17
+ spec.homepage = 'https://github.com/kierranm/git-helpers'
18
+ spec.license = 'MIT'
19
+
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|\
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
23
+ spec.bindir = 'exe'
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ['lib']
26
+ spec.has_rdoc = 'yard'
27
+
28
+ spec.add_runtime_dependency 'launchy', '~> 2.4'
29
+ spec.add_runtime_dependency 'git', '~> 1.3'
30
+
31
+ spec.add_development_dependency 'bundler', '~> 1.11'
32
+ spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.0'
34
+ spec.add_development_dependency 'rubocop', '~> 0.37'
35
+ spec.add_development_dependency 'reek', '~> 3.10'
36
+ spec.add_development_dependency 'yard', '~> 0.8.7'
37
+ spec.add_development_dependency 'guard', '~> 2.13'
38
+ spec.add_development_dependency 'guard-rspec', '~> 4.6'
39
+ end
@@ -0,0 +1,25 @@
1
+ require 'git/helpers/utils'
2
+
3
+ module Git
4
+ # Provides a set of helper functions to make Git life easier
5
+ module Helpers
6
+ require 'git'
7
+ # Updates a repositories current branch from upstream, and pushes those
8
+ # to origin
9
+ # @param repo_dir [String] The directory of the repo to update
10
+ # @param print_details [Boolean] Print messages for each action or not
11
+ def self.update_repository(repo_dir = Dir.pwd, print_details = true)
12
+ repo = Git.open(repo_dir)
13
+ remote = Utils.remote?(repo, 'upstream') ? 'upstream' : 'origin'
14
+ current_branch = repo.current_branch
15
+ print "Pulling changes from #{remote}/#{current_branch}..." if print_details
16
+ repo.pull(remote, current_branch)
17
+ puts "\tSUCCESS" if print_details
18
+ if remote != 'origin'
19
+ print "Pushing changes to origin/#{current_branch}..." if print_details
20
+ repo.push('origin', current_branch)
21
+ puts "\tSUCCESS" if print_details
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ module Git
2
+ # Provides a set of helper functions to make Git life easier
3
+ module Helpers
4
+ # Provides utility methods for other Git-Helper modules
5
+ module Utils
6
+ # Checks if the given remote exists on the given repo
7
+ # @param repo [Git::Base] The repository in question
8
+ # @param remote [String] The name of the remote to check for
9
+ # @return [Boolean] true if the remote exists, false if not
10
+ def self.remote?(repo, remote)
11
+ repo.remotes.map(&:name).include?(remote)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Git
2
+ module Helpers
3
+ VERSION = '0.2.1'.freeze
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'git/helpers/version'
2
+ require 'git/helpers/update'
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Kierran McPherson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: launchy
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: git
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.37'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.37'
97
+ - !ruby/object:Gem::Dependency
98
+ name: reek
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: yard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.8.7
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.8.7
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '2.13'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '2.13'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '4.6'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '4.6'
153
+ description: |2
154
+ git-helpers is a library of helpful command extensions for git that will
155
+ help make git workflow slightly faster, and hopefully a little more enjoyable.
156
+ email:
157
+ - kierranm@gmail.com
158
+ executables:
159
+ - git-update
160
+ extensions: []
161
+ extra_rdoc_files: []
162
+ files:
163
+ - ".gitignore"
164
+ - ".rspec"
165
+ - ".travis.yml"
166
+ - Gemfile
167
+ - Guardfile
168
+ - LICENSE.txt
169
+ - README.md
170
+ - Rakefile
171
+ - exe/git-update
172
+ - git-helpers.gemspec
173
+ - lib/git/helpers.rb
174
+ - lib/git/helpers/update.rb
175
+ - lib/git/helpers/utils.rb
176
+ - lib/git/helpers/version.rb
177
+ homepage: https://github.com/kierranm/git-helpers
178
+ licenses:
179
+ - MIT
180
+ metadata: {}
181
+ post_install_message:
182
+ rdoc_options: []
183
+ require_paths:
184
+ - lib
185
+ required_ruby_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ requirements: []
196
+ rubyforge_project:
197
+ rubygems_version: 2.4.5.1
198
+ signing_key:
199
+ specification_version: 4
200
+ summary: A few helpful git commands to make life easier
201
+ test_files: []
202
+ has_rdoc: yard