gem-web 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +4 -0
- data/gem-web.gemspec +29 -0
- data/lib/gem/web.rb +7 -0
- data/lib/gem/web/executor.rb +56 -0
- data/lib/gem/web/version.rb +5 -0
- data/lib/rubygems/commands/web_command.rb +38 -0
- data/lib/rubygems_plugin.rb +7 -0
- data/spec/fixtures/vcr_cassettes/documentation.yml +62 -0
- data/spec/fixtures/vcr_cassettes/github.yml +62 -0
- data/spec/fixtures/vcr_cassettes/homepage.yml +62 -0
- data/spec/fixtures/vcr_cassettes/sourecode.yml +62 -0
- data/spec/gem/web/executor_spec.rb +33 -0
- data/spec/spec_helper.rb +11 -0
- metadata +166 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3527819764253846ba76c7ef7f12265a8efec11d
|
4
|
+
data.tar.gz: d690323a672b83e4404ad6795e82d37a87049516
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 477d8dbc79a95da027ed28afe4f979173b83a351eb4aa49ff41087bfab855170ca8b3d91728c42aa669d630dce8fe28ad9c13f11473786ba6762276cd1fbfe3a
|
7
|
+
data.tar.gz: 19eec0a3df3c2c85e259be342060927d50a94d7688306f9ff6aff0973b9b66796bed992a4c03c5ee3408e10a966b5433c78bfa2b9717d49ab5b8ad25d57f14e4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Bodo Tasche
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Gem::Web
|
2
|
+
|
3
|
+
This gem plugin opens the webpage for a gem. As default it tries
|
4
|
+
to find the github page.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install gem-web
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
To open the github page of the rails gem enter this:
|
13
|
+
|
14
|
+
$ gem web rails
|
15
|
+
|
16
|
+
You could also open the documentation or the webpage that is defined in the gemspec by
|
17
|
+
adding a paramter to the command.
|
18
|
+
|
19
|
+
Options:
|
20
|
+
-g, --github Open github page of gem, this searches all urls for a github page. This is the default.
|
21
|
+
-c, --sourcecode Open sourcecode gem
|
22
|
+
-d, --doc Open documentation of gem
|
23
|
+
-w, --webpage Open webpage of gem
|
24
|
+
|
25
|
+
If the specified page was not found, it opens the rubygems.org page for the gem.
|
26
|
+
|
27
|
+
## Thanks
|
28
|
+
|
29
|
+
Thanks to [@grosser](http://github.com/grosser) for the inspiration to
|
30
|
+
this little gem plugin.
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it ( http://github.com/bitboxer/gem-web/fork )
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/gem-web.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gem/web/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gem-web"
|
8
|
+
spec.version = Gem::Web::VERSION
|
9
|
+
spec.authors = ["Bodo Tasche"]
|
10
|
+
spec.email = ["bodo@wannawork.de"]
|
11
|
+
spec.summary = %q{Adds a web command for gem}
|
12
|
+
spec.description = %q{Open the webpage, documentation or github page of a gem}
|
13
|
+
spec.homepage = "http://github.com/bitboxer/gem-web"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "launchy", "~> 2.4.2"
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "rspec-mocks"
|
26
|
+
spec.add_development_dependency "webmock"
|
27
|
+
spec.add_development_dependency "vcr"
|
28
|
+
|
29
|
+
end
|
data/lib/gem/web.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'launchy'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Gem
|
6
|
+
module Web
|
7
|
+
class Executor
|
8
|
+
|
9
|
+
def open_page(gem, options)
|
10
|
+
if options[:sourcecode]
|
11
|
+
find_page(gem, "source_code_uri")
|
12
|
+
elsif options[:doc]
|
13
|
+
find_page(gem, "documentation_uri")
|
14
|
+
elsif options[:webpage]
|
15
|
+
find_page(gem, "homepage_uri")
|
16
|
+
else
|
17
|
+
find_github(gem)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_page(gem, page)
|
22
|
+
meta = get_api_metadata(gem)
|
23
|
+
launch_browser(gem, meta[page]) unless meta.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_github(gem)
|
27
|
+
unless (meta = get_api_metadata(gem)).nil?
|
28
|
+
links = [meta["source_code_uri"], meta["documentation_uri"], meta["homepage_uri"]]
|
29
|
+
uri = links.find do |link|
|
30
|
+
!link.nil? && link.match(/http(s?):\/\/(www\.)?github.com\/.*/i)
|
31
|
+
end
|
32
|
+
launch_browser(gem, uri)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_api_metadata(gem)
|
37
|
+
begin
|
38
|
+
JSON.parse(open("https://rubygems.org/api/v1/gems/#{gem}.json").read)
|
39
|
+
rescue OpenURI::HTTPError => ex
|
40
|
+
puts "Did not find #{gem} on rubygems.org"
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def launch_browser(gem, uri)
|
46
|
+
if uri.nil? || uri.empty?
|
47
|
+
puts "Did not find page for #{gem}, opening RubyGems page instead."
|
48
|
+
uri = "https://rubygems.org/gems/#{gem}"
|
49
|
+
end
|
50
|
+
|
51
|
+
Launchy.open(uri)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'gem/web'
|
2
|
+
|
3
|
+
class Gem::Commands::WebCommand < Gem::Command
|
4
|
+
include Gem::VersionOption
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super 'web', "Open the gem's homepage",
|
8
|
+
:command => nil,
|
9
|
+
:version=> Gem::Web::VERSION,
|
10
|
+
:latest=> false
|
11
|
+
|
12
|
+
add_option("-g", "--github", "Open github page of gem, this searches all urls for a github page. This is the default.") do |v|
|
13
|
+
options[:github] = v
|
14
|
+
end
|
15
|
+
add_option("-c", "--sourcecode", "Open sourcecode gem") do |v|
|
16
|
+
options[:sourcecode] = v
|
17
|
+
end
|
18
|
+
add_option("-d", "--doc", "Open documentation of gem") do |v|
|
19
|
+
options[:doc] = v
|
20
|
+
end
|
21
|
+
add_option("-w", "--webpage", "Open webpage of gem") do |v|
|
22
|
+
options[:webpage] = v
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def arguments
|
27
|
+
"GEMNAME gem to open the webpage for"
|
28
|
+
end
|
29
|
+
|
30
|
+
def usage
|
31
|
+
"[GEMNAME]"
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute
|
35
|
+
Gem::Web::Executor.new.open_page(get_one_optional_argument, options)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://rubygems.org/api/v1/gems/rails.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 11 Feb 2014 15:53:58 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Ua-Compatible:
|
36
|
+
- IE=Edge,chrome=1
|
37
|
+
- IE=Edge,chrome=1
|
38
|
+
Etag:
|
39
|
+
- "\"991ee99262947c03331a92f5daca654c\""
|
40
|
+
Cache-Control:
|
41
|
+
- max-age=0, private, must-revalidate
|
42
|
+
Set-Cookie:
|
43
|
+
- remember_token=; path=/; expires=Wed, 11-Feb-2015 15:53:58 GMT; secure
|
44
|
+
X-Request-Id:
|
45
|
+
- 397a46e0a9f74174b873e22ab7d3552c
|
46
|
+
X-Runtime:
|
47
|
+
- '0.029802'
|
48
|
+
X-Rack-Cache:
|
49
|
+
- miss
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: "{\"name\":\"rails\",\"downloads\":32030748,\"version\":\"4.0.2\",\"version_downloads\":521833,\"platform\":\"ruby\",\"authors\":\"David
|
53
|
+
Heinemeier Hansson\",\"info\":\"Ruby on Rails is a full-stack web framework
|
54
|
+
optimized for programmer happiness and sustainable productivity. It encourages
|
55
|
+
beautiful code by favoring convention over configuration.\",\"licenses\":[\"MIT\"],\"project_uri\":\"http://rubygems.org/gems/rails\",\"gem_uri\":\"http://rubygems.org/gems/rails-4.0.2.gem\",\"homepage_uri\":\"http://www.rubyonrails.org\",\"wiki_uri\":\"http://wiki.rubyonrails.org\",\"documentation_uri\":\"http://api.rubyonrails.org\",\"mailing_list_uri\":\"http://groups.google.com/group/rubyonrails-talk\",\"source_code_uri\":\"http://github.com/rails/rails\",\"bug_tracker_uri\":\"http://github.com/rails/rails/issues\",\"dependencies\":{\"development\":[],\"runtime\":[{\"name\":\"actionmailer\",\"requirements\":\"=
|
56
|
+
4.0.2\"},{\"name\":\"actionpack\",\"requirements\":\"= 4.0.2\"},{\"name\":\"activerecord\",\"requirements\":\"=
|
57
|
+
4.0.2\"},{\"name\":\"activesupport\",\"requirements\":\"= 4.0.2\"},{\"name\":\"bundler\",\"requirements\":\"<
|
58
|
+
2.0, >= 1.3.0\"},{\"name\":\"railties\",\"requirements\":\"= 4.0.2\"},{\"name\":\"sprockets-rails\",\"requirements\":\"~>
|
59
|
+
2.0.0\"}]}}"
|
60
|
+
http_version:
|
61
|
+
recorded_at: Tue, 11 Feb 2014 15:53:58 GMT
|
62
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://rubygems.org/api/v1/gems/rails.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 11 Feb 2014 15:54:01 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Ua-Compatible:
|
36
|
+
- IE=Edge,chrome=1
|
37
|
+
- IE=Edge,chrome=1
|
38
|
+
Etag:
|
39
|
+
- "\"991ee99262947c03331a92f5daca654c\""
|
40
|
+
Cache-Control:
|
41
|
+
- max-age=0, private, must-revalidate
|
42
|
+
Set-Cookie:
|
43
|
+
- remember_token=; path=/; expires=Wed, 11-Feb-2015 15:54:01 GMT; secure
|
44
|
+
X-Request-Id:
|
45
|
+
- fb74cc3428c26c1f93ad3199239faf12
|
46
|
+
X-Runtime:
|
47
|
+
- '0.033013'
|
48
|
+
X-Rack-Cache:
|
49
|
+
- miss
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: "{\"name\":\"rails\",\"downloads\":32030748,\"version\":\"4.0.2\",\"version_downloads\":521833,\"platform\":\"ruby\",\"authors\":\"David
|
53
|
+
Heinemeier Hansson\",\"info\":\"Ruby on Rails is a full-stack web framework
|
54
|
+
optimized for programmer happiness and sustainable productivity. It encourages
|
55
|
+
beautiful code by favoring convention over configuration.\",\"licenses\":[\"MIT\"],\"project_uri\":\"http://rubygems.org/gems/rails\",\"gem_uri\":\"http://rubygems.org/gems/rails-4.0.2.gem\",\"homepage_uri\":\"http://www.rubyonrails.org\",\"wiki_uri\":\"http://wiki.rubyonrails.org\",\"documentation_uri\":\"http://api.rubyonrails.org\",\"mailing_list_uri\":\"http://groups.google.com/group/rubyonrails-talk\",\"source_code_uri\":\"http://github.com/rails/rails\",\"bug_tracker_uri\":\"http://github.com/rails/rails/issues\",\"dependencies\":{\"development\":[],\"runtime\":[{\"name\":\"actionmailer\",\"requirements\":\"=
|
56
|
+
4.0.2\"},{\"name\":\"actionpack\",\"requirements\":\"= 4.0.2\"},{\"name\":\"activerecord\",\"requirements\":\"=
|
57
|
+
4.0.2\"},{\"name\":\"activesupport\",\"requirements\":\"= 4.0.2\"},{\"name\":\"bundler\",\"requirements\":\"<
|
58
|
+
2.0, >= 1.3.0\"},{\"name\":\"railties\",\"requirements\":\"= 4.0.2\"},{\"name\":\"sprockets-rails\",\"requirements\":\"~>
|
59
|
+
2.0.0\"}]}}"
|
60
|
+
http_version:
|
61
|
+
recorded_at: Tue, 11 Feb 2014 15:54:01 GMT
|
62
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://rubygems.org/api/v1/gems/rails.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 11 Feb 2014 15:53:59 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Ua-Compatible:
|
36
|
+
- IE=Edge,chrome=1
|
37
|
+
- IE=Edge,chrome=1
|
38
|
+
Etag:
|
39
|
+
- "\"991ee99262947c03331a92f5daca654c\""
|
40
|
+
Cache-Control:
|
41
|
+
- max-age=0, private, must-revalidate
|
42
|
+
Set-Cookie:
|
43
|
+
- remember_token=; path=/; expires=Wed, 11-Feb-2015 15:53:59 GMT; secure
|
44
|
+
X-Request-Id:
|
45
|
+
- 905191e7b3bd5b60291b7fc81ed4bec4
|
46
|
+
X-Runtime:
|
47
|
+
- '0.031536'
|
48
|
+
X-Rack-Cache:
|
49
|
+
- miss
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: "{\"name\":\"rails\",\"downloads\":32030748,\"version\":\"4.0.2\",\"version_downloads\":521833,\"platform\":\"ruby\",\"authors\":\"David
|
53
|
+
Heinemeier Hansson\",\"info\":\"Ruby on Rails is a full-stack web framework
|
54
|
+
optimized for programmer happiness and sustainable productivity. It encourages
|
55
|
+
beautiful code by favoring convention over configuration.\",\"licenses\":[\"MIT\"],\"project_uri\":\"http://rubygems.org/gems/rails\",\"gem_uri\":\"http://rubygems.org/gems/rails-4.0.2.gem\",\"homepage_uri\":\"http://www.rubyonrails.org\",\"wiki_uri\":\"http://wiki.rubyonrails.org\",\"documentation_uri\":\"http://api.rubyonrails.org\",\"mailing_list_uri\":\"http://groups.google.com/group/rubyonrails-talk\",\"source_code_uri\":\"http://github.com/rails/rails\",\"bug_tracker_uri\":\"http://github.com/rails/rails/issues\",\"dependencies\":{\"development\":[],\"runtime\":[{\"name\":\"actionmailer\",\"requirements\":\"=
|
56
|
+
4.0.2\"},{\"name\":\"actionpack\",\"requirements\":\"= 4.0.2\"},{\"name\":\"activerecord\",\"requirements\":\"=
|
57
|
+
4.0.2\"},{\"name\":\"activesupport\",\"requirements\":\"= 4.0.2\"},{\"name\":\"bundler\",\"requirements\":\"<
|
58
|
+
2.0, >= 1.3.0\"},{\"name\":\"railties\",\"requirements\":\"= 4.0.2\"},{\"name\":\"sprockets-rails\",\"requirements\":\"~>
|
59
|
+
2.0.0\"}]}}"
|
60
|
+
http_version:
|
61
|
+
recorded_at: Tue, 11 Feb 2014 15:53:59 GMT
|
62
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://rubygems.org/api/v1/gems/rails.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 11 Feb 2014 15:54:00 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Ua-Compatible:
|
36
|
+
- IE=Edge,chrome=1
|
37
|
+
- IE=Edge,chrome=1
|
38
|
+
Etag:
|
39
|
+
- "\"991ee99262947c03331a92f5daca654c\""
|
40
|
+
Cache-Control:
|
41
|
+
- max-age=0, private, must-revalidate
|
42
|
+
Set-Cookie:
|
43
|
+
- remember_token=; path=/; expires=Wed, 11-Feb-2015 15:54:00 GMT; secure
|
44
|
+
X-Request-Id:
|
45
|
+
- d36128692215d3e91baf2f1a7497f386
|
46
|
+
X-Runtime:
|
47
|
+
- '0.030446'
|
48
|
+
X-Rack-Cache:
|
49
|
+
- miss
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: "{\"name\":\"rails\",\"downloads\":32030748,\"version\":\"4.0.2\",\"version_downloads\":521833,\"platform\":\"ruby\",\"authors\":\"David
|
53
|
+
Heinemeier Hansson\",\"info\":\"Ruby on Rails is a full-stack web framework
|
54
|
+
optimized for programmer happiness and sustainable productivity. It encourages
|
55
|
+
beautiful code by favoring convention over configuration.\",\"licenses\":[\"MIT\"],\"project_uri\":\"http://rubygems.org/gems/rails\",\"gem_uri\":\"http://rubygems.org/gems/rails-4.0.2.gem\",\"homepage_uri\":\"http://www.rubyonrails.org\",\"wiki_uri\":\"http://wiki.rubyonrails.org\",\"documentation_uri\":\"http://api.rubyonrails.org\",\"mailing_list_uri\":\"http://groups.google.com/group/rubyonrails-talk\",\"source_code_uri\":\"http://github.com/rails/rails\",\"bug_tracker_uri\":\"http://github.com/rails/rails/issues\",\"dependencies\":{\"development\":[],\"runtime\":[{\"name\":\"actionmailer\",\"requirements\":\"=
|
56
|
+
4.0.2\"},{\"name\":\"actionpack\",\"requirements\":\"= 4.0.2\"},{\"name\":\"activerecord\",\"requirements\":\"=
|
57
|
+
4.0.2\"},{\"name\":\"activesupport\",\"requirements\":\"= 4.0.2\"},{\"name\":\"bundler\",\"requirements\":\"<
|
58
|
+
2.0, >= 1.3.0\"},{\"name\":\"railties\",\"requirements\":\"= 4.0.2\"},{\"name\":\"sprockets-rails\",\"requirements\":\"~>
|
59
|
+
2.0.0\"}]}}"
|
60
|
+
http_version:
|
61
|
+
recorded_at: Tue, 11 Feb 2014 15:54:00 GMT
|
62
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gem::Web::Executor do
|
4
|
+
|
5
|
+
it "should open the documentation" do
|
6
|
+
VCR.use_cassette('documentation') do
|
7
|
+
expect(Launchy).to receive(:open).with("http://api.rubyonrails.org")
|
8
|
+
Gem::Web::Executor.new.open_page("rails", {doc: true})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should open the homepage" do
|
13
|
+
VCR.use_cassette('homepage') do
|
14
|
+
expect(Launchy).to receive(:open).with("http://www.rubyonrails.org")
|
15
|
+
Gem::Web::Executor.new.open_page("rails", {webpage: true})
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should open the source code" do
|
20
|
+
VCR.use_cassette('sourecode') do
|
21
|
+
expect(Launchy).to receive(:open).with("http://github.com/rails/rails")
|
22
|
+
Gem::Web::Executor.new.open_page("rails", {sourcecode: true})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should open github" do
|
27
|
+
VCR.use_cassette('github') do
|
28
|
+
expect(Launchy).to receive(:open).with("http://github.com/rails/rails")
|
29
|
+
Gem::Web::Executor.new.open_page("rails", {sourcecode: true})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
VCR.configure do |c|
|
7
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
8
|
+
c.hook_into :webmock # or :fakeweb
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'gem/web'
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem-web
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bodo Tasche
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: launchy
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.4.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.4.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-mocks
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: vcr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Open the webpage, documentation or github page of a gem
|
112
|
+
email:
|
113
|
+
- bodo@wannawork.de
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE.txt
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- gem-web.gemspec
|
124
|
+
- lib/gem/web.rb
|
125
|
+
- lib/gem/web/executor.rb
|
126
|
+
- lib/gem/web/version.rb
|
127
|
+
- lib/rubygems/commands/web_command.rb
|
128
|
+
- lib/rubygems_plugin.rb
|
129
|
+
- spec/fixtures/vcr_cassettes/documentation.yml
|
130
|
+
- spec/fixtures/vcr_cassettes/github.yml
|
131
|
+
- spec/fixtures/vcr_cassettes/homepage.yml
|
132
|
+
- spec/fixtures/vcr_cassettes/sourecode.yml
|
133
|
+
- spec/gem/web/executor_spec.rb
|
134
|
+
- spec/spec_helper.rb
|
135
|
+
homepage: http://github.com/bitboxer/gem-web
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.2.0
|
156
|
+
signing_key:
|
157
|
+
specification_version: 4
|
158
|
+
summary: Adds a web command for gem
|
159
|
+
test_files:
|
160
|
+
- spec/fixtures/vcr_cassettes/documentation.yml
|
161
|
+
- spec/fixtures/vcr_cassettes/github.yml
|
162
|
+
- spec/fixtures/vcr_cassettes/homepage.yml
|
163
|
+
- spec/fixtures/vcr_cassettes/sourecode.yml
|
164
|
+
- spec/gem/web/executor_spec.rb
|
165
|
+
- spec/spec_helper.rb
|
166
|
+
has_rdoc:
|