Sha256: 15c5847899b745643043a7564b87a82dccdc2ef0dc96d9e7f4a6c0f110f63f54

Contents?: true

Size: 712 Bytes

Versions: 3

Compression:

Stored size: 712 Bytes

Contents

base = defined?(Rails) ? Rails::Generators::Base : Thor::Group

class TestRails3 < base
  include Thor::Actions
  
  def self.source_root
    File.expand_path('../templates', __FILE__)
  end

  argument :argument1, :type => :string, :default => "default_file" 
  argument :template_name, :type => :string, :default => "file_template"
  
  def gen_file_with_arg
    create_file argument1, "content!"
  end
  
  def gen_directory
    empty_directory "a_directory"
  end
  
  def gen_template
    template 'file', template_name
  end
  
  def gen_gem_source
    if defined?(Rails)
      add_source "http://gems.github.com/"
    else
      append_file "Gemfile", 'source "http://gems.github.com/"'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
genspec-0.2.5 spec/support/generators/test_rails3/test_rails3_generator.rb
genspec-0.2.4 spec/support/generators/test_rails3/test_rails3_generator.rb
genspec-0.2.3 spec/support/generators/test_rails3/test_rails3_generator.rb