だから私はgemに取り組んでいます...私はbundleと入力し、rspec 2.0.1をインストールします。これは、ご存知のとおり、rspec2.12.2のこの時代では受け入れられません。
レーキスペックを実行する場合を除いて、私はそれで大丈夫でしょう...
% rake spec
/home/alg/.rvm/rubies/ruby-1.9.3-p374/bin/ruby -S bundle exec rspec "./spec/file_comparisons_spec.rb" "./spec/monitor_spec.rb" "./spec/pipboy_spec.rb"
/home/alg/Documents/Code/pipboy/spec/spec_helper.rb:8:in `block in <top (required)>': undefined method `treat_symbols_as_metadata_keys_with_true_values=' for #<RSpec::Core::Configuration:0x9c99a74> (NoMethodError)
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core.rb:67:in `configure'
from /home/alg/Documents/Code/pipboy/spec/spec_helper.rb:7:in `<top (required)>'
from /home/alg/Documents/Code/pipboy/spec/file_comparisons_spec.rb:1:in `require'
from /home/alg/Documents/Code/pipboy/spec/file_comparisons_spec.rb:1:in `<top (required)>'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `load'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `block in load_spec_files'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `map'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `load_spec_files'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:18:in `run'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:55:in `run_in_process'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:46:in `run'
from /home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!
ruby -S bundle exec rspec "./spec/file_comparisons_spec.rb" "./spec/monitor_spec.rb" "./spec/pipboy_spec.rb" failed
/home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/rake_task.rb:117:in `rescue in block (2 levels) in initialize'
/home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/rake_task.rb:113:in `block (2 levels) in initialize'
/home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/gems/rspec-core-2.0.1/lib/rspec/core/rake_task.rb:109:in `block in initialize'
/home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/bin/ruby_noexec_wrapper:14:in `eval'
/home/alg/.rvm/gems/ruby-1.9.3-p374@pipboy/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => spec
(See full trace by running task with --trace)
それで、私がそれらに何も悪いことを見つけることができないとしても、私が重要だと思うビットはここにあります:
=> Rakefile
require "bundler/gem_tasks"
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "features --format progress"
end
=> Gemfile
source :rubygems
# Specify your gem's dependencies in pipboy.gemspec
gemspec
=> gemspec
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'pipboy/version'
Gem::Specification.new do |gem|
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'cucumber'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rdoc'
end
そして、Gemfile.lockがない場合、bundleを呼び出した結果...
% bundle
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.3)
Using builder (3.1.4)
Using diff-lcs (1.2.0)
Using json (1.7.6)
Using gherkin (2.11.5)
Using cucumber (1.2.1)
Using pipboy (0.0.1) from source at /home/alg/Documents/Code/pipboy
Using rdoc (3.12)
Using rspec-core (2.0.1)
Using rspec-expectations (2.0.1)
Using rspec-mocks (2.0.1)
Using rspec (2.0.1)
Using bundler (1.2.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
=>事後のGemfile.lock
PATH
remote: .
specs:
pipboy (0.0.1)
GEM
remote: http://rubygems.org/
specs:
builder (3.1.4)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
diff-lcs (1.2.0)
gherkin (2.11.5)
json (>= 1.4.6)
json (1.7.6)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
rspec (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
rspec-mocks (~> 2.0.1)
rspec-core (2.0.1)
rspec-expectations (2.0.1)
diff-lcs (>= 1.1.2)
rspec-mocks (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
PLATFORMS
ruby
DEPENDENCIES
cucumber
pipboy!
rake
rdoc
rspec