Sha256: 5b738e625a1a73ad2257f262db0fe99c91748117ecaf7c276d2420f863d329f5
Contents?: true
Size: 1.66 KB
Versions: 16
Compression:
Stored size: 1.66 KB
Contents
require 'thor' require 'thor/group' module Utter module Generators class Container < Thor::Group include Thor::Actions desc 'Generate an utter project skleton' def create_container params={} path = params[:path] module_name = params[:module_name] api_version = params[:api_version] service_name = params[:service_name] # config.ru @file = <<-FOO Dir[File.dirname(__FILE__) + '/microservice/**/*.rb'].each {|file| require_relative file } Dir[File.dirname(__FILE__) + '/domain/**/*.rb'].each {|file| require_relative file } map "/" do run #{module_name.capitalize}::#{api_version.capitalize}::#{service_name.capitalize} end FOO create_file "#{path}/config.ru" append_to_file "#{path}/config.ru", @file # end of config.ru ############################ # Gemfile @file = <<-FOO source 'https://rubygems.org' gem 'utter' FOO create_file "#{path}/Gemfile" append_to_file "#{path}/Gemfile", @file # end of Gemfile ############################ # Dockerfile @file = <<-FOO Docker stuff here FOO create_file "#{path}/Dockerfile" append_to_file "#{path}/Dockerfile", @file # end of Dockerfile ############################ # README.md for the utter container @file = <<-FOO Abou this utter project. 1.Microservice 2.Domain FOO create_file "#{path}/README.md" append_to_file "#{path}/README.md", @file # end of README.md ############################ # Log for the utter container @file = <<-FOO Abou this log directory FOO empty_directory "#{path}/log" create_file "#{path}/log/README.md" append_to_file "#{path}/log/README.md", @file # end of log ############################ #TODO container_name.gemspec end end end end
Version data entries
16 entries across 16 versions & 1 rubygems