class KauiCmd::Installer

Public Instance Methods

add_gems() click to toggle source
# File lib/kaui/installer/installer.rb, line 56
def add_gems
  inside @app_path do
    gem :kaui, @kaui_gem_options
    run 'bundle install', capture: true unless options[:skip_bundle]
  end
end
initialize_kaui() click to toggle source
# File lib/kaui/installer/installer.rb, line 63
def initialize_kaui
  inside @app_path do
    run 'rails generate kaui:install', verbose: false
  end
end
prepare_options() click to toggle source
# File lib/kaui/installer/installer.rb, line 36
def prepare_options
  @kaui_gem_options = {}

  if options[:edge]
    @kaui_gem_options[:git] = 'git://github.com/killbill/killbill-admin-ui.git'
  elsif options[:path]
    @kaui_gem_options[:path] = options[:path]
  elsif options[:git]
    @kaui_gem_options[:git] = options[:git]
    @kaui_gem_options[:ref] = options[:ref] if options[:ref]
    @kaui_gem_options[:branch] = options[:branch] if options[:branch]
    @kaui_gem_options[:tag] = options[:tag] if options[:tag]
  elsif options[:version]
    @kaui_gem_options[:version] = options[:version]
  else
    version = Kaui::VERSION
    @kaui_gem_options[:version] = version.to_s
  end
end
verify_rails() click to toggle source
# File lib/kaui/installer/installer.rb, line 29
def verify_rails
  return if rails_project?

  say "#{@app_path} is not a rails project."
  exit 1
end

Private Instance Methods

gem(name, gem_options = {}) click to toggle source
# File lib/kaui/installer/installer.rb, line 75
def gem(name, gem_options = {})
  say_status :gemfile, name
  parts = ["'#{name}'"]
  parts << ["'#{gem_options.delete(:version)}'"] if gem_options[:version]
  gem_options.each { |key, value| parts << ":#{key} => '#{value}'" }
  append_file 'Gemfile', "gem #{parts.join(', ')}\n", verbose: false
end
rails_project?() click to toggle source
# File lib/kaui/installer/installer.rb, line 71
def rails_project?
  File.exist?(File.join(@app_path, 'script', 'rails')) || File.exist?(File.join(@app_path, 'bin', 'rails'))
end