alfred_git 0.1.6 → 0.2.0
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/alfred_git/version.rb +1 -1
- data/lib/alfred_git.rb +83 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 762eb870a23c8c3cc6f485a5d1e0448478d592cf
|
4
|
+
data.tar.gz: 1c51e0761210bdc1f1511d9499a4f1a5a9d1a242
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b891a690f28f8e478884fb668dd01b038b2da3ba85de3c872c04e6723bfec0fc8b914637345ff7ce9aad5ea3f70fefb349a5c2f93f9f926618a86917553e8dc6
|
7
|
+
data.tar.gz: f5fe66028b16c2d5d83ff808c54fb6cc5fed9c2a27fee9eb2011ed1a59173d312a78a080e083f8d5395b6c11f684dfd162f9c0a5aa3c96266936c6505e213c1b
|
data/lib/alfred_git/version.rb
CHANGED
data/lib/alfred_git.rb
CHANGED
@@ -16,6 +16,7 @@ module AlfredGit
|
|
16
16
|
|
17
17
|
def alfred(arguments)
|
18
18
|
@arguments = arguments
|
19
|
+
alfred_command
|
19
20
|
command = command_to_git_command
|
20
21
|
repos = repos_string_to_array
|
21
22
|
|
@@ -27,14 +28,93 @@ module AlfredGit
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
def
|
31
|
-
command = ''
|
32
|
-
|
31
|
+
def alfred_command
|
33
32
|
case @arguments[0]
|
34
33
|
when nil, ''
|
35
34
|
lines_pretty_print Rainbow("I need a command to run, Master #{@name}.").red
|
36
35
|
|
37
36
|
abort
|
37
|
+
when 'list_repo', 'list_repos'
|
38
|
+
lines_pretty_print "Here are your repos and their locations, Master #{@name}:"
|
39
|
+
|
40
|
+
single_space
|
41
|
+
|
42
|
+
list_repos_and_locations
|
43
|
+
|
44
|
+
single_space
|
45
|
+
|
46
|
+
abort
|
47
|
+
when 'add_repo'
|
48
|
+
add_repo
|
49
|
+
|
50
|
+
abort
|
51
|
+
when 'delete_repo'
|
52
|
+
delete_repo
|
53
|
+
|
54
|
+
abort
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def list_repos_and_locations
|
59
|
+
@repo_locations.each do |repo, location|
|
60
|
+
lines_pretty_print Rainbow("#{repo}").yellow + ": #{location}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_repo
|
65
|
+
config_yaml = YAML.load_file("#{@app_directory}/lib/config.yaml")
|
66
|
+
config_file = File.open("#{@app_directory}/lib/config.yaml", 'w')
|
67
|
+
|
68
|
+
lines_pretty_print "What is the 'friendly' name you'd like to give your repository? This is the "\
|
69
|
+
'name you will type when sending me commands.'
|
70
|
+
|
71
|
+
repo_name = STDIN.gets.strip!
|
72
|
+
|
73
|
+
single_space
|
74
|
+
|
75
|
+
lines_pretty_print "Thank you, #{@gender}. Now, where is that repository? Please paste the full path."
|
76
|
+
|
77
|
+
repo_path = STDIN.gets.strip!
|
78
|
+
|
79
|
+
single_space
|
80
|
+
|
81
|
+
config_yaml['repos'][repo_name] = repo_path
|
82
|
+
YAML.dump(config_yaml, config_file)
|
83
|
+
|
84
|
+
lines_pretty_print Rainbow("I've added that repository successfully, #{@gender}!").green
|
85
|
+
|
86
|
+
single_space
|
87
|
+
end
|
88
|
+
|
89
|
+
def delete_repo
|
90
|
+
config_yaml = YAML.load_file("#{@app_directory}/lib/config.yaml")
|
91
|
+
config_file = File.open("#{@app_directory}/lib/config.yaml", 'w')
|
92
|
+
|
93
|
+
lines_pretty_print "What repository would you like to delete from my list of repositories, #{@gender}?"
|
94
|
+
|
95
|
+
repo_name = STDIN.gets.strip!
|
96
|
+
|
97
|
+
single_space
|
98
|
+
|
99
|
+
if config_yaml['repos'].keys.include?(repo_name)
|
100
|
+
config_yaml['repos'].delete(repo_name)
|
101
|
+
|
102
|
+
lines_pretty_print Rainbow("I've deleted that repository successfully, #{@gender}!").green
|
103
|
+
else
|
104
|
+
lines_pretty_print Rainbow("Sorry, #{@gender}, that is not a repository that is currently in my list. "\
|
105
|
+
'If you\'d *really* like to delete it, please add it first using the '\
|
106
|
+
'\'add_repo\' command.').red
|
107
|
+
end
|
108
|
+
|
109
|
+
YAML.dump(config_yaml, config_file)
|
110
|
+
|
111
|
+
single_space
|
112
|
+
end
|
113
|
+
|
114
|
+
def command_to_git_command
|
115
|
+
command = ''
|
116
|
+
|
117
|
+
case @arguments[0]
|
38
118
|
when 'pull'
|
39
119
|
command = 'git pull'
|
40
120
|
@arguments.delete_at(0)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alfred_git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Sellek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|