Class: Disco::AppBuilder

Inherits:
Rails::AppBuilder
  • Object
show all
Defined in:
lib/generators/disco/app/app_generator.rb

Instance Method Summary collapse

Instance Method Details

#appObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/disco/app/app_generator.rb', line 15

def app
  super
  copy_file 'app/controllers/event_source_controller.rb'
  copy_file 'app/controllers/concerns/event_source.rb'
  copy_file 'app/helpers/event_source_helper.rb'
  copy_file 'app/assets/javascripts/event_source.js'
  copy_file 'app/assets/stylesheets/event_source.css'
  keep_file 'app/commands'
  keep_file 'app/events'
  keep_file 'app/projections'
  keep_file 'app/validations'

  keep_file 'domain/command_processors/domain'
  keep_file 'domain/models/domain'
  keep_file 'domain/projections/domain'
  keep_file 'domain/validations/domain'
end

#binObject



33
34
35
36
37
# File 'lib/generators/disco/app/app_generator.rb', line 33

def bin
  super
  copy_file 'bin/disco'
  chmod 'bin/disco', 0755, verbose: false
end

#configObject



39
40
41
42
43
44
45
46
# File 'lib/generators/disco/app/app_generator.rb', line 39

def config
  super
  inside 'config/initializers' do
    template 'create_domain.rb'
    copy_file 'build_validations_registry.rb'
    copy_file 'event_source_server.rb'
  end
end

#database_ymlObject



48
49
50
51
# File 'lib/generators/disco/app/app_generator.rb', line 48

def database_yml
  super
  template 'config/disco.yml'
end

#dbObject



53
54
55
56
# File 'lib/generators/disco/app/app_generator.rb', line 53

def db
  super
  append_file 'db/seeds.rb', File.binread(File.expand_path('../templates/db/seeds.rb', __FILE__)) unless behavior == :revoke
end

#gemfileObject



7
8
9
10
11
12
13
# File 'lib/generators/disco/app/app_generator.rb', line 7

def gemfile
  super
  append_file 'Gemfile', "\n# Rails Disco support
gem 'rails-disco', '~> #{RailsDisco::VERSION::STRING}'\n
# Required Multithreaded Webserver
gem 'puma'\n" unless behavior == :revoke
end