Sha256: be74a230c22cc3d90aa7dd48c348114e9593a69582156b49d461cc0f7807e16e

Contents?: true

Size: 1.01 KB

Versions: 16

Compression:

Stored size: 1.01 KB

Contents

class Generate < Thor
  include Thor::Actions

  desc 'model NAME COMPONENT', 'Creates a model named NAME in the component named COMPONENT'
  method_option :name, type: :string, banner: 'The name of the model.'
  method_option :component, type: :string, default: 'main', banner: 'The component the model should be created in.', required: false
  def model(name, component = 'main')
    output_file = Dir.pwd + "/app/#{component.underscore}/models/#{name.underscore.singularize}.rb"
    template('model/model.rb.tt', output_file, model_name: name.camelize.singularize)
  end

  desc 'component NAME', 'Creates a component named NAME in the app folder.'
  method_option :name, type: :string, banner: 'The name of the component.'
  def component(name)
    name = name.underscore
    component_folder = Dir.pwd + "/app/#{name}"
    @component_name = name
    directory('component', component_folder, component_name: name)
  end

  def self.source_root
    File.expand_path(File.join(File.dirname(__FILE__), '../../../templates'))
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
volt-0.8.27.beta3 lib/volt/cli/generate.rb
volt-0.8.27.beta2 lib/volt/cli/generate.rb
volt-0.8.27.beta1 lib/volt/cli/generate.rb
volt-0.8.26.beta1 lib/volt/cli/generate.rb
volt-0.8.26 lib/volt/cli/generate.rb
volt-0.8.24 lib/volt/cli/generate.rb
volt-0.8.23 lib/volt/cli/generate.rb
volt-0.8.22 lib/volt/cli/generate.rb
volt-0.8.22.beta2 lib/volt/cli/generate.rb
volt-0.8.22.beta1 lib/volt/cli/generate.rb
volt-0.8.21 lib/volt/cli/generate.rb
volt-0.8.20 lib/volt/cli/generate.rb
volt-0.8.19 lib/volt/cli/generate.rb
volt-0.8.18 lib/volt/cli/generate.rb
volt-0.8.17 lib/volt/cli/generate.rb
volt-0.8.16 lib/volt/cli/generate.rb