Skip to content

Commit

Permalink
Update travis.
Browse files Browse the repository at this point in the history
* Add more rubies.
* Do not pin bundler.
* Add rubocop config from tul_cob (keep standards the same across
projects)
  • Loading branch information
dkinzer committed Sep 17, 2019
1 parent 981236f commit cd40b4a
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 9 deletions.
139 changes: 139 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
AllCops:
TargetRubyVersion: 2.4
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Exclude:
- 'node_modules/**/*'
- '**/templates/**/*'
- '**/vendor/**/*'
- 'actionpack/lib/action_dispatch/journey/parser.rb'
- 'bin/*'

# Prefer &&/|| over and/or.
Style/AndOr:
Enabled: true

# Do not use braces for hash literals when they are the last argument of a
# method call.
Style/BracesAroundHashParameters:
Enabled: true
EnforcedStyle: context_dependent

# Align `when` with `case`.
Layout/CaseIndentation:
Enabled: true

# Align comments with method definitions.
Layout/CommentIndentation:
Enabled: true

Layout/EmptyLineAfterMagicComment:
Enabled: true

# In a regular class definition, no empty lines around the body.
Layout/EmptyLinesAroundClassBody:
Enabled: true

# In a regular method definition, no empty lines around the body.
Layout/EmptyLinesAroundMethodBody:
Enabled: true

# In a regular module definition, no empty lines around the body.
Layout/EmptyLinesAroundModuleBody:
Enabled: true

Layout/IndentFirstArgument:
Enabled: true

# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
Style/HashSyntax:
Enabled: true

# Method definitions after `private` or `protected` isolated calls need one
# extra level of indentation.
Layout/IndentationConsistency:
Enabled: true
EnforcedStyle: indented_internal_methods

# Two spaces, no tabs (for indentation).
Layout/IndentationWidth:
Enabled: true

Layout/SpaceAfterColon:
Enabled: true

Layout/SpaceAfterComma:
Enabled: true

Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true

Layout/SpaceAroundKeyword:
Enabled: true

Layout/SpaceAroundOperators:
Enabled: true

Layout/SpaceBeforeFirstArg:
Enabled: true

# Defining a method with parameters needs parentheses.
Style/MethodDefParentheses:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
Exclude:
- 'app/models/traject_indexer.rb'
- 'db/schema.rb'

# Use `foo {}` not `foo{}`.
Layout/SpaceBeforeBlockBraces:
Enabled: true

# Use `foo { bar }` not `foo {bar}`.
Layout/SpaceInsideBlockBraces:
Enabled: true

# Use `{ a: 1 }` not `{a:1}`.
Layout/SpaceInsideHashLiteralBraces:
Enabled: true

Layout/SpaceInsideParens:
Enabled: true

# Check quotes usage according to lint rule below.
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

# Detect hard tabs, no hard tabs.
Layout/Tab:
Enabled: true

# Blank lines should not have any spaces.
Layout/TrailingBlankLines:
Enabled: true

# No trailing whitespace.
Layout/TrailingWhitespace:
Enabled: true

# Use quotes for string literals when they are enough.
Style/UnneededPercentQ:
Enabled: true

# Align `end` with the matching keyword or starting expression except for
# assignments, where it should be aligned with the LHS.
Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: variable

# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
Lint/RequireParentheses:
Enabled: true

Rails:
Enabled: true
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
sudo: false
language: ruby
cache: bundler
rvm:
- 2.4.1
before_install: gem install bundler -v 1.16.6
- 2.4
- 2.5
- 2.6

script:
- bundle exec rake
- bundle exec rubocop
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in cob_web_index.gemspec
gemspec
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ PLATFORMS

DEPENDENCIES
binding_of_caller (~> 0.7)
bundler (~> 1.16)
bundler (>= 1.16)
cob_web_index!
coveralls
guard (~> 2.14)
Expand Down
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
5 changes: 3 additions & 2 deletions cob_web_index.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Expand Down Expand Up @@ -27,7 +28,7 @@ Gem::Specification.new do |spec|

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
Expand All @@ -40,7 +41,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "httparty"
spec.add_runtime_dependency("gli", "~> 2.18")

spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "bundler", ">= 1.16"
spec.add_development_dependency "rake", "~> 12.3"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rubocop", "~> 0.52"
Expand Down
2 changes: 1 addition & 1 deletion lib/cob_web_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def self.pull
end

def self.open_read(url)
if ENV["WEB_CONTENT_BASIC_AUTH_USER"] && ENV["WEB_CONTENT_BASIC_AUTH_PASSWORD"]
if ENV["WEB_CONTENT_BASIC_AUTH_USER"] && ENV["WEB_CONTENT_BASIC_AUTH_PASSWORD"]
user = ENV["WEB_CONTENT_BASIC_AUTH_USER"]
password = ENV["WEB_CONTENT_BASIC_AUTH_PASSWORD"]
open(url, http_basic_authentication: [user, password]).read
Expand Down
2 changes: 2 additions & 0 deletions lib/cob_web_index/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module CobWebIndex
VERSION = "0.1.0"
end
2 changes: 2 additions & 0 deletions spec/cob_web_index_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

RSpec.describe CobWebIndex do
let(:indexer) {
indexer = Traject::Indexer::MarcIndexer.new
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/setup"
require "cob_web_index"

Expand Down

0 comments on commit cd40b4a

Please sign in to comment.