git-pc 0.0.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/LICENSE +21 -0
- data/README.md +41 -0
- data/bin/git-pc +5 -0
- data/lib/git-pc/version.rb +3 -0
- data/lib/git-pc.rb +67 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 909b024c153885347861513e73846030a717f57a
|
4
|
+
data.tar.gz: 112781538e7087e015f5bbaebe8656c5aa4f783f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 76261d515c9dee0ba51c276c565917f0524839f087c5a3ade7c1d743d18b3947f09dcadb711e975711e3939e4812446cffd7c74f5c07a8d562eae752508d9a71
|
7
|
+
data.tar.gz: eb7ccb56178bccc2302514256cbc79072391c604ff15dc63f56da467d88c700d67d66d3f557516c325ac4dd1002e17562b136948a4eb46dc94236d9c6a7ab29f
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Adriano Tadao Sabadini Matsumoto
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
###Git shortcut to automate the commit and push commands
|
2
|
+
|
3
|
+
Sometimes execute the basic git commands is very boring and repetitive so, this shortcut is awesome. It will run these commands in this order:
|
4
|
+
|
5
|
+
- `git status`
|
6
|
+
- `git commit -am"YOUR_MESSAGE_COMMIT"`
|
7
|
+
- `git push origin YOUR_CURRENT_BRANCH`
|
8
|
+
|
9
|
+
**The Script**
|
10
|
+
|
11
|
+
```bash
|
12
|
+
#!/bin/bash
|
13
|
+
|
14
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
15
|
+
COMMIT_MESSAGE=$1
|
16
|
+
|
17
|
+
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
|
18
|
+
git status
|
19
|
+
|
20
|
+
echo -e "$(tput setaf 2)\n** Executing commit command$(tput sgr0)\n"
|
21
|
+
git commit -am"$COMMIT_MESSAGE"
|
22
|
+
|
23
|
+
echo -e "$(tput setaf 2)\n** Executing push command$(tput sgr0)\n\n"
|
24
|
+
git push origin $CURRENT_BRANCH
|
25
|
+
```
|
26
|
+
|
27
|
+
**How to install:**
|
28
|
+
|
29
|
+
Run this command line:
|
30
|
+
|
31
|
+
```bash
|
32
|
+
$ gem install git-pc
|
33
|
+
```
|
34
|
+
|
35
|
+
**Usage:**
|
36
|
+
|
37
|
+
At some git repository, just run:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
git pc 'Message Commit'
|
41
|
+
```
|
data/bin/git-pc
ADDED
data/lib/git-pc.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'colored'
|
2
|
+
require 'grit'
|
3
|
+
require 'git-pc/version'
|
4
|
+
|
5
|
+
class GitPc
|
6
|
+
attr_accessor :argv
|
7
|
+
|
8
|
+
def run(argv)
|
9
|
+
@argv = argv
|
10
|
+
|
11
|
+
status_command
|
12
|
+
add_command
|
13
|
+
commit_command
|
14
|
+
push_command
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def status_command
|
20
|
+
puts "Executing status command".green
|
21
|
+
puts "git status".yellow
|
22
|
+
puts
|
23
|
+
%x(git status)
|
24
|
+
end
|
25
|
+
|
26
|
+
def push_command
|
27
|
+
puts "Executing push command".green
|
28
|
+
puts "git push origin #{ current_branch }".yellow
|
29
|
+
puts
|
30
|
+
%x(git push origin #{ current_branch })
|
31
|
+
end
|
32
|
+
|
33
|
+
def commit_command
|
34
|
+
puts "Executing commit command".green
|
35
|
+
puts "git commit -m #{ message }".yellow
|
36
|
+
puts
|
37
|
+
%x(git commit -m "#{ message }")
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_command
|
41
|
+
puts "Executing add command".green
|
42
|
+
puts "git add .".yellow
|
43
|
+
puts
|
44
|
+
%x(git add .)
|
45
|
+
end
|
46
|
+
|
47
|
+
def current_branch
|
48
|
+
@current_branch ||= repo.head.name
|
49
|
+
end
|
50
|
+
|
51
|
+
def repo
|
52
|
+
@repo ||= get_repo
|
53
|
+
end
|
54
|
+
|
55
|
+
def message
|
56
|
+
@argv[0] || 'no message commit'
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_repo
|
60
|
+
repo_dir = `git rev-parse --show-toplevel`.chomp
|
61
|
+
begin
|
62
|
+
@repo = Grit::Repo.new(repo_dir)
|
63
|
+
rescue
|
64
|
+
raise "We don't seem to be in a git repository."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-pc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adriano Tadao Sabadini Matsumoto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colored
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: grit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.5.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.5.0
|
41
|
+
description: Sometimes execute the basic git commands is very boring and repetitive
|
42
|
+
so, this shortcut will make your job most fast.
|
43
|
+
email: drianotadao@gmail.com
|
44
|
+
executables:
|
45
|
+
- git-pc
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- bin/git-pc
|
52
|
+
- lib/git-pc.rb
|
53
|
+
- lib/git-pc/version.rb
|
54
|
+
homepage: https://github.com/adrianotadao/git-pc
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.4.8
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: git shortcut to do push and commit
|
78
|
+
test_files: []
|