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 rspec and require newer Ruby versions #49

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
75 changes: 54 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,70 @@ PATH
specs:
turbulence (1.2.4)
flog (~> 4.1)
json (>= 1.4.6)
json (>= 2.7.2)
launchy (>= 2.0.0)

GEM
remote: http://rubygems.org/
specs:
addressable (2.3.6)
diff-lcs (1.2.5)
flog (4.2.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
childprocess (5.1.0)
logger (~> 1.5)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.1)
flog (4.8.0)
path_expander (~> 1.0)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.4)
json (1.8.1)
launchy (2.4.2)
addressable (~> 2.3)
rake (10.1.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
ruby_parser (3.6.1)
sexp_processor (~> 4.1)
sexp_processor (4.4.3)
sexp_processor (~> 4.8)
io-console (0.7.2)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
launchy (3.0.1)
addressable (~> 2.8)
childprocess (~> 5.0)
logger (1.6.1)
path_expander (1.1.3)
psych (5.1.2)
stringio
public_suffix (6.0.1)
racc (1.8.1)
rake (13.2.1)
rdoc (6.7.0)
psych (>= 4.0.0)
reline (0.5.10)
io-console (~> 0.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
ruby_parser (3.21.1)
racc (~> 1.5)
sexp_processor (~> 4.16)
sexp_processor (4.17.2)
stringio (3.1.1)

PLATFORMS
ruby

DEPENDENCIES
debug
rake
rspec (~> 2.14.0)
rspec (~> 3.13.0)
turbulence!

BUNDLED WITH
2.5.17
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require 'rake'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |t|
t.skip_bundler = true
# t.skip_bundler = true
end

task :default => [:spec]
16 changes: 1 addition & 15 deletions lib/turbulence/calculators/complexity.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
require 'stringio'
require 'flog'

class Ruby19Parser < RubyParser
def process(ruby, file)
ruby.gsub!(/(\w+):\s+/, '"\1" =>')
super(ruby, file)
end
end unless defined?(:Ruby19Parser)

class Flog19 < Flog
def initialize option = {}
super(option)
@parser = Ruby19Parser.new
end
end

class Turbulence
module Calculators
class Complexity
Expand All @@ -26,7 +12,7 @@ def initialize(config = nil)
end

def flogger
@flogger ||= Flog19.new(:continue => true)
@flogger ||= Flog.new(:continue => true)
end

def for_these_files(files)
Expand Down
2 changes: 1 addition & 1 deletion lib/turbulence/scm/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def log_command(commit_range = "")

def is_repo?(directory)
FileUtils.cd(directory) {
return !(`git status 2>&1` =~ /Not a git repository/)
return !(`git status 2>&1` =~ /Not a git repository/i)
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/turbulence/cli_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def parse(argv)

it "sets compute mean" do
parse %w( --churn-mean )
config.compute_mean.should be_true
config.compute_mean.should be true
end

it "sets the exclusion pattern" do
Expand Down
2 changes: 1 addition & 1 deletion spec/turbulence/command_line_interface_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
cli = Turbulence::CommandLineInterface.new(%w(--exclude turbulence), :output => nil)
cli.generate_bundle
lines = File.new('turbulence/cc.js').readlines
lines.any? { |l| l =~ /turbulence\.rb/ }.should be_false
lines.any? { |l| l =~ /turbulence\.rb/ }.should be false
end
end
end
10 changes: 5 additions & 5 deletions spec/turbulence/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

describe Turbulence::Configuration do
describe "defaults" do
its(:output) { should eq(STDOUT) }
its(:directory) { should eq(Dir.pwd) }
its(:graph_type) { should eq('turbulence') }
its(:scm_name) { should eq('Git') }
its(:scm) { should eq(Turbulence::Scm::Git) }
it { expect(subject.output).to eq(STDOUT) }
it { expect(subject.directory).to eq(Dir.pwd) }
it { expect(subject.graph_type).to eq('turbulence') }
it { expect(subject.scm_name).to eq('Git') }
it { expect(subject.scm).to eq(Turbulence::Scm::Git) }
end
end

6 changes: 3 additions & 3 deletions spec/turbulence/scm/perforce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
it "returns true if P4CLIENT is set " do
ENV.stub(:[]).with("P4CLIENT").and_return("c-foo.bar")

Turbulence::Scm::Perforce.is_repo?(".").should be_true
Turbulence::Scm::Perforce.is_repo?(".").should be true
end

it "returns false if P4CLIENT is empty" do
Turbulence::Scm::Perforce.is_repo?(".").should be_false
Turbulence::Scm::Perforce.is_repo?(".").should be false
end

it "returns false if p4 is not available" do
Turbulence::Scm::Perforce.is_repo?(".").should be_false
Turbulence::Scm::Perforce.is_repo?(".").should be false
end
end

Expand Down
8 changes: 4 additions & 4 deletions turbulence.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Gem::Specification.new do |s|
s.email = ["[email protected]", "[email protected]", "[email protected]"]
s.homepage = "http://chadfowler.com"
s.add_dependency "flog", "~>4.1"
s.add_dependency "json", ">= 1.4.6"
s.add_dependency "json", ">= 2.7.2"
s.add_dependency "launchy", ">= 2.0.0"
s.add_development_dependency 'rspec', '~> 2.14.0'
s.add_development_dependency 'rake'
s.add_development_dependency "rspec", "~> 3.13.0"
s.add_development_dependency "rake"

s.summary = %q{Automates churn + flog scoring on a git repo for a Ruby project}
s.description = %q{Automates churn + flog scoring on a git repo for a Ruby project. Based on the article https://www.stickyminds.com/article/getting-empirical-about-refactoring}
Expand All @@ -22,5 +22,5 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.required_ruby_version = '>= 1.8.7'
s.required_ruby_version = ">= 3.2.0"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a big jump here but only because this is a recent version of ruby. I did not verify what specific version was necessary but I think it would make sense to switch to Prism for the parser.
I'm happy to walk back any of these changes where there might be concern that they were too aggressive in jumping versions.

end