Class: Cigarette
Constant Summary collapse
- VERSION =
"2.3"- CANCER_DO_NOT_APPEAR =
Hope.
42
Constants included from Colors
Colors::BLACK, Colors::BLUE, Colors::CYAN, Colors::DEFAULT, Colors::GREEN, Colors::MAGENTA, Colors::RED, Colors::WHITE, Colors::YELLOW
Instance Method Summary collapse
-
#initialize ⇒ Cigarette
constructor
A new instance of Cigarette.
Constructor Details
#initialize ⇒ Cigarette
Returns a new instance of Cigarette.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cigarette.rb', line 14 def initialize begin cnf = YAML::load(File.open("#{Dir.pwd}/.cigarette")) unless cnf["rvm"].nil? @rubies = cnf["rvm"] raise "rvm error in yaml. You have to put a list. (-)" unless @rubies.is_a? Array else RVM.use_system! @rubies = [RUBY_VERSION] end @time = cnf['each'].to_i @next_check = Time.now.to_i + @time @command = cnf['command'] rescue NoMethodError abort "Problem during .cigarette loading: 'each:' and 'command:' attributes are MANDATORY." rescue TypeError abort "Didn't you make a mistake in .cigarette file ?" rescue ArgumentError abort "Did you configure attribute like this: 'attribute: <value>'." rescue Exception => e abort "Problem during .cigarette loading: #{e.message}." end deploy_trap init_curses roll_baby_roll! lighter_please! end |