lmgtfy 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1f8a5373012e0f20cd59f8535593f52ee9a01096
4
+ data.tar.gz: 66a1298cd792bfc0cde8b48c5c94193688ce333b
5
+ SHA512:
6
+ metadata.gz: 38b77f9214d1bfd5e623535bdbb6256805060d5d2936ffae844439da7199cc2dbbf406b5edaf47f511d22e3a5ed2faa507892a09a465c2f96246aa186516a2a3
7
+ data.tar.gz: 6f76ca01dc9cfbc2d73ff73a5862d65904b0fb1ab848f7a377ccc129c3a3fc0044a4fe2f002cd9aa9617a518b4afd33636809cae11db64b6e227d0af8ecdbaca
@@ -1 +1 @@
1
- 1.9.3
1
+ 2.0.0
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in lmgtfy.gemspec
4
4
  gemspec
5
+
6
+ gem 'coveralls', require: false
@@ -1,12 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lmgtfy (0.0.4)
4
+ lmgtfy (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ colorize (0.5.8)
10
+ coveralls (0.6.7)
11
+ colorize
12
+ multi_json (~> 1.3)
13
+ rest-client
14
+ simplecov (>= 0.7)
15
+ thor
9
16
  diff-lcs (1.1.3)
17
+ mime-types (1.23)
18
+ multi_json (1.7.3)
19
+ rest-client (1.6.7)
20
+ mime-types (>= 1.16)
10
21
  rspec (2.12.0)
11
22
  rspec-core (~> 2.12.0)
12
23
  rspec-expectations (~> 2.12.0)
@@ -15,10 +26,16 @@ GEM
15
26
  rspec-expectations (2.12.1)
16
27
  diff-lcs (~> 1.1.3)
17
28
  rspec-mocks (2.12.1)
29
+ simplecov (0.7.1)
30
+ multi_json (~> 1.0)
31
+ simplecov-html (~> 0.7.1)
32
+ simplecov-html (0.7.1)
33
+ thor (0.18.1)
18
34
 
19
35
  PLATFORMS
20
36
  ruby
21
37
 
22
38
  DEPENDENCIES
39
+ coveralls
23
40
  lmgtfy!
24
41
  rspec
data/README.md CHANGED
@@ -5,14 +5,14 @@ Ruby gem for http://lmgtfy.com/ - command line tool for http://lmgtfy.com/
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/lmgtfy.png)](http://badge.fury.io/rb/lmgtfy)
7
7
 
8
- ## Features
9
-
10
- Get original as well as shortened lmgtfy url for your query from command line
11
-
12
8
  ## Status
13
9
 
14
10
  [![Build Status](https://travis-ci.org/prathamesh-sonpatki/lmgtfy-gem.png?branch=master)](https://travis-ci.org/prathamesh-sonpatki/lmgtfy-gem)
15
11
 
12
+ ## Coverage
13
+
14
+ [![Coverage Status](https://coveralls.io/repos/prathamesh-sonpatki/lmgtfy-gem/badge.png?branch=master)](https://coveralls.io/r/prathamesh-sonpatki/lmgtfy-gem?branch=master)
15
+
16
16
  ## Installation
17
17
 
18
18
  Add this line to your application's Gemfile:
@@ -37,6 +37,11 @@ Pass a query string to lmgtfy from command line as follows
37
37
  Use the output url anywhere you want
38
38
 
39
39
 
40
+ ## Features
41
+
42
+ Get original as well as shortened lmgtfy url for your query from command line
43
+
44
+
40
45
  ## Contributing
41
46
 
42
47
  1. Fork it
@@ -15,16 +15,21 @@ module Lmgtfy
15
15
  end
16
16
 
17
17
  def generate_short_url
18
- base_url = "http://is.gd/create.php?format=json&url="
19
- string = "http://lmgtfy.com/?#{@query}"
20
18
  begin
21
- response = Net::HTTP.get_response(URI.parse(base_url + string))
22
- JSON.parse(response.body)["shorturl"]
23
- rescue
24
- "No internet connection"
19
+ get_shortened_url_from_is_gd
20
+ rescue Exception => ex
21
+ ex.message
25
22
  end
26
23
  end
27
24
 
25
+ private
26
+
27
+ def get_shortened_url_from_is_gd
28
+ base_url = "http://is.gd/create.php?format=json&url="
29
+ is_gd_request_url = URI.parse(base_url + generate_lmgtfy_url)
30
+ JSON.parse(Net::HTTP.get_response(is_gd_request_url).body).fetch("shorturl")
31
+ end
32
+
28
33
  end
29
34
 
30
35
  end
@@ -1,3 +1,3 @@
1
1
  module Lmgtfy
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -4,17 +4,19 @@ require 'lmgtfy/runner'
4
4
  describe Lmgtfy::Runner do
5
5
 
6
6
  before do
7
- @query = URI.encode_www_form([['q', ARGV.join(' ')]])
7
+ @query = URI.encode_www_form([['q', ARGV.join(' ')]])
8
+ @runner = Lmgtfy::Runner.new
8
9
  end
9
10
 
10
11
  it "accepts search query from the user" do
11
- runner = Lmgtfy::Runner.new
12
- runner.query.should eq @query
12
+ expect(@runner.query).to eq @query
13
13
  end
14
14
 
15
- it "generates correct url" do
16
- runner = Lmgtfy::Runner.new
17
- runner.generate_lmgtfy_url.should eq "http://lmgtfy.com/?#{@query}"
15
+ it "generates correct long url" do
16
+ expect(@runner.generate_lmgtfy_url).to eq "http://lmgtfy.com/?#{@query}"
18
17
  end
19
18
 
19
+ it "generates short url" do
20
+ # except(@runner.generate_short_url).to_eq "http://lmgtfy.com/?#{@query}"
21
+ end
20
22
  end
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  $: << File.join(File.dirname(__FILE__), '../lib')
2
5
  # This file was generated by the `rspec --init` command. Conventionally, all
3
6
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lmgtfy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Prathamesh Sonpatki
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-11 00:00:00.000000000 Z
11
+ date: 2013-05-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: Command line wrapper for http://lmgtfy.com
@@ -56,27 +53,26 @@ files:
56
53
  homepage: https://github.com/prathamesh-sonpatki/lmgtfy-gem
57
54
  licenses:
58
55
  - MIT
56
+ metadata: {}
59
57
  post_install_message: Thanks for installing! Now troll the trolls :)
60
58
  rdoc_options: []
61
59
  require_paths:
62
60
  - lib
63
61
  required_ruby_version: !ruby/object:Gem::Requirement
64
- none: false
65
62
  requirements:
66
- - - ! '>='
63
+ - - '>='
67
64
  - !ruby/object:Gem::Version
68
65
  version: '0'
69
66
  required_rubygems_version: !ruby/object:Gem::Requirement
70
- none: false
71
67
  requirements:
72
- - - ! '>='
68
+ - - '>='
73
69
  - !ruby/object:Gem::Version
74
70
  version: '0'
75
71
  requirements: []
76
72
  rubyforge_project:
77
- rubygems_version: 1.8.25
73
+ rubygems_version: 2.0.3
78
74
  signing_key:
79
- specification_version: 3
75
+ specification_version: 4
80
76
  summary: Give a query string and get a url back from http://lmgtfy.com
81
77
  test_files:
82
78
  - spec/lmgtfy/runner_spec.rb