Class: HappySeed::Generators::SimpleCmsGenerator

Inherits:
HappySeedGenerator
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/happy_seed/simple_cms/simple_cms_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fingerprintObject



10
11
12
# File 'lib/generators/happy_seed/simple_cms/simple_cms_generator.rb', line 10

def self.fingerprint
  File.exists? 'app/models/simple_content.rb'
end

Instance Method Details

#install_simple_cmsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/happy_seed/simple_cms/simple_cms_generator.rb', line 14

def install_simple_cms
  return if already_installed

  require_generator AdminGenerator
  require_generator SplashGenerator

  migration_template("create_simple_contents.rb", "db/migrate/create_simple_contents.rb" )

  begin
    inject_into_file "app/helpers/application_helper.rb", File.read( find_in_source_paths( "application_helper.rb" ) ), before: /\nend/
  rescue
    say_status :application_helper, "Unable to add helper to app/helpers/application_helper.rb", :red
  end

  route "get '/faq' => 'simple_content#faq'"

  remove_file 'app/views/splash/index.html.haml'
  directory "app"
  directory "docs"
end