Class: Bankai::Builder

Inherits:
Rails::AppBuilder
  • Object
show all
Defined in:
lib/bankai/builder.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#clear_seed_fileObject

rubocop:enable Metrics/MethodLength



67
68
69
# File 'lib/bankai/builder.rb', line 67

def clear_seed_file
  File.write(destination_root + '/db/seeds.rb', '')
end

#configure_generatorsObject

rubocop:disable Metrics/MethodLength



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bankai/builder.rb', line 37

def configure_generators
  config = <<-RUBY
config.generators do |generate|
  generate.helper false
  generate.javascripts false
  generate.request_specs false
  generate.routing_specs false
  generate.stylesheets false
  generate.test_framework :rspec
  generate.view_specs false
end
  RUBY

  inject_into_class 'config/application.rb', 'Application', config
end

#configure_quiet_assetsObject



28
29
30
31
32
33
34
# File 'lib/bankai/builder.rb', line 28

def configure_quiet_assets
  config = <<-RUBY
config.assets.quiet = true
  RUBY

  inject_into_class 'config/application.rb', 'Application', config
end

#copy_dotfilesObject



78
79
80
# File 'lib/bankai/builder.rb', line 78

def copy_dotfiles
  directory('dotfiles', '.')
end

#gemfileObject



14
15
16
# File 'lib/bankai/builder.rb', line 14

def gemfile
  template 'Gemfile.erb', 'Gemfile'
end

#gitignoreObject



10
11
12
# File 'lib/bankai/builder.rb', line 10

def gitignore
  template 'gitignore.erb', '.gitignore'
end

#readmeObject



6
7
8
# File 'lib/bankai/builder.rb', line 6

def readme
  template 'README.md.erb', 'README.md'
end

#replace_gemfile(path) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/bankai/builder.rb', line 18

def replace_gemfile(path)
  template 'Gemfile.erb', 'Gemfile', force: true do |content|
    if path
      content.gsub(/gem .bankai./) { |s| %(#{s}, path: "#{path}") }
    else
      content
    end
  end
end

#setup_default_directoriesObject



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/bankai/builder.rb', line 53

def setup_default_directories
  [
    'spec/lib',
    'spec/controllers',
    'spec/helpers',
    'spec/support/matchers',
    'spec/support/mixins',
    'spec/support/shared_examples'
  ].each do |dir|
    empty_directory_with_keep_file dir
  end
end

#setup_rack_mini_profilerObject



71
72
73
74
75
76
# File 'lib/bankai/builder.rb', line 71

def setup_rack_mini_profiler
  copy_file(
    'rack_mini_profiler.rb',
    'config/initializers/rack_mini_profiler.rb'
  )
end