Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-03-14 21:22:57 +0300 using RuboCop version 0.35.1.
# on 2016-04-26 16:12:14 -0400 using RuboCop version 0.39.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
Lint/NestedMethodDefinition:
Lint/IneffectiveAccessModifier:
Exclude:
- 'lib/grape/util/strict_hash_configuration.rb'
- 'lib/grape/router.rb'

# Offense count: 39
Metrics/AbcSize:
Expand All @@ -19,29 +19,30 @@ Metrics/AbcSize:
Metrics/BlockNesting:
Max: 4

# Offense count: 6
# Offense count: 7
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 281
Max: 267

# Offense count: 24
Metrics/CyclomaticComplexity:
Max: 14

# Offense count: 853
# Configuration parameters: AllowURI, URISchemes.
# Offense count: 871
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https
Metrics/LineLength:
Max: 215

# Offense count: 48
# Offense count: 49
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 36
Max: 34

# Offense count: 8
# Offense count: 7
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 277
Max: 212

# Offense count: 15
Metrics/PerceivedComplexity:
Expand All @@ -50,6 +51,10 @@ Metrics/PerceivedComplexity:
# Offense count: 44
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# IgnoredMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'spec/grape/api_spec.rb'
Expand All @@ -58,7 +63,6 @@ Style/BlockDelimiters:
- 'spec/grape/request_spec.rb'

# Offense count: 111
# Configuration parameters: Exclude.
Style/Documentation:
Enabled: false

Expand All @@ -70,7 +74,14 @@ Style/DoubleNegation:
- 'lib/grape/middleware/versioner/header.rb'
- 'lib/grape/path.rb'

# Offense count: 1
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'lib/grape/endpoint.rb'

# Offense count: 14
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: compact, exploded
Style/RaiseArgs:
Enabled: false
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ gemfile:
- gemfiles/rails_3.gemfile
- gemfiles/rails_4.gemfile
- gemfiles/rack_1.5.2.gemfile

bundler_args: --without development
22 changes: 22 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# when changing this file, run appraisal install ; rubocop -a gemfiles/*.gemfile

source 'https://rubygems.org'

gemspec

group :development, :test do
gem 'bundler'
gem 'rake'
gem 'rubocop', '0.39.0'
end

group :development do
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'yard'
gem 'appraisal'
gem 'benchmark-ips'
gem 'redcarpet'
end

group :test do
gem 'grape-entity', '0.5.0'
gem 'maruku'
gem 'rack-test'
gem 'rspec', '~> 3.0'
gem 'cookiejar'
gem 'rack-contrib'
gem 'mime-types', '< 3.0'
end
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,7 @@ module API
expose :text, documentation: { type: 'string', desc: 'Status update text.' }
expose :ip, if: { type: :full }
expose :user_type, :user_id, if: ->(status, options) { status.user.public? }
expose :digest do |status, options|
expose :digest do |status, options|
Digest::MD5.hexdigest(status.txt)
end
expose :replies, using: API::Status, as: :replies
Expand Down
64 changes: 34 additions & 30 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,47 @@ RuboCop::RakeTask.new

task default: [:rubocop, :spec]

require 'yard'
DOC_FILES = ['lib/**/*.rb', 'README.md']
begin
require 'yard'
DOC_FILES = ['lib/**/*.rb', 'README.md'].freeze

YARD::Rake::YardocTask.new(:doc) do |t|
t.files = DOC_FILES
end

namespace :doc do
YARD::Rake::YardocTask.new(:pages) do |t|
t.files = DOC_FILES
t.options = ['-o', '../grape.doc/docs']
YARD::Rake::YardocTask.new(:doc) do |t|
t.files = DOC_FILES
end

namespace :pages do
desc 'Check out gh-pages.'
task :checkout do
dir = File.dirname(__FILE__) + '/../grape.doc'
unless Dir.exist?(dir)
Dir.mkdir(dir)
Dir.chdir(dir) do
system('git init')
system('git remote add origin git@github.com:ruby-grape/grape.git')
system('git pull')
system('git checkout gh-pages')
namespace :doc do
YARD::Rake::YardocTask.new(:pages) do |t|
t.files = DOC_FILES
t.options = ['-o', '../grape.doc/docs']
end

namespace :pages do
desc 'Check out gh-pages.'
task :checkout do
dir = File.dirname(__FILE__) + '/../grape.doc'
unless Dir.exist?(dir)
Dir.mkdir(dir)
Dir.chdir(dir) do
system('git init')
system('git remote add origin git@github.com:ruby-grape/grape.git')
system('git pull')
system('git checkout gh-pages')
end
end
end
end

desc 'Generate and publish YARD docs to GitHub pages.'
task publish: ['doc:pages:checkout', 'doc:pages'] do
Dir.chdir(File.dirname(__FILE__) + '/../grape.doc') do
system('git checkout gh-pages')
system('git add .')
system('git add -u')
system("git commit -m 'Generating docs for version #{Grape::VERSION}.'")
system('git push origin gh-pages')
desc 'Generate and publish YARD docs to GitHub pages.'
task publish: ['doc:pages:checkout', 'doc:pages'] do
Dir.chdir(File.dirname(__FILE__) + '/../grape.doc') do
system('git checkout gh-pages')
system('git add .')
system('git add -u')
system("git commit -m 'Generating docs for version #{Grape::VERSION}.'")
system('git push origin gh-pages')
end
end
end
end
rescue LoadError # rubocop:disable Lint/HandleExceptions
# ignore
end
20 changes: 20 additions & 0 deletions gemfiles/rack_1.5.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,29 @@ source 'https://rubygems.org'
gem 'rack', '1.5.2'

group :development, :test do
gem 'bundler'
gem 'rake'
gem 'rubocop', '0.39.0'
end

group :development do
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'yard'
gem 'appraisal'
gem 'benchmark-ips'
gem 'redcarpet'
end

group :test do
gem 'grape-entity', '0.5.0'
gem 'maruku'
gem 'rack-test'
gem 'rspec', '~> 3.0'
gem 'cookiejar'
gem 'rack-contrib'
gem 'mime-types', '< 3.0'
end

gemspec path: '../'
22 changes: 21 additions & 1 deletion gemfiles/rails_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,33 @@

source 'https://rubygems.org'

gem 'rails', '3.2.22'
gem 'rails', '3.2.19'
gem 'rack-cache', '<= 1.2'

group :development, :test do
gem 'bundler'
gem 'rake'
gem 'rubocop', '0.39.0'
end

group :development do
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'yard'
gem 'appraisal'
gem 'benchmark-ips'
gem 'redcarpet'
end

group :test do
gem 'grape-entity', '0.5.0'
gem 'maruku'
gem 'rack-test'
gem 'rspec', '~> 3.0'
gem 'cookiejar'
gem 'rack-contrib'
gem 'mime-types', '< 3.0'
end

gemspec path: '../'
20 changes: 20 additions & 0 deletions gemfiles/rails_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,29 @@ source 'https://rubygems.org'
gem 'rails', '4.1.6'

group :development, :test do
gem 'bundler'
gem 'rake'
gem 'rubocop', '0.39.0'
end

group :development do
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'yard'
gem 'appraisal'
gem 'benchmark-ips'
gem 'redcarpet'
end

group :test do
gem 'grape-entity', '0.5.0'
gem 'maruku'
gem 'rack-test'
gem 'rspec', '~> 3.0'
gem 'cookiejar'
gem 'rack-contrib'
gem 'mime-types', '< 3.0'
end

gemspec path: '../'
14 changes: 0 additions & 14 deletions grape.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'virtus', '>= 1.0.0'
s.add_runtime_dependency 'builder'

s.add_development_dependency 'grape-entity', '0.5.0'
s.add_development_dependency 'rake', '~> 10'
s.add_development_dependency 'maruku'
s.add_development_dependency 'yard'
s.add_development_dependency 'rack-test'
s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'bundler'
s.add_development_dependency 'cookiejar'
s.add_development_dependency 'rack-contrib'
s.add_development_dependency 'mime-types', '< 3.0'
s.add_development_dependency 'appraisal'
s.add_development_dependency 'benchmark-ips'
s.add_development_dependency 'rubocop', '0.35.1'

s.files = Dir['**/*'].keep_if { |file| File.file?(file) }
s.test_files = Dir['spec/**/*']
s.require_paths = ['lib']
Expand Down
2 changes: 1 addition & 1 deletion lib/grape/dsl/headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def header(key = nil, val = nil)
@header ||= {}
end
end
alias_method :headers, :header
alias headers header
end
end
end
Loading