class Teaspoon::Generators::InstallGenerator

Public Instance Methods

copy_environment() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 48
def copy_environment
  source = options[:documentation] ? "env_comments.rb.tt" : "env.rb.tt"
  template source, "#{framework.install_path}/teaspoon_env.rb"
end
copy_partials() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 62
def copy_partials
  return unless options[:partials]
  copy_file "_boot.html.erb", "#{framework.install_path}/javascripts/fixtures/_boot.html.erb"
  copy_file "_body.html.erb", "#{framework.install_path}/javascripts/fixtures/_body.html.erb"
end
create_structure() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 53
def create_structure
  empty_directory "#{framework.install_path}/javascripts/support"
  empty_directory "#{framework.install_path}/javascripts/fixtures"
end
display_post_install() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 68
def display_post_install
  readme "POST_INSTALL" if behavior == :invoke
end
install_framework_files() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 58
def install_framework_files
  instance_eval(&framework.install_callback)
end
verify_framework_and_version() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 41
def verify_framework_and_version
  version.present?
  framework
rescue
  abort_with_message if behavior == :invoke
end

Private Instance Methods

abort_with_message() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 107
def abort_with_message
  if Teaspoon::Framework.available.empty?
    readme "MISSING_FRAMEWORK"
  else
    message = "Unknown framework: #{options[:framework]}#{options[:version] ? "[#{options[:version]}]" : ''}"
    message << "\n  Available: #{described_frameworks.join("\n             ")}"
    say_status message, nil, :red
  end
  exit(1)
end
described_frameworks() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 74
def described_frameworks
  Teaspoon::Framework.available.map do |framework, options|
    klass = Teaspoon::Framework.fetch(framework)
    "#{framework}: versions[#{klass.versions.join(', ')}]"
  end
end
determine_requested_version() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 102
def determine_requested_version
  return options[:version] if framework.versions.include?(options[:version])
  raise Teaspoon::UnknownFrameworkVersion.new(name: framework.name, version: options[:version])
end
framework() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 81
def framework
  @framework ||= begin
    framework = Teaspoon::Framework.fetch(options[:framework])
    source_paths
    @source_paths = framework.template_paths + @source_paths
    framework
  end
end
suite() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 90
def suite
  @suite ||= begin
    config = Teaspoon::Configuration::Suite.new
    framework.modify_config(config)
    config
  end
end
version() click to toggle source
# File lib/generators/teaspoon/install/install_generator.rb, line 98
def version
  @version ||= options[:version] ? determine_requested_version : framework.versions.last
end