terry 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +10 -0
- data/README.rdoc +4 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/terry +5 -0
- data/lib/terry.rb +32 -2
- data/lib/terry/api_service.rb +14 -16
- data/lib/terry/bash_alias.rb +11 -10
- data/spec/terry/bash_alias_spec.rb +0 -4
- data/terry.gemspec +6 -1
- metadata +21 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,7 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
coderay (1.0.8)
|
5
|
+
colorize (0.5.8)
|
5
6
|
diff-lcs (1.1.3)
|
6
7
|
git (1.2.5)
|
7
8
|
httparty (0.10.2)
|
@@ -13,6 +14,7 @@ GEM
|
|
13
14
|
rake
|
14
15
|
rdoc
|
15
16
|
json (1.7.7)
|
17
|
+
json (1.7.7-java)
|
16
18
|
method_source (0.8.1)
|
17
19
|
multi_json (1.5.1)
|
18
20
|
multi_xml (0.5.3)
|
@@ -20,6 +22,11 @@ GEM
|
|
20
22
|
coderay (~> 1.0.5)
|
21
23
|
method_source (~> 0.8)
|
22
24
|
slop (~> 3.3.1)
|
25
|
+
pry (0.9.10-java)
|
26
|
+
coderay (~> 1.0.5)
|
27
|
+
method_source (~> 0.8)
|
28
|
+
slop (~> 3.3.1)
|
29
|
+
spoon (~> 0.0)
|
23
30
|
rake (10.0.3)
|
24
31
|
rdoc (3.12.1)
|
25
32
|
json (~> 1.4)
|
@@ -32,12 +39,15 @@ GEM
|
|
32
39
|
diff-lcs (~> 1.1.2)
|
33
40
|
rspec-mocks (2.8.0)
|
34
41
|
slop (3.3.3)
|
42
|
+
spoon (0.0.1)
|
35
43
|
yard (0.8.4.1)
|
36
44
|
|
37
45
|
PLATFORMS
|
46
|
+
java
|
38
47
|
ruby
|
39
48
|
|
40
49
|
DEPENDENCIES
|
50
|
+
colorize
|
41
51
|
httparty
|
42
52
|
jeweler (~> 1.8.4)
|
43
53
|
pry
|
data/README.rdoc
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Terry manages, backs up and syncs your bash aliases across your computers. He also helps you and install new aliases, uploaded by other developers.
|
4
4
|
|
5
|
+
== Supported Rubies (Ones I've bothered to test.)
|
6
|
+
ruby-1.9.3
|
7
|
+
jruby-1.7.2
|
8
|
+
|
5
9
|
|
6
10
|
== Who is this Terry?
|
7
11
|
The man behind the myth, Terry is my pet terrapin, seen here chilling like a boss.
|
data/Rakefile
CHANGED
@@ -23,6 +23,7 @@ Jeweler::Tasks.new do |gem|
|
|
23
23
|
gem.description = %Q{Terry manages, backs up and syncs your bash aliases across your computers. He also helps you and install new aliases, uploaded by other developers.}
|
24
24
|
gem.email = "markgprovan@gmail.com"
|
25
25
|
gem.authors = ["Mark Provan"]
|
26
|
+
gem.executables = ["terry"]
|
26
27
|
# dependencies defined in Gemfile
|
27
28
|
end
|
28
29
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/bin/terry
ADDED
data/lib/terry.rb
CHANGED
@@ -1,2 +1,32 @@
|
|
1
|
-
require
|
2
|
-
require "
|
1
|
+
require 'pry'
|
2
|
+
require "colorize"
|
3
|
+
|
4
|
+
class Terry
|
5
|
+
require "terry/bash_alias"
|
6
|
+
require "terry/api_service"
|
7
|
+
|
8
|
+
def initialize(args)
|
9
|
+
|
10
|
+
case args[0]
|
11
|
+
when "-v"
|
12
|
+
puts "0.0.2"
|
13
|
+
|
14
|
+
when "list"
|
15
|
+
Terry::BashAlias.format_for_terminal(Terry::ApiService.list_all)
|
16
|
+
|
17
|
+
when "search"
|
18
|
+
if args[1]
|
19
|
+
results = Terry::ApiService.search(args[1])
|
20
|
+
if results.empty?
|
21
|
+
puts "No results found for #{args[1]} :(".red
|
22
|
+
else
|
23
|
+
puts "Found #{results.length} result(s) for #{args[1]}".green
|
24
|
+
Terry::BashAlias.format_for_terminal(results)
|
25
|
+
end
|
26
|
+
else
|
27
|
+
puts "Please provide a search term eg."
|
28
|
+
puts "\n $ terry search git\n".green
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/terry/api_service.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
require "httparty"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
3
|
+
class Terry::ApiService
|
4
|
+
|
5
|
+
def self.list_all
|
6
|
+
parsed_aliases = HTTParty.get("http://192.81.217.228/bash_aliases.json")
|
7
|
+
bash_aliases = parsed_aliases.map { |ba| Terry::BashAlias.new(ba)}
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
10
|
+
def self.search(search_term)
|
11
|
+
parsed_aliases = HTTParty.get("http://192.81.217.228/bash_aliases.json")
|
12
|
+
matches = []
|
13
|
+
parsed_aliases.each do |a|
|
14
|
+
if a["command"].include?(search_term)
|
15
|
+
matches << Terry::BashAlias.new(a)
|
18
16
|
end
|
19
|
-
matches
|
20
17
|
end
|
21
|
-
|
18
|
+
matches
|
22
19
|
end
|
20
|
+
|
23
21
|
end
|
data/lib/terry/bash_alias.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require "json"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
3
|
+
class Terry::BashAlias
|
4
|
+
attr_accessor :shortcode, :description, :command
|
5
|
+
def initialize(bash_alias)
|
6
|
+
@shortcode = bash_alias["shortcode"]
|
7
|
+
@description = bash_alias["description"]
|
8
|
+
@command = bash_alias["command"]
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
def self.format_for_terminal(aliases)
|
12
|
+
aliases.each do |ba|
|
13
|
+
puts "#{ba.shortcode} - #{ba.description} (#{ba.command})"
|
14
14
|
end
|
15
|
+
nil
|
15
16
|
end
|
16
17
|
end
|
@@ -11,8 +11,4 @@ describe Terry::BashAlias do
|
|
11
11
|
@ba.description.should == "A nice short version of git status"
|
12
12
|
@ba.command.should == "git status"
|
13
13
|
end
|
14
|
-
|
15
|
-
it "should let me format it for output in the terminal" do
|
16
|
-
@ba.format_for_cli.should == "gs - A nice short version of git status"
|
17
|
-
end
|
18
14
|
end
|
data/terry.gemspec
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "terry"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mark Provan"]
|
12
12
|
s.date = "2013-02-19"
|
13
13
|
s.description = "Terry manages, backs up and syncs your bash aliases across your computers. He also helps you and install new aliases, uploaded by other developers."
|
14
14
|
s.email = "markgprovan@gmail.com"
|
15
|
+
s.executables = ["terry"]
|
15
16
|
s.extra_rdoc_files = [
|
16
17
|
"LICENSE.txt",
|
17
18
|
"README.rdoc"
|
@@ -25,6 +26,7 @@ Gem::Specification.new do |s|
|
|
25
26
|
"README.rdoc",
|
26
27
|
"Rakefile",
|
27
28
|
"VERSION",
|
29
|
+
"bin/terry",
|
28
30
|
"lib/terry.rb",
|
29
31
|
"lib/terry/api_service.rb",
|
30
32
|
"lib/terry/bash_alias.rb",
|
@@ -46,6 +48,7 @@ Gem::Specification.new do |s|
|
|
46
48
|
|
47
49
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
50
|
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<colorize>, [">= 0"])
|
49
52
|
s.add_development_dependency(%q<pry>, [">= 0"])
|
50
53
|
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
51
54
|
s.add_development_dependency(%q<yard>, ["~> 0.7"])
|
@@ -53,6 +56,7 @@ Gem::Specification.new do |s|
|
|
53
56
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
54
57
|
else
|
55
58
|
s.add_dependency(%q<httparty>, [">= 0"])
|
59
|
+
s.add_dependency(%q<colorize>, [">= 0"])
|
56
60
|
s.add_dependency(%q<pry>, [">= 0"])
|
57
61
|
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
58
62
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
@@ -61,6 +65,7 @@ Gem::Specification.new do |s|
|
|
61
65
|
end
|
62
66
|
else
|
63
67
|
s.add_dependency(%q<httparty>, [">= 0"])
|
68
|
+
s.add_dependency(%q<colorize>, [">= 0"])
|
64
69
|
s.add_dependency(%q<pry>, [">= 0"])
|
65
70
|
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
66
71
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: colorize
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: pry
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,7 +126,8 @@ dependencies:
|
|
110
126
|
description: Terry manages, backs up and syncs your bash aliases across your computers.
|
111
127
|
He also helps you and install new aliases, uploaded by other developers.
|
112
128
|
email: markgprovan@gmail.com
|
113
|
-
executables:
|
129
|
+
executables:
|
130
|
+
- terry
|
114
131
|
extensions: []
|
115
132
|
extra_rdoc_files:
|
116
133
|
- LICENSE.txt
|
@@ -124,6 +141,7 @@ files:
|
|
124
141
|
- README.rdoc
|
125
142
|
- Rakefile
|
126
143
|
- VERSION
|
144
|
+
- bin/terry
|
127
145
|
- lib/terry.rb
|
128
146
|
- lib/terry/api_service.rb
|
129
147
|
- lib/terry/bash_alias.rb
|
@@ -148,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
166
|
version: '0'
|
149
167
|
segments:
|
150
168
|
- 0
|
151
|
-
hash:
|
169
|
+
hash: 739056797
|
152
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
171
|
none: false
|
154
172
|
requirements:
|