fukung 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/fukung +35 -9
- data/fukung.gemspec +1 -1
- data/lib/fukung.rb +21 -1
- metadata +4 -4
data/Rakefile
CHANGED
data/bin/fukung
CHANGED
@@ -1,15 +1,41 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
Main {
|
4
|
+
argument('tag'){
|
5
|
+
optional true
|
6
|
+
default false
|
7
|
+
}
|
4
8
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
option('--launchy', '-l'){
|
10
|
+
description 'open url with launchy gem'
|
11
|
+
default false
|
12
|
+
}
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
def run
|
15
|
+
begin
|
16
|
+
if params['launchy'].given? then
|
17
|
+
Fukung.goto_one( params['tag'].value )
|
18
|
+
else
|
19
|
+
puts Fukung.one( params['tag'].value )
|
20
|
+
end
|
21
|
+
rescue => e
|
22
|
+
$stderr.puts e
|
23
|
+
$stderr.puts e.backtrace if $VERBOSE or Fukung::Debug
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
}
|
12
28
|
|
13
|
-
url = Shellwords.escape(Fukung.random)
|
14
29
|
|
15
|
-
|
30
|
+
|
31
|
+
|
32
|
+
BEGIN {
|
33
|
+
begin
|
34
|
+
require 'rubygems'
|
35
|
+
rescue LoadError
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'fukung'
|
39
|
+
require 'main'
|
40
|
+
require 'launchy'
|
41
|
+
}
|
data/fukung.gemspec
CHANGED
data/lib/fukung.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'cgi'
|
3
3
|
require 'uri'
|
4
|
+
require 'launchy'
|
4
5
|
|
5
6
|
module Fukung
|
6
7
|
def Fukung.version
|
7
|
-
'1.
|
8
|
+
'1.1.0'
|
8
9
|
end
|
9
10
|
|
10
11
|
Host = 'fukung.net'
|
11
12
|
MediaHost = 'media.fukung.net'
|
12
13
|
Debug = ENV['FUKUNG_DEBUG']
|
13
14
|
Nothing = Object.new.freeze
|
15
|
+
ENV['LAUNCHY_DEBUG'] = "true" if Debug
|
14
16
|
|
15
17
|
def random
|
16
18
|
@random ||= nil
|
@@ -119,6 +121,24 @@ module Fukung
|
|
119
121
|
throw(:result, result)
|
120
122
|
end
|
121
123
|
|
124
|
+
def random_or_tag(a_tag = false)
|
125
|
+
list = a_tag ? Fukung.tag(a_tag.to_s) : [Fukung.random]
|
126
|
+
raise "nothing found" if list.empty?
|
127
|
+
return list
|
128
|
+
end
|
129
|
+
|
130
|
+
def one(a_tag = false)
|
131
|
+
random_or_tag(a_tag).sort_by{ rand }.first
|
132
|
+
end
|
133
|
+
|
134
|
+
def goto(a_tag = false)
|
135
|
+
random_or_tag(a_tag).each { |url| ::Launchy.open( url ) }
|
136
|
+
end
|
137
|
+
|
138
|
+
def goto_one(a_tag = false)
|
139
|
+
::Launchy.open(one(a_tag))
|
140
|
+
end
|
141
|
+
|
122
142
|
extend(Fukung)
|
123
143
|
|
124
144
|
Fukung.sfw!
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fukung
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ara T. Howard
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-25 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|