fukung 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Rakefile +1 -1
  2. data/bin/fukung +35 -9
  3. data/fukung.gemspec +1 -1
  4. data/lib/fukung.rb +21 -1
  5. metadata +4 -4
data/Rakefile CHANGED
@@ -200,7 +200,7 @@ end
200
200
 
201
201
 
202
202
  task :clean do
203
- Dir[File.join(This.pkgdir, '**/**')].each{|entry| Fu.rm_rf(entry)}
203
+ Dir[File.join(This.pkgdir, '**/**'), File.join(This.dir, "**/*~")].each{|entry| Fu.rm_rf(entry)}
204
204
  end
205
205
 
206
206
 
data/bin/fukung CHANGED
@@ -1,15 +1,41 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
- require 'shellwords'
3
+ Main {
4
+ argument('tag'){
5
+ optional true
6
+ default false
7
+ }
4
8
 
5
- begin
6
- require 'rubygems'
7
- rescue LoadError
8
- end
9
+ option('--launchy', '-l'){
10
+ description 'open url with launchy gem'
11
+ default false
12
+ }
9
13
 
10
- require 'fukung'
11
- require 'launchy'
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
- Launchy.open(url)
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
+ }
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "fukung"
6
- spec.version = "1.0.0"
6
+ spec.version = "1.1.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "fukung"
9
9
  spec.description = "description: fukung kicks the ass"
@@ -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.0.0'
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: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
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-02-11 00:00:00 -07:00
18
+ date: 2011-07-25 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency