tdev_shortener 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -4,7 +4,4 @@ rvm:
4
4
  - 1.9.2
5
5
  - 1.9.3
6
6
  notifications:
7
- irc: "irc.freenode.org#TotenDev"
8
- template:
9
- - "%{repository_url} (%{commit}) : %{message} %{foo} "
10
- - "Build details: %{build_url}"
7
+ irc: "irc.freenode.org#TotenDev"
data/Gemfile CHANGED
@@ -3,7 +3,15 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in tdev_shortener.gemspec
4
4
  gemspec
5
5
 
6
+ group :development do
7
+ gem 'guard'
8
+ gem 'guard-rspec'
9
+ end
10
+
6
11
  group :test do
7
12
  gem "rake"
8
13
  gem "rspec"
14
+ gem 'growl'
15
+ gem 'rb-fsevent'
16
+ gem "travis-lint"
9
17
  end
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara request specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # TDevShortener
1
+ # TDevShortener - Lib
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/mtrovilho/TDevShortener-LibRuby.png?branch=master)](http://travis-ci.org/mtrovilho/TDevShortener-LibRuby)
3
+ Ruby Gem to shorten a url using [TotenDev's URL Shortener](https://github.com/TotenDev/TDevShortener)
4
4
 
5
- Ruby Gem to shorten a url using TotenDev's URL Shortener
5
+ [![Build Status](https://secure.travis-ci.org/mtrovilho/TDevShortener-LibRuby.png?branch=master)](http://travis-ci.org/mtrovilho/TDevShortener-LibRuby)
6
6
 
7
7
  ## Installation
8
8
 
@@ -20,7 +20,10 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- status_code, body = TotenDev::Shortener.shorten(<LONG_URL>)
23
+ require 'tdev_shortener'
24
+ code, body = TotenDev::Shortener.shorten(<LONG_URL>)
25
+ # for a list of returned status codes
26
+ # see: https://github.com/TotenDev/TDevShortener
24
27
 
25
28
  ## Contributing
26
29
 
@@ -29,3 +32,7 @@ Or install it yourself as:
29
32
  3. Commit your changes (`git commit -am 'Added some feature'`)
30
33
  4. Push to the branch (`git push origin my-new-feature`)
31
34
  5. Create new Pull Request
35
+
36
+ ##License
37
+
38
+ [MIT](TDevShortener-LibRuby/raw/master/LICENSE)
data/Rakefile CHANGED
@@ -3,9 +3,21 @@ require "bundler/gem_tasks"
3
3
 
4
4
  task :default => 'test'
5
5
 
6
- desc "Run tests"
7
- task :test do
6
+ desc "Run all tests"
7
+ task :test => [:tlint, :spec] do
8
+ puts "finished running all tests successfully!"
9
+ end
10
+
11
+ desc "Run rspec"
12
+ task :spec do
8
13
  puts "running rspec..."
9
- system("bundle exec rspec spec")
14
+ system "bundle exec rspec spec"
10
15
  raise "rspec failed!" unless $?.exitstatus == 0
16
+ end
17
+
18
+ desc "Run travis-lint"
19
+ task :tlint do
20
+ puts "running travis-lint..."
21
+ system "travis-lint"
22
+ raise "lint failed!" unless $?.exitstatus == 0
11
23
  end
@@ -1,3 +1,3 @@
1
1
  module TDevShortener
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -10,12 +10,8 @@ module TotenDev
10
10
  end
11
11
 
12
12
  def self.short_url( long_url )
13
- base_url = 'www.tdev.mobi'
14
- post_ws = '/create/'
15
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
16
- req = Net::HTTP::Post.new( post_ws, headers )
17
- req.body = long_url
18
- response = Net::HTTP.new( base_url ).start { |http| http.request(req) }
13
+ base_url = URI( 'http://www.tdev.mobi/create/' )
14
+ response = Net::HTTP.post_form( base_url, 'link' => long_url )
19
15
  response
20
16
  end
21
17
 
@@ -5,7 +5,7 @@ Gem::Specification.new do |gem|
5
5
  gem.authors = ["Marcos Trovilho"]
6
6
  gem.email = ["marcos@trovilho.com"]
7
7
  gem.summary = %q{TotenDev's URL shortener wrapper}
8
- gem.homepage = "http://www.tdev.mobi"
8
+ gem.homepage = "https://github.com/TotenDev/TDevShortener-LibRuby"
9
9
  gem.files = `git ls-files`.split($\)
10
10
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
11
11
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdev_shortener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000 Z
12
+ date: 2012-07-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email:
@@ -23,6 +23,7 @@ files:
23
23
  - .rspec
24
24
  - .travis.yml
25
25
  - Gemfile
26
+ - Guardfile
26
27
  - LICENSE
27
28
  - README.md
28
29
  - Rakefile
@@ -32,7 +33,7 @@ files:
32
33
  - spec/spec_helper.rb
33
34
  - spec/tdev_shortener_spec.rb
34
35
  - tdev_shortener.gemspec
35
- homepage: http://www.tdev.mobi
36
+ homepage: https://github.com/TotenDev/TDevShortener-LibRuby
36
37
  licenses: []
37
38
  post_install_message:
38
39
  rdoc_options: []
@@ -46,7 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
47
  version: '0'
47
48
  segments:
48
49
  - 0
49
- hash: 2101811714171024190
50
+ hash: 2521389709579417113
50
51
  required_rubygems_version: !ruby/object:Gem::Requirement
51
52
  none: false
52
53
  requirements:
@@ -55,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
56
  version: '0'
56
57
  segments:
57
58
  - 0
58
- hash: 2101811714171024190
59
+ hash: 2521389709579417113
59
60
  requirements: []
60
61
  rubyforge_project:
61
62
  rubygems_version: 1.8.23