earthquake 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -1
- data/VERSION +1 -1
- data/earthquake.gemspec +1 -1
- data/lib/earthquake/commands.rb +29 -0
- data/lib/earthquake/core.rb +2 -0
- data/lib/earthquake/input.rb +1 -6
- metadata +1 -1
data/README.md
CHANGED
@@ -86,6 +86,10 @@ Commands
|
|
86
86
|
|
87
87
|
⚡ :thread $xx
|
88
88
|
|
89
|
+
### Install Plugins
|
90
|
+
|
91
|
+
⚡ :plugin_install https://gist.github.com/899506
|
92
|
+
|
89
93
|
And there are more commands!
|
90
94
|
|
91
95
|
Configuration
|
@@ -219,7 +223,6 @@ TODO
|
|
219
223
|
----
|
220
224
|
|
221
225
|
* guideline for plugin
|
222
|
-
* ssl for twitter_oauth
|
223
226
|
* deal proxy
|
224
227
|
* spec
|
225
228
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
data/earthquake.gemspec
CHANGED
data/lib/earthquake/commands.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
require 'uri'
|
3
|
+
require 'open-uri'
|
2
4
|
Earthquake.init do
|
3
5
|
command :exit do
|
4
6
|
stop
|
@@ -194,4 +196,31 @@ Earthquake.init do
|
|
194
196
|
command :'!' do |m|
|
195
197
|
system m[1]
|
196
198
|
end
|
199
|
+
|
200
|
+
command :plugin_install do |m|
|
201
|
+
uri = URI.parse(m[1])
|
202
|
+
unless uri.host == "gist.github.com"
|
203
|
+
puts "the host must be gist.github.com".c(41)
|
204
|
+
else
|
205
|
+
puts "..."
|
206
|
+
gist_id = uri.path[/\d+/]
|
207
|
+
meta = JSON.parse(open("https://gist.github.com/api/v1/json/#{gist_id}").read)
|
208
|
+
filename = meta["gists"][0]["files"][0]
|
209
|
+
raw = open("https://gist.github.com/raw/#{gist_id}/#{filename}").read
|
210
|
+
|
211
|
+
puts '-' * 80
|
212
|
+
puts raw.c(36)
|
213
|
+
puts '-' * 80
|
214
|
+
|
215
|
+
filename = "#{meta["gists"][0]["repo"]}.rb" if filename =~ /^gistfile/
|
216
|
+
filepath = File.join(config[:plugin_dir], filename)
|
217
|
+
if confirm("Install to '#{filepath}'?")
|
218
|
+
File.open(File.join(config[:plugin_dir], filename), 'w') do |file|
|
219
|
+
file << raw
|
220
|
+
file << "\n# #{m[1]}"
|
221
|
+
end
|
222
|
+
reload
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
197
226
|
end
|
data/lib/earthquake/core.rb
CHANGED
data/lib/earthquake/input.rb
CHANGED