Sha256: 9c8b7740cd6811522ffed11943e5294f12c6d56d470371448bfec17027c1a95d

Contents?: true

Size: 1.84 KB

Versions: 1

Compression:

Stored size: 1.84 KB

Contents

class TweetWordWriterManifest
  def self.populate_record(m, rule_name)

    %W(
       app/controllers/rules
       app/rules
       app/views/re_rules/#{rule_name}
       db/migrate
       spec/lib/rules
    ).each do |dirname|
      m.empty_directory dirname
    end

    %W(
    ).each do |filename|
      m.copy_file filename, filename
    end

    m.template "app/controllers/rules/tweet_word_writer_controller.rb",  "app/controllers/rules/#{rule_name}_controller.rb"
    m.template "app/rules/tweet_word_writer.rb",  "app/rules/#{rule_name}.rb"
    m.template "app/views/re_rules/tweet_word_writer/_edit.html.erb",  "app/views/re_rules/#{rule_name}/_edit.html.erb"
    m.template "app/views/re_rules/tweet_word_writer/_form.html.erb",  "app/views/re_rules/#{rule_name}/_form.html.erb"
    m.template "app/views/re_rules/tweet_word_writer/_help.html.erb",  "app/views/re_rules/#{rule_name}/_help.html.erb"
    m.template "app/views/re_rules/tweet_word_writer/_new.html.erb",  "app/views/re_rules/#{rule_name}/_new.html.erb"
    m.template "app/views/re_rules/tweet_word_writer/index.html.erb",  "app/views/re_rules/#{rule_name}/index.html.erb"
    m.template "db/migrate/20100727235508_create_tweet_word_writer.rb",  "db/migrate/#{Time.now.strftime('%Y%m%d%H%M%S')}_create_#{rule_name}.rb"
    m.template "spec/lib/rules/tweet_word_writer_spec.rb",  "spec/lib/rules/#{rule_name}_spec.rb"

    puts "EDIT routes.rb"
    puts ""
    puts "map.with_options :controller => 'Rules::TweetWordWriter', :path_prefix => '/rules/tweet_word_writer', :name_prefix => 'tweet_word_writer_' do |tweet_word_writer|"
    puts "  tweet_word_writer.index   '/', :action => :index, :conditions => { :method => :get }"
    puts "  tweet_word_writer.ignore  '/', :action => :ignore, :conditions => { :method => :put }"
    puts "end"
    puts ""
    puts "rake db:migrate"
    puts "rake spec"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rules_engine_templates-0.3.0 generators/manifests/tweet_word_writer.rb