Class: Utter::Generators::Ext

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

Instance Method Summary collapse

Instance Method Details

#create_ext(params = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/generators/ext_gem_generator.rb', line 11

def create_ext params={}
  @ext_name = params[:ext_name].downcase

  empty_directory "domain/#{@ext_name.downcase}/lib/internals"

  @file = "module \#{@ext_name.capitalize} \n  VERSION = \"0.0.0\"\n  class Main\n    def initialize(app, opts={}, params={})\n@app  = app\n@opts   = opts \n@params   = params \n    end\n\n    def call(env)\n#TODO manipulate value objects, before passing to the stack!\[email protected](env)\n#TODO manipulate value objects, after passing to the stack!\n    end\n  end\nend\n  FOO\n  create_file \"domain/\#{@ext_name.downcase}/lib/main.rb\"\n  append_to_file \"domain/\#{@ext_name.downcase}/lib/main.rb\", @file\n\n  empty_directory \"domain/\#{@ext_name.downcase}/spec\"\n  create_file \"domain/\#{@ext_name.downcase}/spec/spec_helper.rb\"\n  create_file \"domain/\#{@ext_name.downcase}/spec/main_spec.rb\"\n\n  create_file \"domain/\#{@ext_name.downcase}/README.md\"\nend\n"