Class: Teabag::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/teabag/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_initializersObject



29
30
31
32
# File 'lib/generators/teabag/install/install_generator.rb', line 29

def copy_initializers
  copy_file "templates/#{framework}/initializer.rb", "config/initializers/teabag.rb"
  copy_file "templates/env.rb", "#{framework_type}/teabag_env.rb" if options[:env]
end

#copy_spec_helperObject



39
40
41
# File 'lib/generators/teabag/install/install_generator.rb', line 39

def copy_spec_helper
  copy_file "templates/#{framework}/#{framework_type}_helper.#{helper_ext}", "#{framework_type}/javascripts/#{framework_type}_helper.#{helper_ext}"
end

#create_structureObject



34
35
36
37
# File 'lib/generators/teabag/install/install_generator.rb', line 34

def create_structure
  empty_directory "#{framework_type}/javascripts/support"
  empty_directory "#{framework_type}/javascripts/fixtures"
end

#display_readmeObject



43
44
45
# File 'lib/generators/teabag/install/install_generator.rb', line 43

def display_readme
  readme "POST_INSTALL" if behavior == :invoke
end

#validate_frameworkObject



23
24
25
26
27
# File 'lib/generators/teabag/install/install_generator.rb', line 23

def validate_framework
  return if frameworks.include?(options[:framework])
  puts "Unknown framework -- Known: #{frameworks.join(', ')}"
  exit
end