Sha256: b8658a7abedd25a9b48e4eec3c9c56ccc84ba1b6436cc1cbd6b284cf196831e0

Contents?: true

Size: 663 Bytes

Versions: 8

Compression:

Stored size: 663 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/#{@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

8 entries across 8 versions & 1 rubygems

Version Path
opensource-0.3.8 lib/opensource/license.rb
opensource-0.3.7 lib/opensource/license.rb
opensource-0.3.6 lib/opensource/license.rb
opensource-0.3.5 lib/opensource/license.rb
opensource-0.3.4 lib/opensource/license.rb
opensource-0.3.3 lib/opensource/license.rb
opensource-0.3.1 lib/opensource/license.rb
opensource-0.3.0 lib/opensource/license.rb