Sha256: 02062f0228df2fa5209629f35427b789ca959e38314af23b2c34e5f249ba2c4f

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

require 'erb'

module Opensource
  class License
    def initialize(options)
      @options = options
      @user = Owner.get_credentials
      @user['escaped_email'] = "<#{@user['email']}>"
      @license = ERB.new(File.read("#{File.expand_path("../../../templates", __FILE__)}/#{@options[:license]}.erb")).result(binding)
    end

    def process
      generate
      append if @options[:append]
    end

    private
    def generate
      f = File.new("#{Dir.pwd}/LICENSE", "w")
      f.write(@license)
      f.close
    end

    def append
      File.open(File.expand_path(@options[:append]), "a") do |f|
        f << "\n## License\n\n#{@license}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opensource-0.6.0 lib/opensource/license.rb
opensource-0.4.0 lib/opensource/license.rb
opensource-0.3.10 lib/opensource/license.rb
opensource-0.3.9 lib/opensource/license.rb