Class: GitHubChangelogGenerator::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- GitHubChangelogGenerator::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- lib/github_changelog_generator/task.rb
Constant Summary collapse
- OPTIONS =
%w( user project token date_format output bug_prefix enhancement_prefix issue_prefix header merge_prefix issues add_issues_wo_labels add_pr_wo_labels pulls filter_issues_by_milestone author unreleased_only unreleased unreleased_label compare_link include_labels exclude_labels bug_labels enhancement_labels between_tags exclude_tags since_tag max_issues github_site github_endpoint simple_list future_release release_branch verbose release_url base )
Instance Method Summary collapse
- #define(args) {|[self, args].slice(0, task_block.arity)| ... } ⇒ Object
-
#initialize(*args, &task_block) ⇒ RakeTask
constructor
Public: Initialise a new GitHubChangelogGenerator::RakeTask.
Constructor Details
#initialize(*args, &task_block) ⇒ RakeTask
Public: Initialise a new GitHubChangelogGenerator::RakeTask.
Example
GitHubChangelogGenerator::RakeTask.new
31 32 33 34 35 |
# File 'lib/github_changelog_generator/task.rb', line 31 def initialize(*args, &task_block) @name = args.shift || :changelog define(args, &task_block) end |
Instance Method Details
#define(args) {|[self, args].slice(0, task_block.arity)| ... } ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/github_changelog_generator/task.rb', line 37 def define(args, &task_block) desc "Generate a Change log from GitHub" yield(*[self, args].slice(0, task_block.arity)) if task_block # clear any (auto-)pre-existing task Rake::Task[@name].clear if Rake::Task.task_defined?(@name) task @name do # mimick parse_options = Parser. Parser.user_and_project_from_git() OPTIONS.each do |o| v = instance_variable_get("@#{o}") [o.to_sym] = v unless v.nil? end generator = Generator.new log = generator.compound_changelog output_filename = ([:output]).to_s File.open(output_filename, "w") { |file| file.write(log) } puts "Done!" puts "Generated log placed in #{Dir.pwd}/#{output_filename}" end end |