Class: Jive::Issue
- Inherits:
-
Object
- Object
- Jive::Issue
- Defined in:
- lib/jive/issue.rb
Class Method Summary collapse
- .create!(name:, type:, repo: Repo.current) ⇒ Object
- .dir_for(type, repo: Repo.current) ⇒ Object
- .for(type, repo: Repo.current) ⇒ Object
- .what_type? ⇒ Boolean
Instance Method Summary collapse
- #edit(editor: ENV["EDITOR"]) ⇒ Object
- #file_name ⇒ Object
-
#initialize(name:, type:, repo: Repo.current) ⇒ Issue
constructor
A new instance of Issue.
Constructor Details
#initialize(name:, type:, repo: Repo.current) ⇒ Issue
Returns a new instance of Issue.
34 35 36 37 38 |
# File 'lib/jive/issue.rb', line 34 def initialize(name:, type:, repo: Repo.current) @repo = repo @type = type @name = name end |
Class Method Details
.create!(name:, type:, repo: Repo.current) ⇒ Object
15 16 17 |
# File 'lib/jive/issue.rb', line 15 def create!(name:, type:, repo: Repo.current) new(repo: repo, name: name, type: type) end |
.dir_for(type, repo: Repo.current) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/jive/issue.rb', line 26 def dir_for(type, repo: Repo.current) Jive.home .join(repo.uri.host) .join(repo.nwo) .join(type) end |
.for(type, repo: Repo.current) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/jive/issue.rb', line 19 def for(type, repo: Repo.current) dir_for(type, repo: repo).glob("*.md").map do |x| name = x.basename.to_s.gsub(".md", "") new(repo: repo, name: name, type: type) end end |
.what_type? ⇒ Boolean
6 7 8 9 10 11 12 13 |
# File 'lib/jive/issue.rb', line 6 def what_type? Jive.prompt?( Jive.root .join("lib/jive/templates") .glob("*.md") .map { |x| x.basename.to_s.gsub(".md", "") } ) end |
Instance Method Details
#edit(editor: ENV["EDITOR"]) ⇒ Object
44 45 46 |
# File 'lib/jive/issue.rb', line 44 def edit(editor: ENV["EDITOR"]) Jive.shell.execute([editor, issue.to_s]) end |
#file_name ⇒ Object
40 41 42 |
# File 'lib/jive/issue.rb', line 40 def file_name "#{name.gsub(/[^a-z0-9\-_]+/i, "-").downcase}.md" end |