Sha256: 375ca8f9c6b11c9d4408e5a396ffc89096637766df9cd5c1f75f8fc758728c01

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

base = GenSpec.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 File.file?("Gemfile")
      if GenSpec.rails?
        add_source "http://gems.github.com/"
      else
        append_file "Gemfile", 'source "http://gems.github.com/"'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
genspec-0.3.2 spec/support/generators/test_rails3/test_rails3_generator.rb
genspec-0.3.1 spec/support/generators/test_rails3/test_rails3_generator.rb