Class: Spiker::Generators::Simple

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/spiker/generators/simple.rb

Overview

Generates a single spike file, with supporting infrastructure. For simpler spikes that don’t need a ton of organization.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



15
16
17
# File 'lib/spiker/generators/simple.rb', line 15

def self.source_root
  "#{File.dirname(__FILE__)}/templates/simple"
end

Instance Method Details

#create_env_fileObject



36
37
38
# File 'lib/spiker/generators/simple.rb', line 36

def create_env_file
  template("../common/basic.env", "#{name}/.env")
end

#create_gem_fileObject



32
33
34
# File 'lib/spiker/generators/simple.rb', line 32

def create_gem_file
  template("gemfile.rb", "#{name}/Gemfile")
end

#create_guard_fileObject



28
29
30
# File 'lib/spiker/generators/simple.rb', line 28

def create_guard_file
  template("guardfile.rb", "#{name}/Guardfile")
end

#create_spike_directoryObject



19
20
21
# File 'lib/spiker/generators/simple.rb', line 19

def create_spike_directory
  empty_directory(name)
end

#create_spike_fileObject



23
24
25
26
# File 'lib/spiker/generators/simple.rb', line 23

def create_spike_file
  opts = { name_as_class: Spiker.classify(name) }
  template("app.rb.erb", "#{name}/app.rb", opts)
end

#run_bundlerObject



40
41
42
43
44
# File 'lib/spiker/generators/simple.rb', line 40

def run_bundler
  inside(name) do
    run("bundle install")
  end
end