2

Hello Friends! I am new to ruby and bundler, I am currently working on a project where I am suppose to show a message after someone runs bundle install on the project i.e. user download my app and runs 'bundle install' then after gems are installed he should get a custom message. any suggestions?

thanks all.

Best Regards

Sajid

Sajid
  • 379
  • 4
  • 18
  • 1
    `post_install_message` http://rubygems.rubyforge.org/rubygems-update/Gem/Specification.html – Kris Nov 14 '16 at 15:02
  • @Kris confusion here, wont this display message when someone does 'bundle install myapp'? I was wondering how can I show message if user does bundle install in my app after checking out from a repo. – Sajid Nov 14 '16 at 15:21
  • The other common option is to have a script which you point to in the README which will do all the setup, i.e. bundle install then any other commands. – Kris Nov 15 '16 at 15:34

1 Answers1

0

Okay, I did some research on google but was not able to find any solution so here is what i did in my Gemfile to make it work ( I know it is a hack :(, but i hope it may help someone ):

filename = ".tmp"
at_exit do
  if File.file?(filename)
    puts "Dependencies installed successfully, please run 'ruby install.rb' to configure."
    File.delete(filename)
  else
    out_file = File.new(filename, "w")
    out_file.close
  end
end

in simply placing put was printing it twice so I wrote a temp file and deleted it in second go so now it prints only once.

Thanks

Sajid

Sajid
  • 379
  • 4
  • 18