Sha256: 7a5a4d79e95cc5df7972a26a2c066a2bb8938dbc633759b50b2554aaa652572a

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

require 'thor'

module HappySeed
  module Generators
    class PluginGenerator < Thor::Group
      include Thor::Actions
      source_root File.expand_path('../templates', __FILE__)
      def generate_rails_plugin
        source_root = File.expand_path('../templates', __FILE__)
        args.shift
        puts args
        app_name = args.shift
        system "rails plugin new #{app_name} -T --dummy-path=spec/dummy #{args.join( " ")}"

        insert_into_file "#{app_name}/#{app_name}.gemspec", File.read( "#{source_root}/gemspec" ), :before => "\nend\n"

        system( "cd #{app_name} && bundle" )

        system( "cd #{app_name}/spec/dummy && rails g rspec:install")

        gsub_file "#{app_name}/spec/dummy/.rspec", "--warnings\n", ""
        append_to_file "#{app_name}/spec/dummy/.rspec", "--format documentation\n"

        self.destination_root = app_name
        
    		remove_file "Rakefile"
        copy_file "Rakefile"
        copy_file ".rspec"
        copy_file ".autotest"
        directory "spec"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
happy_seed-0.0.19 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.18 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.17 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.16 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.15 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.14 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.13 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.12 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.11 lib/generators/happy_seed/plugin/plugin_generator.rb
happy_seed-0.0.10 lib/generators/happy_seed/plugin/plugin_generator.rb