Class: MakeItSo::GosuAppGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



64
65
66
67
68
69
70
71
72
73
# File 'lib/generators/gosu_app_generator.rb', line 64

def self.source_root
  template_path = File.join(
    File.dirname(__FILE__),
    "..",
    "..",
    "templates",
    "gosu")

  File.expand_path(template_path)
end

Instance Method Details

#app_fileObject



25
26
27
28
# File 'lib/generators/gosu_app_generator.rb', line 25

def app_file
  file_path = 'app.rb'
  template(file_path, File.join(app_path, file_path))
end

#directoriesObject



15
16
17
18
19
20
21
22
23
# File 'lib/generators/gosu_app_generator.rb', line 15

def directories
  [
    'lib',
    'spec',
    'img'
  ].each do |dir|
    empty_directory File.join(app_path, dir)
  end
end

#gemfileObject



44
45
46
47
# File 'lib/generators/gosu_app_generator.rb', line 44

def gemfile
  file_path = 'Gemfile'
  template(file_path, File.join(app_path, file_path))
end

#gitignoreObject



49
50
51
52
# File 'lib/generators/gosu_app_generator.rb', line 49

def gitignore
  file_path = '.gitignore'
  template(file_path, File.join(app_path, file_path))
end

#libObject



35
36
37
38
39
40
41
42
# File 'lib/generators/gosu_app_generator.rb', line 35

def lib
  [
    'lib/keys.rb',
    'lib/bounding_box.rb'
  ].each do |file_path|
    template(file_path, File.join(app_path, file_path))
  end
end

#readmeObject



30
31
32
33
# File 'lib/generators/gosu_app_generator.rb', line 30

def readme
  file_path = 'README.md'
  template(file_path, File.join(app_path, file_path))
end

#rspecObject



54
55
56
57
58
59
60
61
62
# File 'lib/generators/gosu_app_generator.rb', line 54

def rspec
  if options.rspec?
    spec_helper = 'spec/spec_helper.rb'
    template(spec_helper, File.join(app_path, spec_helper))

    dot_rspec = '.rspec'
    template(dot_rspec, File.join(app_path, dot_rspec))
  end
end