Class: Shag::Generator
- Inherits:
-
Object
- Object
- Shag::Generator
- Defined in:
- lib/shag/generator.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Generator
constructor
A new instance of Generator.
- #run ⇒ Object
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_name ⇒ Object (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
#run ⇒ Object
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 |