Class: HappySeed::Generators::PluginGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/generators/happy_seed/plugin/plugin_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_rails_pluginObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/happy_seed/plugin/plugin_generator.rb', line 8

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