class OpenSource::License::Generator
Public Class Methods
new(options)
click to toggle source
# File lib/open_source/license/generator.rb, line 6 def initialize(options) @options = options @owner = Owner.new @license = ERB.new(File.read("#{File.expand_path("../templates", __FILE__)}/#{@options[:license]}.erb")) end
Public Instance Methods
generate()
click to toggle source
# File lib/open_source/license/generator.rb, line 12 def generate create_license_file append_to_file if @options[:append] end
Private Instance Methods
append_to_file()
click to toggle source
# File lib/open_source/license/generator.rb, line 24 def append_to_file File.open(File.expand_path(@options[:append]), 'a') do |f| f << "\n## License\n\n#{@license.result(binding)}" end end
create_license_file()
click to toggle source
# File lib/open_source/license/generator.rb, line 18 def create_license_file f = File.new("#{Dir.pwd}/LICENSE", 'w') f.write(@license.result(binding)) f.close end