From 6bad92e89978d682944146d4da2806b08d312ddd Mon Sep 17 00:00:00 2001 From: "Lovett, Glen" Date: Fri, 19 Dec 2014 16:55:42 -0500 Subject: [PATCH] support enterprise github via command line options --- lib/github_changelog_generator.rb | 16 +++++++++------- lib/github_changelog_generator/parser.rb | 9 ++++++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 300c5bb51..9e37a75f5 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -28,12 +28,12 @@ def initialize github_token - if @github_token.nil? - @github = Github.new per_page: PER_PAGE_NUMBER - else - @github = Github.new oauth_token: @github_token, - per_page: PER_PAGE_NUMBER - end + github_options = {per_page: PER_PAGE_NUMBER} + github_options[:oauth_token] = @github_token unless @github_token.nil? + github_options[:endpoint] = options[:github_endpoint] unless options[:github_endpoint].nil? + github_options[:site] = options[:github_endpoint] unless options[:github_site].nil? + + @github = Github.new github_options @generator = Generator.new(@options) @@ -276,8 +276,10 @@ def delete_by_time(array, hash_key, newer_tag_time, older_tag_time = nil) # @return [String] def create_log(pull_requests, issues, tag_name, tag_time) + github_site = options[:github_site] || 'https://github.com' + # Generate tag name and link - log = "## [#{tag_name}] (https://github.com/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n" + log = "## [#{tag_name}] (#{github_site}/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n" #Generate date string: time_string = tag_time.strftime @options[:format] diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index e193b9b85..3ab11cc88 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -46,6 +46,12 @@ def self.parse_options opts.on('--labels-pr x,y,z', Array, 'Only pull requests with specified labels will be included to changelog. Default is nil') do |list| options[:pull_request_labels] = list end + opts.on('--github-site [URL]', 'The Enterprise Github site on which your project is hosted.') do |last| + options[:github_site] = last + end + opts.on('--github-api [URL]', 'The enterprise endpoint to use for your Github API.') do |last| + options[:github_endpoint] = last + end opts.on('-v', '--version', 'Print version number') do |v| puts "Version: #{GitHubChangelogGenerator::VERSION}" exit @@ -59,8 +65,9 @@ def self.parse_options parser.parse! if ARGV[0] && !ARGV[1] + github_site = options[:github_site] ? options[:github_site] : 'github.com' # this match should parse https://github.com/skywinder/Github-Changelog-Generator and skywinder/Github-Changelog-Generator to user and name - match = /(?:.+github\.com\/)?(.+)\/(.+)/.match(ARGV[0]) + match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(ARGV[0]) if match[2].nil? exit pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy