Sha256: ae437693762131a20c66965b743a3ddef70d883808b2bc944f1790e78460237b

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

# Generates the test structure for a plugin
class PluginTestStructureGenerator < Rails::Generator::NamedBase
  def manifest
    record do |m|
      # Paths are relative to our template dir
      plugin_test_root = "vendor/plugins/#{name}/test"
      templates_root = "#{File.dirname(__FILE__)}/templates"
      
      # Copy all directories and files.  None of them are templated so that they
      # can be reused during runtime
      Dir["#{templates_root}/**/*"].each do |source_file|
      	relative_source_file = source_file.sub(templates_root, '')
        target_file = File.join(plugin_test_root, relative_source_file)
        
        if File.directory?(source_file)
          m.directory target_file
      	else
      	  m.file relative_source_file, target_file
        end
      end
    end
  end

  protected
    def banner
      "Usage: #{$0} plugin_test_structure your_plugin"
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plugin_test_helper-0.0.1 generators/plugin_test_structure/plugin_test_structure_generator.rb
plugin_test_helper-0.0.2 generators/plugin_test_structure/plugin_test_structure_generator.rb