Sha256: 1c1c26542130599aa08030bf6742bca65f69e84c93fd33eb8a46a48f2f7cbd16

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 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"

        Bundler.with_clean_env do
          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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
happy_seed-0.0.21 lib/generators/happy_seed/plugin/plugin_generator.rb