Class: Babushka::Base
Constant Summary collapse
- @@start_time =
The time at which babushka was loaded. This is used in LogHelpers to print profiling information via the ‘–profile’ commandline option.
Time.now
Class Method Summary collapse
-
.cmdline ⇒ Object
cmdlineis an instance ofCmdline::Parserthat represents the arguments that were passed via the commandline. - .exit_on_interrupt! ⇒ Object
- .program_name ⇒ Object
- .ref ⇒ Object
-
.run ⇒ Object
The top-level entry point for babushka runs invoked at the command line.
- .runtime_info ⇒ Object
-
.sources ⇒ Object
sourcesis an instance of Babushka::SourcePool, contains all the sources that babushka can currently load deps from. - .start_time ⇒ Object
-
.task ⇒ Object
taskrepresents the overall job that is being run, and things that are external to running the corresponding dep tree itself, like logging.
Class Method Details
.cmdline ⇒ Object
cmdline is an instance of Cmdline::Parser that represents the arguments that were passed via the commandline. It handles parsing those arguments, and choosing the task to perform based on the ‘verb’ supplied - e.g. ‘meet’, ‘list’, etc.
41 42 43 |
# File 'lib/babushka/base.rb', line 41 def cmdline @cmdline ||= Cmdline::Parser.for(ARGV) end |
.exit_on_interrupt! ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/babushka/base.rb', line 64 def exit_on_interrupt! if STDIN.tty? stty_save = `stty -g`.chomp trap("INT") { system "stty", stty_save unless Base.task.current_dep.nil? puts "\n#{Logging.("#{Base.task.current_dep.callstack.first.contextual_name} (cancelled)", false, :closing_status => true)}" end exit false } end end |
.program_name ⇒ Object
88 89 90 |
# File 'lib/babushka/base.rb', line 88 def program_name @program_name ||= ENV['PATH'].split(':').include?(File.dirname($0)) ? File.basename($0) : $0 end |
.ref ⇒ Object
81 82 83 84 85 86 |
# File 'lib/babushka/base.rb', line 81 def ref @ref ||= begin repo = GitRepo.new(Path.path) repo.current_head if repo.exists? end end |
.run ⇒ Object
The top-level entry point for babushka runs invoked at the command line. When the babushka command is run, bin/babushka.rb first triggers a load via lib/babushka.rb, and then calls this method.
60 61 62 |
# File 'lib/babushka/base.rb', line 60 def run cmdline.run end |
.runtime_info ⇒ Object
77 78 79 |
# File 'lib/babushka/base.rb', line 77 def runtime_info @runtime_info ||= "babushka@#{ref} | #{ShellHelpers.which('ruby')}@#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" end |
.sources ⇒ Object
sources is an instance of Babushka::SourcePool, contains all the sources that babushka can currently load deps from. This means all the sources found in ~/.babushka/sources, plus the default sources:
- anonymous (no source file; i.e. deps defined in an +irb+ session,
or similar)
- core (the builtin deps that babushka uses to install itself)
- current dir (the contents of ./babushka-deps)
- personal (the contents of ~/.babushka/deps)
53 54 55 |
# File 'lib/babushka/base.rb', line 53 def sources @sources ||= SourcePool.new(cmdline.opts.slice(:update)) end |
.start_time ⇒ Object
27 28 29 |
# File 'lib/babushka/base.rb', line 27 def start_time @@start_time end |