2013-07-25 7 views
4

나는 이것이 정말로 분명하다고 확신하지만, 나는 루비에 대해 아주 새로운 것이다. rake/albacore를 사용하여 일부 작업을 자동화하고 싶습니다. 번들러를 사용하여 빌드 서버에서 사용하기 위해 패키지화하고 싶습니다. 지금은 mixlib-shellout을 사용하여 sys 계정을 가장하는 한 가지 바보 같은 작업을하고 싶습니다.보석 의존성이 설치되어 있지 않음

source 'http://rubygems.org' 
gem 'mixlib-shellout' 
gem 'rake' 

하고 다음 레이크 파일 :이를 위해 나는 다음과 같은 Gemfile이

require 'rubygems' 
require 'bundler/setup' 

require 'mixlib/shellout' 

task :default do 
    whomai = Mixlib::ShellOut.new("whoami.exe", :user => "username", :domain => "DOMAIN", :password => "password") 
    whoami.run_command 
end 

내가

bundle install 

실행하고 나는 단지 레이크 설치하는 참조를 ...의 없음 Gemfile.lock dep 트리의 다른 종속성은 정상입니까?

PS C:\Users\Ben\src\ruby_test> bundle install 
Fetching gem metadata from http://rubygems.org/........... 
Fetching gem metadata from http://rubygems.org/.. 
Resolving dependencies... 
Installing rake (10.1.0) 
Using bundler (1.3.5) 
Your bundle is complete! 
Use `bundle show [gemname]` to see where a bundled gem is installed. 

나는 다음

bundle exec rake 

을 실행하고 나는 돌아

rake aborted! 
cannot load such file -- mixlib/shellout 
C:/Users/Ben/src/ruby_test/rakefile.rb:4:in `require' 
C:/Users/Ben/src/ruby_test/rakefile.rb:4:in `<top (required)>' 
(See full trace by running task with --trace) 

내가 루비 2.0 들러 1.3.5

감사받은 어떤 도움을 사용하고 얻을.

답변

1

* .gemspec 파일로 보석을 설치하는 것이 좋습니다. 이를 위해 Gemfile은 매우 단순 해집니다 :

source 'https://rubygems.org' 
gemspec 

"GEM_NAME.gemspec"새 파일을 작성하십시오. 다음 예는 다음과 같습니다

Gem::Specification.new do |spec| 
    spec.name   = GAME_NAME 
    spec.version  = VERSION 
    spec.authors  = AUTHORS 
    spec.email   = EMAILS 
    spec.summary  = SUMMARY 
    spec.description = DESCRIPTION 
    spec.homepage  = HOMEPAGE 

    spec.files   = Dir['rakefile.rb', '*.gemspec'] 
    spec.files   += Dir['bin/**', 'lib/**/*.rb'] 

    spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 
    spec.require_paths = ["lib"] 

    spec.add_runtime_dependency "ruby-terminfo", "~> 0.1" 

    spec.add_development_dependency "bundler", "~> 1.7" 
    spec.add_development_dependency "rake", "~> 10.0" 
end 

당신은 각 의존 보석에 대해 별도의 spec.add_runtime_dependency를 추가해야합니다. 위의 예제는 "ruby-terminfo"젬을 포함합니다.

또한 보석의 파일 및 폴더 구조를 반영하여 spec.files 필드를 설정해야합니다.

자세한 내용은 RubyGem Guide을 참조하십시오.

관련 문제