Class: Kitestrings::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_app_view_filesObject



33
34
35
36
37
# File 'lib/generators/kitestrings/install_generator.rb', line 33

def copy_app_view_files
  copy_file "views/application/_navigation.html.haml", "app/views/application/_navigation.html.haml"
  copy_file "views/layouts/application.html.haml", "app/views/layouts/application.html.haml"
  copy_file "views/public/403.html", "app/views/public/403.html"
end

#copy_config_filesObject



11
12
13
14
15
# File 'lib/generators/kitestrings/install_generator.rb', line 11

def copy_config_files
  copy_file "config/deploy.rb", "config/deploy.rb"
  directory "config/deploy", "config/deploy"
  directory "config/environments", "config/environments"
end

#copy_haml_filesObject



17
18
19
# File 'lib/generators/kitestrings/install_generator.rb', line 17

def copy_haml_files
  directory "haml", "lib/templates/haml"
end

#copy_rspec_filesObject



25
26
27
# File 'lib/generators/kitestrings/install_generator.rb', line 25

def copy_rspec_files
  directory "rspec", "lib/templates/rspec"
end

#copy_scaffold_filesObject



21
22
23
# File 'lib/generators/kitestrings/install_generator.rb', line 21

def copy_scaffold_files
  directory "rails", "lib/templates/rails"
end

#copy_spec_extObject



29
30
31
# File 'lib/generators/kitestrings/install_generator.rb', line 29

def copy_spec_ext
  directory "spec_ext", "spec_ext"
end

#setup_application_controllerObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/generators/kitestrings/install_generator.rb', line 39

def setup_application_controller
  inject_into_file "app/controllers/application_controller.rb", :after => /protect_from_forgery.*$/ do
    "\n\n  unless Rails.application.config.consider_all_requests_local\n    rescue_from CanCan::AccessDenied do |exception|\n# Notify errbit if you would like to:\n# Airbrake.notify(exception)\nrender 'public/403', status: 403, layout: 'none'\n    end\n  end\n    EOF\n  end\nend\n"

#setup_directoriesObject



55
56
57
58
# File 'lib/generators/kitestrings/install_generator.rb', line 55

def setup_directories
  empty_directory("lib/capistrano")
  create_file("lib/capistrano/.keep")
end