Class: Thecore::ThecorizeAppGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/thecore/thecorize_app/thecorize_app_generator.rb

Instance Method Summary collapse

Instance Method Details

#adapt_application_controller_to_deviseObject

TODO: remove from application controller the protect_from_forgery with: :exception part



26
27
28
# File 'lib/generators/thecore/thecorize_app/thecorize_app_generator.rb', line 26

def adapt_application_controller_to_devise
  gsub_file 'app/controllers/application_controller.rb', 'protect_from_forgery with: :exception', ''
end

#manage_assetsObject

TODO: Must add *= require thecore to application.css before */ //= require thecore to application.js before //= require_tree .



14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/thecore/thecorize_app/thecorize_app_generator.rb', line 14

def manage_assets
  inject_into_file 'app/assets/javascripts/application.js', before: "//= require_tree ." do <<-'RUBY'
    puts "//= require thecore"
    RUBY
  end
  inject_into_file 'app/assets/stylesheets/application.css', before: "*/ ." do <<-'RUBY'
    puts "*= require thecore"
    RUBY
  end
end

#remove_indexObject



6
7
8
9
# File 'lib/generators/thecore/thecorize_app/thecorize_app_generator.rb', line 6

def remove_index
  #remove the index.html
  remove_file 'public/index.html'
end

#update_or_init_git_remoteObject

TODO: add a .gitignore good for Rails and manage git “Traversing the DIR structures it adds git remote URL”, “By checking wether or not the .git folder exists, it inits or changes the url.”



32
33
34
35
# File 'lib/generators/thecore/thecorize_app/thecorize_app_generator.rb', line 32

def update_or_init_git_remote
  say "Manage Git", :green
  rails_command "g thecore:add_git #{@name}"
end