Sha256: 83f8d808953fcaf5bfda70c6b29b58503ab129557bcf1039a45f4e225904d2bb

Contents?: true

Size: 1.32 KB

Versions: 46

Compression:

Stored size: 1.32 KB

Contents

require 'rails/generators/named_base'
module Thecore
  class ThecorizeAppGenerator < Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)

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

    # TODO: Must add
    # *= require thecore to application.css before */
    # //= require thecore to application.js before //= require_tree .
    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

    # TODO: remove from application controller the protect_from_forgery with: :exception part
    def adapt_application_controller_to_devise
      gsub_file 'app/controllers/application_controller.rb', 'protect_from_forgery with: :exception', ''
    end

    # 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."
    def update_or_init_git_remote
      say "Manage Git", :green
      rails_command "g thecore:add_git #{@name}"
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
thecore-1.7.7 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.7.5 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.7.3 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.7.2 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.7.1 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.7.0 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.13 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.10 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.9 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.8 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.7 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.5 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.4 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.3 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.2 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.1 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.6.0 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.5.14 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.5.13 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb
thecore-1.5.12 lib/generators/thecore/thecorize_app/thecorize_app_generator.rb