Class: Weeler::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/generators/weeler/install_generator.rb', line 10

def self.next_migration_number(path)
  unless @prev_migration_nr
    @prev_migration_nr =  ActiveRecord::Generators::Base.next_migration_number(path).to_i
  else
    @prev_migration_nr += 1
  end

  @prev_migration_nr.to_s
end

Instance Method Details

#add_weeler_routesObject



49
50
51
52
53
54
55
# File 'lib/generators/weeler/install_generator.rb', line 49

def add_weeler_routes
  weeler_routes  = "mount_weeler_at \"weeler\" do \n"
  weeler_routes << "    # weeler_resources :example, include_in_weeler_menu: true \n"
  weeler_routes << "    # Also you orderable and imageable concerns \n"
  weeler_routes << "  end"
  route weeler_routes
end

#install_controllersObject



44
45
46
# File 'lib/generators/weeler/install_generator.rb', line 44

def install_controllers
  copy_files 'controllers', 'app/controllers'
end

#install_initializerObject



22
23
24
# File 'lib/generators/weeler/install_generator.rb', line 22

def install_initializer
  copy_files 'initializers', 'config/initializers'
end

#install_javascripts_assetsObject



36
37
38
# File 'lib/generators/weeler/install_generator.rb', line 36

def install_javascripts_assets
  copy_files 'assets/javascripts', 'lib/assets/javascripts'
end

#install_migrationsObject



26
27
28
29
30
# File 'lib/generators/weeler/install_generator.rb', line 26

def install_migrations
  get_file_list('migrations').each do |migration|
    migration_template "migrations/#{migration}", "db/migrate/#{migration}"
  end
end

#install_stylesheets_assetsObject



40
41
42
# File 'lib/generators/weeler/install_generator.rb', line 40

def install_stylesheets_assets
  copy_files 'assets/stylesheets', 'lib/assets/stylesheets'
end

#install_viewsObject



32
33
34
# File 'lib/generators/weeler/install_generator.rb', line 32

def install_views
  copy_files 'views', 'app/views'
end