Rake doing things twice
krainboltgreene opened this issue · 4 comments
krainboltgreene commented
$ bundle exec rake build install
Successfully uninstalled whiskey-1.0.0
whiskey 1.0.0 built to pkg/whiskey-1.0.0.gem.
whiskey 1.0.0 built to pkg/whiskey-1.0.0.gem.
whiskey (1.0.0) installed.
whiskey (1.0.0) installed.
My gem list:
$ gem list 1 ↵
*** LOCAL GEMS ***
actionmailer (4.0.0)
actionpack (4.0.0)
activemodel (4.0.0, 3.2.13)
activerecord (4.0.0, 3.2.13)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0, 3.2.13)
arel (4.0.0, 3.0.2)
astruct (2.11.0)
atomic (1.1.10)
awesome_print (1.1.0)
bigdecimal (1.2.0)
builder (3.1.4, 3.0.4)
bundler (1.3.5)
celluloid (0.14.1)
celluloid-io (0.14.1)
coderay (1.0.9)
colored (1.2)
erubis (2.7.0)
hike (1.2.3)
i18n (0.6.4, 0.6.1)
io-console (0.4.2)
json (1.7.7)
mail (2.5.4)
method_source (0.8.1)
mime-types (1.23)
minitest (4.3.2)
moneta (0.7.19)
multi_json (1.7.7)
nio4r (0.4.6)
pg (0.15.1)
polyglot (0.3.3)
pry (0.9.12.2)
pry-doc (0.4.6)
psych (2.0.0)
rack (1.5.2)
rack-test (0.6.2)
rails (4.0.0)
railties (4.0.0)
rake (10.1.0, 0.9.6)
rdoc (4.0.1, 4.0.0)
rvm (1.11.3.8)
slop (3.4.5)
sprockets (2.10.0)
sprockets-rails (2.0.0)
sqlite3 (1.3.7)
test-unit (2.0.0.0)
thor (0.18.1)
thread_safe (0.1.0)
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.14)
tzinfo (0.3.37)
yard (0.8.6.2)
My env:
$ env
PATH=/Users/krainboltgreene/.rvm/gems/ruby-2.0.0-p247@london_by_claw/bin:/Users/krainboltgreene/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/krainboltgreene/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/krainboltgreene/.rvm/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/heroku/bin:/usr/local/git/bin:/usr/X11/bin:/usr/bin:/usr/sbin:/bin:/sbin:/Users/krainboltgreene/bin
TMPDIR=/var/folders/w2/xf402_nd0pd395xy_d7276yh0000gn/T/
SHELL=/bin/zsh
HOME=/Users/krainboltgreene
USER=krainboltgreene
LOGNAME=krainboltgreene
SSH_AUTH_SOCK=/tmp/launch-rHVRSI/Listeners
Apple_Ubiquity_Message=/tmp/launch-sSy33v/Apple_Ubiquity_Message
Apple_PubSub_Socket_Render=/tmp/launch-1e64Z0/Render
DESTINATION=/var/folders/w2/xf402_nd0pd395xy_d7276yh0000gn/T/iTerm 1.0.0.20130622 Update
TERM_PROGRAM=iTerm.app
COMMAND_MODE=unix2003
SECURITYSESSIONID=186a4
__CF_USER_TEXT_ENCODING=0x1F5:0:0
COLORFGBG=7;0
LANG=en_US.UTF-8
PWD=/Users/krainboltgreene/Code/Ruby/gems
ITERM_PROFILE=Default
TERM=xterm
ITERM_SESSION_ID=w0t0p1
SHLVL=1
OLDPWD=/Users/krainboltgreene/Code/Ruby/gems/whiskey
ZSH=/Users/krainboltgreene/.oh-my-zsh
ZSH_THEME=macovsky-ruby
GREP_OPTIONS=--color=auto
GREP_COLOR=1;32
PAGER=less
LESS=-R
LC_CTYPE=en_US.UTF-8
LSCOLORS=Gxfxcxdxbxegedabagacad
HEROKU_BINPATH=/usr/local/heroku/bin
GIT_BINPATH=/usr/local/git/bin
MISC_BINPATH=/usr/X11/bin
NODE_BINPATH=/usr/local/share/npm/bin
RVM_BINPATH=/Users/krainboltgreene/.rvm/bin
LOCAL_BINPATH=/usr/local/bin:/usr/local/sbin
USR_BINPATH=/usr/bin:/usr/sbin
ROOT_BINPATH=/bin:/sbin
LIBRARY_BINPATHS=/usr/local/share/npm/bin:/Users/krainboltgreene/.rvm/bin:/usr/local/bin:/usr/local/sbin
SPECIAL_BINPATHS=/usr/local/heroku/bin:/usr/local/git/bin:/usr/X11/bin
CORE_BINPATHS=/usr/bin:/usr/sbin:/bin:/sbin
rvm_prefix=/Users/krainboltgreene
rvm_path=/Users/krainboltgreene/.rvm
rvm_bin_path=/Users/krainboltgreene/.rvm/bin
rvm_version=1.21.9 (stable)
rvm_alias_expanded=
rvm_docs_type=
rvm_gemstone_package_file=
rvm_gemstone_url=
rvm_niceness=
rvm_nightly_flag=
rvm_proxy=
rvm_quiet_flag=
rvm_ruby_file=
rvm_ruby_make=
rvm_ruby_make_install=
rvm_ruby_mode=
rvm_script_name=
rvm_sdk=
rvm_silent_flag=
rvm_wrapper_name=
rvm_recommended_ruby=rvm install ruby-2.0.0-p195
RUBY_HEAP_MIN_SLOTS=1000000
RUBY_HEAP_SLOTS_INCREMENT=1000000
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_GC_MALLOC_LIMIT=1000000000
RUBY_HEAP_FREE_MIN=500000
install_flag=1
GEM_HOME=/Users/krainboltgreene/.rvm/gems/ruby-2.0.0-p247@london_by_claw
GEM_PATH=/Users/krainboltgreene/.rvm/gems/ruby-2.0.0-p247@london_by_claw:/Users/krainboltgreene/.rvm/gems/ruby-2.0.0-p247@global
MY_RUBY_HOME=/Users/krainboltgreene/.rvm/rubies/ruby-2.0.0-p247
RUBY_VERSION=ruby-2.0.0-p247
IRBRC=/Users/krainboltgreene/.rvm/rubies/ruby-2.0.0-p247/.irbrc
rvm_env_string=ruby-2.0.0-p247@london_by_claw
rvm_ruby_string=ruby-2.0.0-p247
_=/usr/bin/env
jimweirich commented
What's your Rakefile? What tasks are being done twice?
krainboltgreene commented
$ cat Rakefile
#!/usr/bin/env rake
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "yard"
require "pry"
begin
Bundler.setup :default, :development
Bundler::GemHelper.install_tasks
rescue Bundler::BundlerError => error
$stderr.puts error.message
$stderr.puts "Run `bundle install` to install missing gems"
exit error.status_code
end
RSpec::Core::RakeTask.new(:spec)
desc "Generate all of the docs"
YARD::Rake::YardocTask.new do |config|
config.files = Dir["lib/**/*.rb"]
end
desc "Default: run tests and generate docs"
task :default => [ :spec, :yard ]
Any of the bundler ones, now that I think check. Should I move this to bundler/bundler?
jimweirich commented
I've not been able to reproduce this, so I don't know what is going on.
jimweirich commented
OK. I did some more digging and was finally able to reproduce this. In your Rakefile you have:
#!/usr/bin/env rake
require "bundler/gem_tasks" # LINE 1
require "rspec/core/rake_task"
require "yard"
require "pry"
begin
Bundler.setup :default, :development
Bundler::GemHelper.install_tasks # LINE 2
rescue Bundler::BundlerError => error
$stderr.puts error.message
$stderr.puts "Run `bundle install` to install missing gems"
exit error.status_code
end
[...more stuff ...]
The line marked "LINE 1" and "LINE 2" both define the set of bundler gem tasks. As a result, the bumdler related tasks are getting two copies of the code to run for that task. This is the source of the "double" run.
Remove "LINE 2" from your Rakefile and you should be good to go.