Class: Shag::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/shag/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Generator

Returns a new instance of Generator.



5
6
7
8
# File 'lib/shag/generator.rb', line 5

def initialize(name)
  @app_name = name
  @app_dir  = File.join(Dir.pwd, name)
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



3
4
5
# File 'lib/shag/generator.rb', line 3

def app_name
  @app_name
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/shag/generator.rb', line 10

def run
  puts "Creating directory"
  Dir.mkdir(@app_dir)
  Dir.chdir(@app_dir)
  generate_gemfile
  generate_procfile
  generate_sinatra_file
  bundle
  git_init
  puts "Project #{@app_name} has been created"
end