linkto 0.0.1 → 0.1.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.
- data/Manifest.txt +5 -0
- data/README.md +33 -3
- data/lib/linkto.rb +23 -2
- data/lib/linkto/bing.rb +18 -0
- data/lib/linkto/flickr.rb +35 -0
- data/lib/linkto/google.rb +29 -0
- data/lib/linkto/untappd.rb +19 -0
- data/lib/linkto/version.rb +2 -1
- data/lib/linkto/wikipedia.rb +24 -0
- metadata +12 -7
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# linkto
|
2
2
|
|
3
|
-
linkto gem -
|
3
|
+
linkto gem - link_to helpers for google search, bing search, flickr photo search, flickr photo tag, etc.
|
4
4
|
|
5
5
|
* home :: [github.com/rubylibs/linkto](https://github.com/rubylibs/linkto)
|
6
6
|
* bugs :: [github.com/rubylibs/linkto/issues](https://github.com/rubylibs/linkto/issues)
|
@@ -10,12 +10,42 @@ linkto gem - linkto - link_to helpers for google search, bing search, flickr pho
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
-
|
13
|
+
link_to_google_search 'open mundi'
|
14
|
+
|
15
|
+
will become
|
16
|
+
|
17
|
+
https://www.google.com/search?q=open+mundi
|
18
|
+
|
19
|
+
|
20
|
+
### Google
|
21
|
+
|
22
|
+
- `link_to_google_search`
|
23
|
+
- `link_to_google_de_search`
|
24
|
+
- `link_to_google_search_images`
|
25
|
+
|
26
|
+
### Bing
|
27
|
+
|
28
|
+
- `link_to_bing_search_images`
|
29
|
+
|
30
|
+
### Flickr
|
31
|
+
|
32
|
+
- `link_to_flickr_tags`
|
33
|
+
- `link_to_flickr_search`
|
34
|
+
|
35
|
+
### Wikipedia
|
36
|
+
|
37
|
+
- `link_to_wikipedia_search`
|
38
|
+
- `link_to_wikipedia_de_search`
|
39
|
+
|
40
|
+
### Untappd
|
41
|
+
|
42
|
+
- `link_to_untappd_search`
|
43
|
+
|
14
44
|
|
15
45
|
|
16
46
|
## Real World Usage
|
17
47
|
|
18
|
-
- [beer.db.admin](
|
48
|
+
- [beer.db.admin](https://github.com/geraldb/beer.db.admin) - open source world beer guide; beer.db browser
|
19
49
|
|
20
50
|
|
21
51
|
## Alternatives
|
data/lib/linkto.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
## require 'props'
|
4
|
+
|
4
5
|
require 'logutils'
|
6
|
+
|
5
7
|
## require 'textutils'
|
6
8
|
|
7
9
|
|
@@ -9,6 +11,13 @@ require 'logutils'
|
|
9
11
|
|
10
12
|
require 'linkto/version' # let it always go first
|
11
13
|
|
14
|
+
require 'linkto/bing'
|
15
|
+
require 'linkto/flickr'
|
16
|
+
require 'linkto/google'
|
17
|
+
require 'linkto/untappd'
|
18
|
+
require 'linkto/wikipedia'
|
19
|
+
|
20
|
+
|
12
21
|
module Linkto
|
13
22
|
|
14
23
|
def self.banner
|
@@ -17,12 +26,24 @@ module Linkto
|
|
17
26
|
|
18
27
|
def self.root
|
19
28
|
"#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
|
29
|
+
end
|
30
|
+
|
31
|
+
### convenience - includes all helpers; use include LinktoHelper
|
32
|
+
module Helper
|
33
|
+
include BingHelper
|
34
|
+
include FlickrHelper
|
35
|
+
include GoogleHelper
|
36
|
+
include UntappdHelper
|
37
|
+
include WikipediaHelper
|
20
38
|
end
|
21
39
|
|
22
40
|
end # module Linkto
|
23
41
|
|
24
|
-
|
25
|
-
|
42
|
+
|
43
|
+
## for convenience add aliases for module
|
44
|
+
LinkTo = Linkto
|
45
|
+
LinkToHelper = Linkto::Helper
|
46
|
+
LinktoHelper = Linkto::Helper
|
26
47
|
|
27
48
|
|
28
49
|
puts Linkto.banner # say hello
|
data/lib/linkto/bing.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Linkto
|
4
|
+
module BingHelper
|
5
|
+
|
6
|
+
|
7
|
+
def link_to_bing_search_images( q, opts={} )
|
8
|
+
link_to q, "http://www.bing.com/images/search?q=#{q}", opts
|
9
|
+
end
|
10
|
+
|
11
|
+
############################
|
12
|
+
# shortcuts / aliases
|
13
|
+
|
14
|
+
def bing_search_images( q, opts={} ) link_to_bing_search_images( q, opts) end
|
15
|
+
|
16
|
+
|
17
|
+
end # module BingHelper
|
18
|
+
end # module Linkto
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Linkto
|
4
|
+
module FlickrHelper
|
5
|
+
|
6
|
+
|
7
|
+
#####################
|
8
|
+
# browse tags
|
9
|
+
|
10
|
+
def link_to_flickr_tags( tags, opts={} ) # fix: add alias for link_to_flickr_tag
|
11
|
+
# e.g. use
|
12
|
+
# ottakringer
|
13
|
+
# ottakringer+beer -- use plus for multiple tags
|
14
|
+
link_to tags, "http://www.flickr.com/photos/tags/#{tags}", opts
|
15
|
+
end
|
16
|
+
|
17
|
+
#########################
|
18
|
+
# search terms (q)
|
19
|
+
|
20
|
+
def link_to_flickr_search( q, opts={} )
|
21
|
+
# e.g. use
|
22
|
+
# ottakringer
|
23
|
+
# ottakringer+beer -- note: + is url encoded for space e.g. equals ottakringer beer
|
24
|
+
link_to q, "http://www.flickr.com/search/?q=#{q}", opts
|
25
|
+
end
|
26
|
+
|
27
|
+
###############################
|
28
|
+
# shortcuts / aliases
|
29
|
+
|
30
|
+
def flickr_tags( tags, opts={} ) link_to_flickr_tags( tags, opts ) end
|
31
|
+
def flickr_search( q, opts={} ) link_to_flickr_search( q, opts ) end
|
32
|
+
|
33
|
+
|
34
|
+
end # module FlickrHelper
|
35
|
+
end # module Linkto
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Linkto
|
4
|
+
module GoogleHelper
|
5
|
+
|
6
|
+
def link_to_google_search( q, opts={} )
|
7
|
+
link_to q, "https://www.google.com/search?q=#{q}", opts
|
8
|
+
end
|
9
|
+
|
10
|
+
def link_to_google_de_search( q, opts={} )
|
11
|
+
link_to q, "https://www.google.de/search?hl=de&q=#{q}", opts
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def link_to_google_search_images( q, opts={} )
|
16
|
+
link_to q, "https://www.google.com/search?tbm=isch&q=#{q}", opts
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
###############################
|
21
|
+
# shortcuts / aliases
|
22
|
+
|
23
|
+
def google_search( q, opts ) link_to_google_search( q, opts ) end
|
24
|
+
def google_de_search( q, opts ) link_to_google_de_search( q, opts) end
|
25
|
+
def google_search_images( q, opts ) link_to_google_search_images( q, opts ) end
|
26
|
+
|
27
|
+
|
28
|
+
end # module GoogleHelper
|
29
|
+
end # module Linkto
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Linkto
|
4
|
+
module UntappdHelper
|
5
|
+
|
6
|
+
|
7
|
+
def link_to_untappd_search( q, opts={} )
|
8
|
+
link_to q, "https://untappd.com/search?q=#{q}", opts
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
###############################
|
13
|
+
# shortcuts / aliases
|
14
|
+
|
15
|
+
def untappd_search( q, opts ) link_to_untappd_search( q, opts ) end
|
16
|
+
|
17
|
+
|
18
|
+
end # module UntappdHelper
|
19
|
+
end # module Linkto
|
data/lib/linkto/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Linkto
|
4
|
+
module WikipediaHelper
|
5
|
+
|
6
|
+
|
7
|
+
def link_to_wikipedia_search( q, opts={} )
|
8
|
+
link_to q, "http://en.wikipedia.org/?search=#{q}", opts
|
9
|
+
end
|
10
|
+
|
11
|
+
def link_to_wikipedia_de_search( q, opts={} )
|
12
|
+
link_to q, "http://de.wikipedia.org/?search=#{q}", opts
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
###############################
|
17
|
+
# shortcuts / aliases
|
18
|
+
|
19
|
+
def wikipedia_search( q, opts ) link_to_wikipedia_search( q, opts ) end
|
20
|
+
def wikipedia_de_search( q, opts ) link_to_wikipedia_de_search( q, opts ) end
|
21
|
+
|
22
|
+
|
23
|
+
end # module WikipediaHelper
|
24
|
+
end # module Linkto
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2014-03-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: logutils
|
16
|
-
requirement: &
|
16
|
+
requirement: &86033990 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *86033990
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &86033620 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.10'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *86033620
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hoe
|
38
|
-
requirement: &
|
38
|
+
requirement: &86033320 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '3.3'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *86033320
|
47
47
|
description: linkto - link_to helpers for google search, bing search, flickr photo
|
48
48
|
search, flickr photo tag, etc.
|
49
49
|
email: webslideshow@googlegroups.com
|
@@ -57,7 +57,12 @@ files:
|
|
57
57
|
- README.md
|
58
58
|
- Rakefile
|
59
59
|
- lib/linkto.rb
|
60
|
+
- lib/linkto/bing.rb
|
61
|
+
- lib/linkto/flickr.rb
|
62
|
+
- lib/linkto/google.rb
|
63
|
+
- lib/linkto/untappd.rb
|
60
64
|
- lib/linkto/version.rb
|
65
|
+
- lib/linkto/wikipedia.rb
|
61
66
|
homepage: https://github.com/rubylibs/linkto
|
62
67
|
licenses:
|
63
68
|
- Public Domain
|