Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update raad for newer Ruby/JRuby... #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
30 changes: 19 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@ PATH
remote: .
specs:
raad (0.5.0)
log4r (~> 1.1.9)
log4r (~> 1.1.10)

GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.3)
diff-lcs (1.3)
log4r (1.1.10)
rake (0.9.2.2)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)

PLATFORMS
java
Expand All @@ -26,4 +31,7 @@ PLATFORMS
DEPENDENCIES
raad!
rake (~> 0.9.2)
rspec (~> 2.8.0)
rspec (~> 3.8.0)

BUNDLED WITH
2.0.1
4 changes: 2 additions & 2 deletions lib/raad/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def jruby?
#
# @return [String] absolute path of current interpreter
def ruby_path
File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"] + Config::CONFIG["EXEEXT"])
File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["RUBY_INSTALL_NAME"] + RbConfig::CONFIG["EXEEXT"])
end

# ruby interpreter command line options
Expand Down Expand Up @@ -107,4 +107,4 @@ def custom_options

module_function :env, :env=, :production?, :development?, :stage?, :test?, :jruby?, :ruby_path, :ruby_options, :ruby_options=, :stopped?, :stopped=, :custom_options

end
end
4 changes: 2 additions & 2 deletions raad.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']

# Test dependencies
s.add_development_dependency "rspec", ["~> 2.8.0"]
s.add_development_dependency "rspec", ["~> 3.8.0"]
s.add_development_dependency "rake", ["~> 0.9.2"]

s.add_runtime_dependency "log4r", ["~> 1.1.9"]
s.add_runtime_dependency "log4r", ["~> 1.1.10"]
end
2 changes: 1 addition & 1 deletion spec/raad/bootstrap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

describe Raad::Bootstrap do
it "should work" do
true.should be_true
expect(true).to be_truthy
end
end
2 changes: 1 addition & 1 deletion spec/raad/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe Raad::Configuration do
it "should work" do
true.should be_true
expect(true).to be_truthy
end
end
50 changes: 30 additions & 20 deletions spec/raad/env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,78 @@
describe "Raad env" do

it "should set default env to :development" do
Raad.env.should == :development
Raad.development?.should be_true
expect(Raad.env).to eq(:development)
expect(Raad.development?).to be_truthy
end

it "should set development env" do
[:development, :dev, "development", "dev"].each do |env|
Raad.env = env
Raad.env.should == :development
Raad.development?.should be_true
[:production?, :stage?, :test?].each{|env| Raad.send(env).should be_false}
expect(Raad.env).to eq(:development)
expect(Raad.development?).to be_truthy
[:production?, :stage?, :test?].each do |env|
expect(Raad.send(env)).to be_falsy
end
end
end

it "should set production env" do
[:production, :prod, "production", "prod"].each do |env|
Raad.env = env
Raad.env.should == :production
Raad.production?.should be_true
[:development?, :stage?, :test?].each{|env| Raad.send(env).should be_false}
expect(Raad.env).to eq(:production)
expect(Raad.production?).to be_truthy
[:development?, :stage?, :test?].each do |env|
expect(Raad.send(env)).to be_falsy
end
end
end

it "should set stage env" do
[:stage, :staging, "stage", "staging"].each do |env|
Raad.env = env
Raad.env.should == :stage
Raad.stage?.should be_true
[:development?, :production?, :test?].each{|env| Raad.send(env).should be_false}
expect(Raad.env).to eq(:stage)
expect(Raad.stage?).to be_truthy
[:development?, :production?, :test?].each do |env|
expect(Raad.send(env)).to be_falsy
end
end
end

it "should set test env" do
[:test, "test"].each do |env|
Raad.env = env
Raad.env.should == :test
Raad.test?.should be_true
[:development?, :production?, :stage?].each{|env| Raad.send(env).should be_false}
expect(Raad.env).to eq(:test)
expect(Raad.test?).to be_truthy
[:development?, :production?, :stage?].each do |env|
expect(Raad.send(env)).to be_falsy
end
end
end

it "should set arbritary env" do
[:arbritary, "arbritary"].each do |env|
Raad.env = env
Raad.env.should == :arbritary
[:development?, :production?, :stage?, :test?].each{|env| Raad.send(env).should be_false}
expect(Raad.env).to eq(:arbritary)
[:development?, :production?, :stage?, :test?].each do |env|
expect(Raad.send(env)).to be_falsy
end
end
end

it "should test for jruby" do
[true, false].should include(Raad.jruby?)
expect([true, false]).to include(Raad.jruby?)
end

it "should report ruby path" do
File.exist?(Raad.ruby_path).should be_true
expect(File.exist?(Raad.ruby_path)).to be_truthy
end

it "should default to empty ruby_options" do
Raad.ruby_options.should == []
expect(Raad.ruby_options.length).to eq(0)
end

it "should set ruby_options" do
Raad.ruby_options = "a b"
Raad.ruby_options.should == ['a', 'b']
expect(Raad.ruby_options).to eq(['a', 'b'])
end
end
2 changes: 1 addition & 1 deletion spec/raad/logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe Raad::Logger do
it "should work" do
true.should be_true
expect(true).to be_truthy
end
end
10 changes: 5 additions & 5 deletions spec/raad/signal_trampoline_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
it "should trap signal" do
t = Thread.new{Thread.stop}
SignalTrampoline.trap(:USR2) {t.run}
t.alive?.should be_true
expect(t.alive?).to be_truthy
Timeout.timeout(5) {sleep(0.1) while !t.stop?} # avoid race condition
t.stop?.should be_true
expect(t.stop?).to be_truthy
Process.kill(:USR2, Process.pid)
Timeout.timeout(5) {sleep(0.1) while t.alive?}
t.alive?.should be_false
t.join(5).should == t
expect(t.alive?).to be_falsy
expect(t.join(5)).to eq(t)
end

it "should raise on bad signal" do
lambda{SignalTrampoline.trap(:WAGADOUDOU) {}}.should raise_exception
expect(lambda{SignalTrampoline.trap(:WAGADOUDOU) {}}).to raise_exception(RuntimeError)
end
end
4 changes: 2 additions & 2 deletions spec/raad/spoon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

describe Spoon do
it "should work" do
true.should be_true
expect(true).to be_truthy
end
end

end
end
Loading