Class: Slf4r::Log4jGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Slf4r::Log4jGenerator
- Defined in:
- lib/generators/slf4r/log4j/log4j_generator.rb
Instance Method Summary collapse
-
#setup ⇒ Object
source_root File.expand_path(‘../templates’, __FILE__).
Instance Method Details
#setup ⇒ Object
source_root File.expand_path(‘../templates’, __FILE__)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/slf4r/log4j/log4j_generator.rb', line 4 def setup source = File.('../../templates', __FILE__) initializer "log4j.rb", File.read(File.join(source, "log4j.rb")) initializer "log4j.properties", File.read(File.join(source, "log4j.properties")) gem 'slf4r', :require => 'slf4r/java_logger' file_name = 'Mavenfile' jar_line = "org.slf4j.slf4j-log4j12" mavenfile = File.exists?(file_name) ? File.read(file_name) : '' unless mavenfile =~ /#{jar_line}/ File.open(file_name, 'a') do |f| f.puts "jar '#{jar_line}', '1.6.1'" end end end |