Skip to content

Commit ecaf3a6

Browse files
committed
Merge pull request #61 from dblock/rubocop-faraday-etc
Added Rubocop, upgraded Faraday, removed Gemfile.lock.
2 parents ee215c0 + ab42327 commit ecaf3a6

32 files changed

+199
-378
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ test/tmp
1515
test/version_tmp
1616
tmp
1717
examples/william.rb
18+
Gemfile.lock

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inherit_from: .rubocop_todo.yml
2+

.rubocop_todo.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This configuration was generated by `rubocop --auto-gen-config`
2+
# on 2014-09-17 21:23:50 -0400 using RuboCop version 0.26.0.
3+
# The point is for the user to remove these configuration records
4+
# one by one as the offenses are removed from the code base.
5+
# Note that changes in the inspected code, or installation of new
6+
# versions of RuboCop, may require this file to be generated again.
7+
8+
# Offense count: 1
9+
# Configuration parameters: CountComments.
10+
Metrics/ClassLength:
11+
Max: 106
12+
13+
# Offense count: 36
14+
# Configuration parameters: AllowURI.
15+
Metrics/LineLength:
16+
Max: 140
17+
18+
# Offense count: 1
19+
# Configuration parameters: CountComments.
20+
Metrics/MethodLength:
21+
Max: 14
22+
23+
# Offense count: 1
24+
Style/AsciiComments:
25+
Enabled: false
26+
27+
# Offense count: 3
28+
# Configuration parameters: EnforcedStyle, SupportedStyles.
29+
Style/ClassAndModuleChildren:
30+
Enabled: false
31+
32+
# Offense count: 15
33+
Style/Documentation:
34+
Enabled: false
35+
36+
# Offense count: 1
37+
Style/DoubleNegation:
38+
Enabled: false
39+
40+
# Offense count: 3
41+
Style/Lambda:
42+
Enabled: false
43+
44+
# Offense count: 6
45+
# Configuration parameters: MaxSlashes.
46+
Style/RegexpLiteral:
47+
Enabled: false

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
rvm:
22
- 1.9.3
33
- 2.0.0
4+
- 2.1.2
5+

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ gem 'pry'
1111

1212
gem 'redcarpet'
1313
gem 'yard', '~> 0.8'
14-
gem 'yard-tomdoc', git: 'git://github.com/rubyworks/yard-tomdoc'
14+
gem 'yard-tomdoc'
1515
gem 'simplecov', require: false
16+
gem 'rubocop', '~> 0.26.0', require: false

Gemfile.lock

Lines changed: 0 additions & 112 deletions
This file was deleted.

Guardfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
guard 'minitest' do
2-
watch(%r|^test/(.*)_test\.rb|)
3-
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
4-
watch(%r|^(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
5-
watch(%r|^test/test_helper\.rb|) { "test" }
2+
watch(%r{^test/(.*)_test\.rb})
3+
watch(%r{^lib/(.*)([^/]+)\.rb}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
4+
watch(%r{^(.*)([^/]+)\.rb}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
5+
watch(%r{^test/test_helper\.rb}) { 'test' }
66
end
77

88
guard 'spinach' do
9-
watch(%r|^features/(.*)\.feature|)
10-
watch(%r|^features/steps/(.*)([^/]+)\.rb|) do |m|
9+
watch(%r{^features/(.*)\.feature})
10+
watch(%r{^features/steps/(.*)([^/]+)\.rb}) do |m|
1111
"features/#{m[1]}#{m[2]}.feature"
1212
end
1313
end

Rakefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ if ENV['COVERAGE']
1414
end
1515

1616
require 'yard'
17-
YARD::Config.load_plugin('yard-tomdoc')
17+
YARD::Config.load_plugin('yard-tomdoc')
1818
YARD::Rake::YardocTask.new do |t|
1919
t.files = ['lib/**/*.rb']
2020
t.options = %w(-r README.md)
2121
end
2222

23-
2423
Bundler::GemHelper.install_tasks
2524

2625
require 'rake/testtask'
@@ -37,4 +36,7 @@ task :spinach do
3736
ruby '-S spinach'
3837
end
3938

40-
task default: [:test, :spinach]
39+
require 'rubocop/rake_task'
40+
RuboCop::RakeTask.new(:rubocop)
41+
42+
task default: [:rubocop, :test, :spinach]

examples/cyberscore.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def games
1616
end
1717

1818
def add_game(name)
19-
client.links.submissions.post({name: name})
19+
client.links.submissions.post(name: name)
2020
end
2121

2222
def motd
@@ -32,9 +32,10 @@ def method_missing(method, *args, &block)
3232
end
3333

3434
private
35+
3536
def client
36-
@client ||= Hyperclient::EntryPoint.new 'http://cs-api.heroku.com/api',
37-
{debug: false, headers: {'content-type' => 'application/json'}}
37+
@client ||= Hyperclient::EntryPoint.new 'http://cs-api.heroku.com/api',
38+
debug: false, headers: { 'content-type' => 'application/json' }
3839
end
3940
end
4041

@@ -43,18 +44,17 @@ def print_links(links)
4344
if link.is_a?(Array)
4445
print_links(link)
4546
else
46-
puts %{Found "#{name}" at "#{link.url}" }
47+
puts %(Found "#{name}" at "#{link.url}" )
4748
end
4849
end
4950
end
5051

5152
def print_games(games)
5253
games.each do |game|
53-
puts %{Found "#{game.attributes['name']}" }
54+
puts %(Found "#{game.attributes['name']}" )
5455
end
5556
end
5657

57-
5858
api = Cyberscore.new
5959

6060
puts "Let's inspect the API:"
@@ -72,5 +72,5 @@ def print_games(games)
7272
print_links(api.links.news.links)
7373
puts "\n"
7474

75-
puts "I like games!"
75+
puts 'I like games!'
7676
print_games(api.games)

examples/hal_shop.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
def print_resources(resources)
55
resources.each do |name, resource|
66
begin
7-
puts %{Found #{name} at #{resource.url}}
7+
puts %(Found #{name} at #{resource.url})
88
rescue
9-
puts %{Found #{name}}
9+
puts %(Found #{name})
1010
end
1111
end
1212
end
1313

1414
def print_attributes(attributes)
15-
puts "-----------------------------"
15+
puts '-----------------------------'
1616
attributes.each do |attribute, value|
17-
puts %{#{attribute}: #{value}}
17+
puts %(#{attribute}: #{value})
1818
end
1919
end
2020

@@ -31,9 +31,9 @@ def print_attributes(attributes)
3131
puts "Let's see what stats we have:"
3232
print_attributes(api.embedded.stats.attributes)
3333

34-
products = api.links["http://hal-shop.heroku.com/rels/products"].resource
34+
products = api.links['http://hal-shop.heroku.com/rels/products'].resource
3535

36-
puts
36+
puts
3737
puts "And what's the inventory of products?"
3838
puts products.attributes['inventory_size']
3939

0 commit comments

Comments
 (0)