Skip to content

Commit

Permalink
Merge pull request #26 from dblock/fix-build
Browse files Browse the repository at this point in the history
Fixing the build and merging #24
  • Loading branch information
dblock authored Apr 30, 2019
2 parents ad9f78a + eb22e84 commit a4a0dea
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 70 deletions.
8 changes: 7 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
AllCops:
Excludes:
Exclude:
- vendor/**
- bin/**

Metrics:
Enabled: false

Style/Documentation:
Enabled: false

inherit_from: .rubocop_todo.yml
42 changes: 16 additions & 26 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-01-01 18:05:17 -0500 using RuboCop version 0.27.1.
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-04-30 10:21:07 -0400 using RuboCop version 0.68.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: 2
Metrics/AbcSize:
Max: 25

# Offense count: 14
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 155

# Offense count: 2
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 17

# Offense count: 3
Style/Documentation:
Enabled: false

# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
Enabled: false
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'lib/guard-rack.rb'

# Offense count: 3
Style/RegexpLiteral:
MaxSlashes: 0
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/guard/rack/custom_process.rb'
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: ruby
rvm:
- 2.4.0
- 2.3.3
- 2.2.6
- 2.1.10
- 2.5.3
- 2.6.3
- jruby
- ruby-head
- jruby-head
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
2.2.1 (Next)
============

* [#24](https://github.com/dblock/guard-rack/pull/24): Use absolute module namespace to prevent conflict with Guard::Process - [@cristianbica](https://github.com/cristianbica).
* Your contribution here.

2.2.0 (4/16/2016)
=================

* [#23](https://github.com/dblock/guard-rack/pull/23) Added Windows support - [@jonyeezs](https://github.com/jonyeezs).
* [#23](https://github.com/dblock/guard-rack/pull/23): Added Windows support - [@jonyeezs](https://github.com/jonyeezs).

2.1.1 (03/07/2015)
============
Expand Down
10 changes: 5 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ source 'http://rubygems.org'
gemspec

gem 'ffi'
gem 'spoon'
gem 'guard', '~> 2.3.0'
gem 'spoon'

group :development, :test do
gem 'guard-rspec', '~> 4.2.5'
gem 'growl'
gem 'rb-inotify', require: false
gem 'rb-fsevent', require: false
gem 'guard-rspec', '~> 4.2.5'
gem 'rb-fchange', require: false
gem 'rubocop', '0.27.1'
gem 'rb-fsevent', require: false
gem 'rb-inotify', require: false
gem 'rubocop', '0.68.0'
end
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'rubygems'
require 'bundler/gem_tasks'

require File.expand_path('../lib/guard/rack/version', __FILE__)
require File.expand_path('lib/guard/rack/version', __dir__)

begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts 'Run `bundle install` to install missing gems'
warn e.message
warn 'Run `bundle install` to install missing gems'
exit e.status_code
end

Expand All @@ -23,4 +23,4 @@ require 'rainbow/ext/string' unless String.respond_to?(:color)
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)

task default: [:rubocop, :spec]
task default: %i[rubocop spec]
9 changes: 4 additions & 5 deletions guard-rack.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/guard/rack/version', __FILE__)
require File.expand_path('lib/guard/rack/version', __dir__)

Gem::Specification.new do |gem|
gem.authors = ['Daniel Doubrovkine']
Expand All @@ -15,15 +14,15 @@ Gem::Specification.new do |gem|
gem.files = `git ls-files`.split("\n")
gem.version = Guard::RackVersion::VERSION

gem.add_dependency 'guard', '~> 2.3'
gem.add_dependency 'ffi'
gem.add_dependency 'guard', '~> 2.3'
gem.add_dependency 'spoon'

gem.add_development_dependency 'rake', '< 11'
gem.add_development_dependency 'bundler'
gem.add_development_dependency 'rspec', '~> 3.0'
gem.add_development_dependency 'fakefs'
gem.add_development_dependency 'mocha', '~> 1.1'
gem.add_development_dependency 'rake', '< 11'
gem.add_development_dependency 'rspec', '~> 3.0'

if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.0')
gem.add_development_dependency 'rack', '< 2'
Expand Down
18 changes: 9 additions & 9 deletions lib/guard/rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ class Rack < ::Guard::Plugin
attr_reader :options, :runner

DEFAULT_OPTIONS = {
port: 9292,
host: '0.0.0.0',
environment: 'development',
port: 9292,
host: '0.0.0.0',
environment: 'development',
start_on_start: true,
force_run: false,
timeout: 20,
debugger: false,
config: 'config.ru',
cmd: 'rackup'
}
force_run: false,
timeout: 20,
debugger: false,
config: 'config.ru',
cmd: 'rackup'
}.freeze

def initialize(options = {})
super
Expand Down
16 changes: 8 additions & 8 deletions lib/guard/rack/custom_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class CustomProcess
attr_reader :options

def self.new(options = {})
if Gem.win_platform?
os_instance = Windows.allocate
else
os_instance = Nix.allocate
end
os_instance = if Gem.win_platform?
Windows.allocate
else
Nix.allocate
end
os_instance.send :initialize, options
os_instance
end
Expand All @@ -24,10 +24,10 @@ def kill(pid, force = false)
result = -1
UI.debug("Trying to kill Rack (PID #{pid})...")
unless force
Process.kill('INT', pid)
::Process.kill('INT', pid)
begin
Timeout.timeout(options[:timeout]) do
_, status = Process.wait2(pid)
_, status = ::Process.wait2(pid)
result = status.exitstatus
UI.debug("Killed Rack (Exit status: #{result})")
end
Expand All @@ -36,7 +36,7 @@ def kill(pid, force = false)
force = true
end
end
Process.kill('TERM', pid) if force
::Process.kill('TERM', pid) if force
result
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/guard/rack/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Guard
module RackVersion
VERSION = '2.2.1'
VERSION = '2.2.1'.freeze
end
end
8 changes: 4 additions & 4 deletions spec/lib/guard/integration.ru
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class HelloWorld
def call(env)
return [
def call(_env)
[
200,
{'Content-Type' => 'text/html'},
["Hello world!"]
{ 'Content-Type' => 'text/html' },
['Hello world!']
]
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/guard/process_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
end

it 'should return true' do
expect(subject.kill pid).to eq(0)
expect(subject.kill(pid)).to eq(0)
end
end

Expand All @@ -63,7 +63,7 @@
end

it 'should return false' do
expect(subject.kill pid).to eq(1)
expect(subject.kill(pid)).to eq(1)
end
end

Expand All @@ -74,7 +74,7 @@
end

it 'should return false' do
expect(subject.kill pid).to eq(-1)
expect(subject.kill(pid)).to eq(-1)
end
end
end
Expand All @@ -99,7 +99,7 @@
end

it 'should result in 0' do
expect(subject.kill pid).to eq(0)
expect(subject.kill(pid)).to eq(0)
end
end
end
Expand Down

0 comments on commit a4a0dea

Please sign in to comment.