Sha256: 7c13daae6ce8d136781bf6b93615d8e9aeeab961cacbc80fc0374195ad7829b8

Contents?: true

Size: 1.07 KB

Versions: 19

Compression:

Stored size: 1.07 KB

Contents

require 'thor'
require 'thor/group'

module Utter
  module Generators

    class Ext < Thor::Group
      include Thor::Actions

      desc 'Generate an utter domain extension'
      def create_ext params={}
	@ext_name = params[:ext_name].downcase

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

	@file = <<-FOO
module #{@ext_name.capitalize} 
  VERSION = "0.0.0"
  class Main
    def initialize(app, opts={}, params={})
      @app 	= app
      @opts 	= opts 
      @params 	= params 
    end

    def call(env)
      #TODO manipulate value objects, before passing to the stack!
      @app.call(env)
      #TODO manipulate value objects, after passing to the stack!
    end
  end
end
	FOO
	create_file "domain/#{@ext_name.downcase}/lib/main.rb"
	append_to_file "domain/#{@ext_name.downcase}/lib/main.rb", @file

	empty_directory "domain/#{@ext_name.downcase}/spec"
	create_file "domain/#{@ext_name.downcase}/spec/spec_helper.rb"
	create_file "domain/#{@ext_name.downcase}/spec/main_spec.rb"

	create_file "domain/#{@ext_name.downcase}/README.md"
      end

    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
utter-1.9.0 lib/generators/ext_gem_generator.rb
utter-1.8.0 lib/generators/ext_gem_generator.rb
utter-1.7.0 lib/generators/ext_gem_generator.rb
utter-1.6.0 lib/generators/ext_gem_generator.rb
utter-1.5.0 lib/generators/ext_gem_generator.rb
utter-1.4.0 lib/generators/ext_gem_generator.rb
utter-1.3.2 lib/generators/ext_gem_generator.rb
utter-1.3.1 lib/generators/ext_gem_generator.rb
utter-1.3.0 lib/generators/ext_gem_generator.rb
utter-1.2.0 lib/generators/ext_gem_generator.rb
utter-1.1.0 lib/generators/ext_gem_generator.rb
utter-1.0.23 lib/generators/ext_gem_generator.rb
utter-1.0.21 bin/generators/extension.rb
utter-1.0.20 bin/generators/extension.rb
utter-1.0.19 bin/generators/extension.rb
utter-1.0.18 bin/generators/extension.rb
utter-1.0.17 bin/generators/extension.rb
utter-1.0.16 lib/generators/extension.rb
utter-1.0.15 lib/generators/extension.rb