Sha256: ce2f6f003aebd2b991925744a558936220c1809e956529b7366c1023ff962e4d

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

class Slf4r::Log4jGenerator < Rails::Generators::Base
  #source_root File.expand_path('../templates', __FILE__)

  def setup
    source = File.expand_path('../../templates', __FILE__)
    initializer "log4j.rb", File.read(File.join(source, "log4j.rb"))
    initializer "log4j.properties", File.read(File.join(source, "log4j.properties"))

    gemfile = File.read('Gemfile')
    jar_line = "org.slf4j.slf4j-log4j12"
    unless gemfile =~ /#{jar_line}/
      File.open('Gemfile', 'a') do |f|
        f.puts
        f.puts "if defined? MAVEN"
        f.puts "  jar '#{jar_line}', '1.6.1'"
        f.puts "end"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slf4r-0.4.1 lib/generators/slf4r/log4j/log4j_generator.rb
slf4r-0.4.0 lib/generators/slf4r/log4j/log4j_generator.rb