diff --git a/.gitignore b/.gitignore index 22ef80f..7de39cc 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /tmp/ /.rspec_status /spec/run/ +/dspec/ diff --git a/Rakefile b/Rakefile index 9696595..aa97e1d 100644 --- a/Rakefile +++ b/Rakefile @@ -10,6 +10,18 @@ RSpec::Core::RakeTask.new(:spec, :example_pattern) do |task, args| end end +# dspec task is useful to test the distributable release script, but is not +# useful for coverage information. +desc "Dist Specs" +task :dspec, [:example_string] => :build_dist do |task, args| + FileUtils.rm_rf("dspec") + FileUtils.mkdir_p("dspec") + FileUtils.cp("dist/propane", "dspec/propane") + ENV["dist_specs"] = "1" + Rake::Task["spec"].execute(args) + ENV.delete("dist_specs") +end + task :default => :spec desc "Build user guide" diff --git a/spec/propane_spec.rb b/spec/propane_spec.rb index 5e9a9f1..5467f9a 100644 --- a/spec/propane_spec.rb +++ b/spec/propane_spec.rb @@ -11,7 +11,12 @@ describe Propane do def build_parser(options = {}) options[:name] ||= "" - command = %W[./propane.sh spec/run/testparser#{options[:name]}.propane spec/run/testparser#{options[:name]}.#{options[:language]} --log spec/run/testparser#{options[:name]}.log] + if ENV["dist_specs"] + propane = "dspec/propane" + else + propane = "./propane.sh" + end + command = %W[#{propane} spec/run/testparser#{options[:name]}.propane spec/run/testparser#{options[:name]}.#{options[:language]} --log spec/run/testparser#{options[:name]}.log] if (options[:capture]) stdout, stderr, status = Open3.capture3(*command) Results.new(stdout, stderr, status)