Class: Isstempl::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/isstempl_core.rb

Overview

Isstempl Core

Constant Summary collapse

ISSTEMPL_FILE =

rubocop:disable LineLength

'Isstempl'
ISSTEMPL_TEMPLATE =
"# encoding: utf-8\n\n# GitHub Account\n# account is required\n# account allow only String\n# account's default value => \"\"\naccount \"\"\n\n# GitHub Repository\n# repository is required\n# repository allow only String\n# repository's default value => \"\"\nrepository \"\"\n\n# Issue Title\n# title is required\n# title allow only String\n# title's default value => \"\"\ntitle \"\"\n\n# Issue Body\n# body is required\n# body allow only String\n# body's default value => \"\"\nbody \"\"\n\n# Issue Labels\n# labels is required\n# labels allow only String\n# labels => bug / duplicate / enhancement / help wanted / invalid / question / wontfix / or user defined Label\n# labels's default value => \"\"\nlabels \"\"\n"
URL_TEMPLATE =
"https://github.com/<%= account%>/<%= repository%>/issues/new?title=<%= title%>&body=<%= body%>&labels=<%= label%>"

Instance Method Summary collapse

Instance Method Details

#generateObject

generate GitHub Issue template from Issuetempl.



56
57
58
59
60
61
62
# File 'lib/isstempl_core.rb', line 56

def generate
  src = read_dsl
  dsl = Isstempl::Dsl.new
  dsl.instance_eval(src)
  url = apply_erb(dsl.isstempl)
  URI.escape(url)
end

#initObject

generate Isstemplfile to current directory.



49
50
51
52
53
# File 'lib/isstempl_core.rb', line 49

def init
  File.open(ISSTEMPL_FILE, 'w') do |f|
    f.puts ISSTEMPL_TEMPLATE
  end
end