Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat are "specs" for in Ruby gems?
    primarykey
    data
    text
    <p>I was looking through the Datamapper directories and opened up <code>dm-core/tasks/dm.rb</code>. Just generally speaking, what the heck is going on in this file? It looks like Greek to me. Particularly this thing about "specs" - what are those for? Is that similar to a software spec which defines what a project is supposed to encompass?</p> <pre><code>require 'spec/rake/spectask' require 'spec/rake/verify_rcov' task :default =&gt; 'spec' RCov::VerifyTask.new(:verify_rcov =&gt; :rcov) do |t| t.threshold = 87.7 # Make sure you have rcov 0.7 or higher! end def run_spec(name, files, rcov) Spec::Rake::SpecTask.new(name) do |t| t.spec_opts &lt;&lt; '--options' &lt;&lt; ROOT + 'spec/spec.opts' t.spec_files = Pathname.glob(ENV['FILES'] || files.to_s).map { |f| f.to_s } t.rcov = rcov t.rcov_opts &lt;&lt; '--exclude' &lt;&lt; 'spec' t.rcov_opts &lt;&lt; '--text-summary' #t.rcov_opts &lt;&lt; '--sort' &lt;&lt; 'coverage' &lt;&lt; '--sort-reverse' #t.rcov_opts &lt;&lt; '--only-uncovered' #t.rcov_opts &lt;&lt; '--profile' end end public_specs = ROOT + 'spec/public/**/*_spec.rb' semipublic_specs = ROOT + 'spec/semipublic/**/*_spec.rb' all_specs = ROOT + 'spec/**/*_spec.rb' desc 'Run all specifications' run_spec('spec', all_specs, false) desc 'Run all specifications with rcov' run_spec('rcov', all_specs, true) namespace :spec do desc 'Run public specifications' run_spec('public', public_specs, false) desc 'Run semipublic specifications' run_spec('semipublic', semipublic_specs, false) end namespace :rcov do desc 'Run public specifications with rcov' run_spec('public', public_specs, true) desc 'Run semipublic specifications with rcov' run_spec('semipublic', semipublic_specs, true) end desc 'Run all comparisons with ActiveRecord' task :perf do sh ROOT + 'script/performance.rb' end desc 'Profile DataMapper' task :profile do sh ROOT + 'script/profile.rb' end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload