Sha256: f5115ebbed41ce7d6b381568a95b7465977f984ed288331cad6b9d3970394b1a

Contents?: true

Size: 914 Bytes

Versions: 5

Compression:

Stored size: 914 Bytes

Contents

# Generates the test structure for a plugin
class PluginTestStructureGenerator < Rails::Generator::NamedBase
  def manifest #:nodoc:
    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

5 entries across 5 versions & 1 rubygems

Version Path
plugin_test_helper-0.1.5 generators/plugin_test_structure/plugin_test_structure_generator.rb
plugin_test_helper-0.1.1 generators/plugin_test_structure/plugin_test_structure_generator.rb
plugin_test_helper-0.1.2 generators/plugin_test_structure/plugin_test_structure_generator.rb
plugin_test_helper-0.1.3 generators/plugin_test_structure/plugin_test_structure_generator.rb
plugin_test_helper-0.1.4 generators/plugin_test_structure/plugin_test_structure_generator.rb