Class: Faalis::Generators::InstallGenerator

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

Overview

Generator responsible for install generator

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_gems



95
96
97
98
99
100
101
# File 'lib/generators/faalis/install_generator.rb', line 95

def add_gems
  gem 'jquery-turbolinks'

  inside Rails.root do
    run 'bundle update'
  end
end

- (Object) angularjs_app_path (private)



121
122
123
124
# File 'lib/generators/faalis/install_generator.rb', line 121

def angularjs_app_path
  path = Faalis::Engine.dashboard_js_manifest.split('/')[0..-2].join('/')
  "app/assets/javascripts/#{path}/"
end

- (Object) append_assets_to_compile



103
104
105
106
107
# File 'lib/generators/faalis/install_generator.rb', line 103

def append_assets_to_compile
  append_to_file 'config/initializers/assets.rb' do
    "Rails.application.config.assets.precompile += %w( dashboard/rtl/application.css dashboard/ltr/application.css)"
  end
end

- (Object) assets_manifests_initializer



85
86
87
88
89
# File 'lib/generators/faalis/install_generator.rb', line 85

def assets_manifests_initializer
  initializer 'faalis_assets.rb' do
    'Rails.application.config.assets.precompile += %w( faalis/simple.js )'
  end
end

- (Object) configure_kaminari



61
62
63
# File 'lib/generators/faalis/install_generator.rb', line 61

def configure_kaminari
  generate 'kaminari:config'
end

- (Object) copy_init_files



37
38
39
40
41
42
43
# File 'lib/generators/faalis/install_generator.rb', line 37

def copy_init_files
  template 'devise.rb', 'config/initializers/devise.rb'
  template 'faalis.rb', 'config/initializers/faalis.rb'
  template 'api_controller.rb', 'app/controllers/api_controller.rb'
  template 'dashboard_controller.rb', 'app/controllers/dashboard/application_controller.rb'
  template 'policy/application_policy.rb', 'app/policies/application_policy.rb'
end

- (Object) copy_js_manifest



51
52
53
54
# File 'lib/generators/faalis/install_generator.rb', line 51

def copy_js_manifest
  empty_directory 'app/assets/javascripts/dashboard'
  directory 'javascripts', 'app/assets/javascripts/dashboard'
end

- (Object) copy_migrations



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

def copy_migrations
  rake('faalis:install:migrations') unless options[:mongoid]
end

- (Object) copy_scss_manifest

def grunt_file template 'i18n/Gruntfile.js.erb', 'lib/tasks/grunt/Gruntfile.js' end



69
70
71
# File 'lib/generators/faalis/install_generator.rb', line 69

def copy_scss_manifest
  directory 'stylesheets', 'app/assets/stylesheets'
end

- (Object) install_formtastic



57
58
59
# File 'lib/generators/faalis/install_generator.rb', line 57

def install_formtastic
  generate 'formtastic:install'
end

- (Object) install_model_discovery



33
34
35
# File 'lib/generators/faalis/install_generator.rb', line 33

def install_model_discovery
  rake 'model_discovery_engine:install:migrations'
end

- (Object) install_routes



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/generators/faalis/install_generator.rb', line 73

def install_routes
   route "end\n"
   route '  # Your dashboard routes goes here.'
   route "in_dashboard do"

   route "end\n"
   route '  # Your API routes goes here.'
   route 'api_routes do'

   route "mount Faalis::Engine => '/'\n"
end

- (Object) patch_application_controller



91
92
93
# File 'lib/generators/faalis/install_generator.rb', line 91

def patch_application_controller
  inject_into_class "app/controllers/application_controller.rb", ApplicationController, "  extend Faalis::I18n::Locale\n"
end

- (Object) patch_formtastic



109
110
111
112
113
# File 'lib/generators/faalis/install_generator.rb', line 109

def patch_formtastic
  append_to_file 'config/initializers/formtastic.rb' do
    'Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder'
  end
end

- (Object) patch_seed



45
46
47
48
49
# File 'lib/generators/faalis/install_generator.rb', line 45

def patch_seed
  prepend_to_file 'db/seeds.rb' do
    "Faalis::Engine.load_seed\n"
  end
end

- (Object) show_readme



115
116
117
# File 'lib/generators/faalis/install_generator.rb', line 115

def show_readme
  readme 'README' if behavior == :invoke
end