class T3::Generators::BootstrapGenerator

Public Instance Methods

create_directories() click to toggle source
# File lib/generators/t3/bootstrap_generator.rb, line 11
def create_directories
  components.each do |c|
    empty_directory "#{install_path}/#{c}"
    create_file "#{install_path}/#{c}/.gitkeep" unless options[:skip_git]
  end
end
inject_t3() click to toggle source
# File lib/generators/t3/bootstrap_generator.rb, line 18
def inject_t3
  requires = "//= require t3\n"

  requires += components.map { |dir|
    "//= require_tree ./#{dir}"
  }.join("\n") + "\n"

  inject_into_file "#{install_path}/application.js", requires,
    before: '//= require_tree .'

  # If //= require_tree . does not exist, inject at the bottom
  # (Thor ensures that the content is not injected more than once)
  inject_into_file "#{install_path}/application.js", requires,
    before: %r{\z}
end

Private Instance Methods

components() click to toggle source
# File lib/generators/t3/bootstrap_generator.rb, line 36
def components
  %W{behaviors modules services}
end