class IRuby::Dependencies
Constants
- VERSION
Public Class Methods
new(config, verbose: false, &block)
click to toggle source
# File lib/iruby/dependencies.rb, line 7 def initialize config, verbose: false, &block @config = config @verbose = verbose instance_eval &block gemfile do # tell bundler to use our gem sources Gem.sources.each {|source| source source.to_s} instance_eval &block end end
Public Instance Methods
exec(string)
click to toggle source
# File lib/iruby/dependencies.rb, line 26 def exec string stdout, stderr, exit_status = Open3.capture3(string) if exit_status.success? if @verbose Bundler.ui.info stdout unless stdout.empty? Bundler.ui.warn stderr unless stderr.empty? end else puts stdout unless stdout.empty? warn stderr unless stderr.empty? raise "\"exec '#{string}'\" failed on dependency installation" end end
gem(name, *args)
click to toggle source
# File lib/iruby/dependencies.rb, line 20 def gem name, *args if commands = @config[name] commands.each {|command| send *command} end end
source(*args, &block)
click to toggle source
gemfiles allow specifying alternate sources for gems make sure we check the block for gems in those sources
# File lib/iruby/dependencies.rb, line 43 def source *args, &block instance_eval &block if block_given? end
to_html()
click to toggle source
# File lib/iruby/dependencies.rb, line 47 def to_html <<-HTML <div style='background: rgba(0,255,0,0.3); font-family: monospace; padding: 5px;'> <b>Dependencies successfully installed!</b> </div> HTML end