class FluentPluginGenerator::ApacheLicense

Constants

LICENSE_URL

Attributes

text[R]

Public Class Methods

new() click to toggle source
# File lib/fluent/command/plugin_generator.rb, line 257
def initialize
  @text = ""
  @preamble_source = ""
  @preamble = nil
  open(LICENSE_URL) do |io|
    @text = io.read
  end
  @preamble_source = @text[/^(\s*Copyright.+)/m, 1]
end

Public Instance Methods

full_name() click to toggle source
# File lib/fluent/command/plugin_generator.rb, line 271
def full_name
  "Apache License, Version 2.0"
end
name() click to toggle source
# File lib/fluent/command/plugin_generator.rb, line 267
def name
  "Apache-2.0"
end
preamble(user_name) click to toggle source
# File lib/fluent/command/plugin_generator.rb, line 275
def preamble(user_name)
  @preamble ||= @preamble_source.dup.tap do |source|
    source.gsub!(/\[yyyy\]/, "#{Date.today.year}-")
    source.gsub!(/\[name of copyright owner\]/, user_name)
    source.gsub!(/^ {2}|^$/, "#")
    source.chomp!
  end
end