Sha256: 10b8f35b923ccf2d289b9292e31d7048b47b248fb40776443755c7eb3e0d57cf

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

require 'thor'
require 'moblues/reader/model'
require 'moblues/generator/model'

module Moblues
  class CLI < Thor
    desc 'generate', 'generate the machine and human files'
    option :model, :required => true, :desc => 'Core Data model path'
    option :human, :required => true, :desc => 'Path where the human files will be stored'
    option :machine, :required => true, :desc => 'Path where the machine files will be stored'
    def generate
      mkdir([options[:human], options[:machine]])
      reader = Moblues::Reader::Model.new
      generator = Moblues::Generator::Model.new(human_dir: options[:human], machine_dir: options[:machine])
      entities = reader.model(options[:model])
      generator.generate(entities)
    end

    private
    def mkdir(dirs)
      dirs.each do |dir|
        Dir.mkdir(dir) unless Dir.exists?(dir)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moblues-0.0.1 lib/moblues/cli.rb