mapa 0.0.6 → 0.0.7
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 +4 -4
- data/lib/mapa/utility.rb +46 -34
- data/lib/mapa.rb +3 -12
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6c70d5e33ad211d98db649c5437cef3609e9c0c
|
4
|
+
data.tar.gz: 69b0ff959c3dc7e587fb0b985c7db92c003c390c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6a4541a2520ff23880499cc0eaa363560b51d8ca28731f022666a32ada66aea1b1c59b8fb29d7dbf9550903a1a7f4031a6f2b80fd78f25a189dfb0f96244fe8
|
7
|
+
data.tar.gz: 55187b41f0ee476f7b5fde8055045f1bcbd640fe46208b0920b5de27a296e5a8558e6d80881183608b6cf8778dd2dc3128d02c1cd0a7e090ff3e4421e934ffad
|
data/lib/mapa/utility.rb
CHANGED
@@ -1,79 +1,91 @@
|
|
1
1
|
class Mapa::Utility
|
2
2
|
|
3
3
|
def initialize(args)
|
4
|
-
action = args[0]
|
5
|
-
|
6
|
-
|
4
|
+
action = args[0].to_sym
|
5
|
+
option = args[1]
|
6
|
+
options = args[1..-1]
|
7
|
+
if self.respond_to? action
|
8
|
+
case self.method(action).arity
|
7
9
|
when 1
|
8
|
-
self.send(action
|
10
|
+
self.send(action, option)
|
9
11
|
when -1
|
10
|
-
self.send(action
|
12
|
+
self.send(action, options)
|
11
13
|
else
|
12
|
-
self.send(action
|
14
|
+
self.send(action)
|
15
|
+
end
|
16
|
+
else
|
17
|
+
if not(options.empty?)
|
18
|
+
e "git #{action.to_s} #{options}"
|
19
|
+
else
|
20
|
+
e "git #{action.to_s}"
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
16
24
|
|
17
25
|
def in
|
18
|
-
|
26
|
+
e 'git init'
|
19
27
|
end
|
20
28
|
|
21
|
-
def go(
|
22
|
-
|
23
|
-
exec "git add . && git commit -m '#{options[0]}' && git push origin #{options[1]}"
|
29
|
+
def go(message)
|
30
|
+
e "git add . && git commit -m '#{message}' && git branch | xargs git push origin"
|
24
31
|
end
|
25
32
|
|
26
33
|
def rh
|
27
|
-
|
34
|
+
e 'git reset --hard'
|
28
35
|
end
|
29
36
|
|
30
37
|
def ad
|
31
|
-
|
38
|
+
e 'git add .'
|
32
39
|
end
|
33
40
|
|
34
41
|
def st
|
35
|
-
|
42
|
+
e 'git status'
|
36
43
|
end
|
37
44
|
|
38
45
|
def cm(message)
|
39
|
-
|
46
|
+
e "git commit -m '#{message}'"
|
40
47
|
end
|
41
48
|
|
42
49
|
def br(*options)
|
43
|
-
|
44
|
-
|
50
|
+
case (patterns = options.flatten).first
|
51
|
+
when '-a'
|
52
|
+
e 'git branch'
|
53
|
+
when '-d'
|
54
|
+
patterns[1..-1].each do |branch|
|
55
|
+
e "git branch | grep '#{branch}' | xargs git branch -D"
|
56
|
+
end
|
45
57
|
else
|
46
|
-
|
58
|
+
e 'git rev-parse --abbrev-ref HEAD'
|
47
59
|
end
|
48
60
|
end
|
49
61
|
|
50
|
-
def
|
51
|
-
|
52
|
-
exec "git branch | grep '#{branch}' | xargs git branch -D"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def dif
|
57
|
-
exec 'git diff'
|
62
|
+
def df
|
63
|
+
e 'git diff'
|
58
64
|
end
|
59
65
|
|
60
66
|
def fo
|
61
|
-
|
67
|
+
e 'git fetch origin'
|
62
68
|
end
|
63
69
|
|
64
|
-
def pl
|
65
|
-
|
70
|
+
def pl
|
71
|
+
e 'git branch | xargs git pull origin'
|
66
72
|
end
|
67
73
|
|
68
|
-
def ph
|
69
|
-
|
74
|
+
def ph
|
75
|
+
e 'git branch | xargs git push origin'
|
70
76
|
end
|
71
77
|
|
72
|
-
def co(
|
73
|
-
|
78
|
+
def co(*options)
|
79
|
+
case (options = options.flatten).first
|
80
|
+
when '-b'
|
81
|
+
e "git checkout -b #{options[1]}"
|
82
|
+
else
|
83
|
+
e "git checkout #{options[1]} && git rev-parse --abbrev-ref HEAD"
|
84
|
+
end
|
74
85
|
end
|
75
86
|
|
76
|
-
|
77
|
-
|
87
|
+
private
|
88
|
+
def e(action)
|
89
|
+
exec action
|
78
90
|
end
|
79
91
|
end
|
data/lib/mapa.rb
CHANGED
@@ -11,20 +11,11 @@ class Mapa
|
|
11
11
|
def greeting
|
12
12
|
puts "\nThanks for using Mapa!\n\n"
|
13
13
|
puts 'Available Commands'
|
14
|
-
puts '
|
15
|
-
puts '
|
16
|
-
puts ' st Alias for "git status"'
|
17
|
-
puts ' cm Alias for "git commit -m"'
|
18
|
-
puts ' br Alias for "git branch"'
|
14
|
+
puts ' go Execute "git add ." "git cm -m "<message>" "git push origin <branch>"'
|
15
|
+
puts ' br "-d" option delete git branches with name matching <pattern> <pattern>'
|
19
16
|
puts ' pl Alias for "git pull origin"'
|
20
17
|
puts ' ph Alias for "git push origin"'
|
21
|
-
puts '
|
22
|
-
puts ' cob Alias for "git checkout -b"'
|
23
|
-
puts ' rh Alias for "git reset --hard"'
|
24
|
-
puts ' dif Alias for "git diff"'
|
25
|
-
puts ' fo Alias for "git fetch origin"'
|
26
|
-
puts ' brd Delete git branches with name matching <pattern> <pattern>'
|
27
|
-
puts ' go Execute "git add ." "git cm -m "<message>" "git push origin <branch>"'
|
18
|
+
puts 'TODO...'
|
28
19
|
end
|
29
20
|
end
|
30
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mapa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mapa Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple aliasing gem
|
14
14
|
email: tangposma@gmail.com
|
@@ -18,10 +18,10 @@ executables:
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
-
- bin/mapa
|
22
|
-
- bin/mp
|
23
21
|
- lib/mapa.rb
|
24
22
|
- lib/mapa/utility.rb
|
23
|
+
- bin/mapa
|
24
|
+
- bin/mp
|
25
25
|
homepage: http://rubygems.org/gems/mapa
|
26
26
|
licenses:
|
27
27
|
- MIT
|
@@ -32,17 +32,17 @@ require_paths:
|
|
32
32
|
- lib
|
33
33
|
required_ruby_version: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
44
|
rubyforge_project:
|
45
|
-
rubygems_version: 2.
|
45
|
+
rubygems_version: 2.0.14.1
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: Mapa!
|