Move all variables to constants.rb

Add example file to git
This commit is contained in:
Petr Korolev 2014-11-04 17:28:39 +02:00
parent cf741d9a7c
commit 6775e9808d
3 changed files with 25 additions and 23 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
output.txt
constants.rb

View File

@ -3,14 +3,7 @@
require 'github_api'
require 'json'
@project_path = '/Users/petrkorolev/repo/ActionSheetPicker-3.0'
@github_user = 'skywinder'
@github_repo_name = 'ActionSheetPicker-3.0'
tag1 = '1.1.21'
tag2 = '1.2.0'
require_relative 'constants'
def print_json(json)
puts JSON.pretty_generate(json)
@ -44,8 +37,13 @@ end
def getAllClosedPullRequests
github = Github.new oauth_token: '8587bb22f6bf125454768a4a19dbcc774ea68d48'
issues = github.pull_requests.list 'skywinder', 'ActionSheetPicker-3.0', :state => 'closed'
if @oauth_token.length
github = Github.new oauth_token: @oauth_token
else
github = Github.new
end
issues = github.pull_requests.list @github_user, @github_repo_name, :state => 'closed'
json = issues.body
json.each { |dict|
@ -54,10 +52,10 @@ def getAllClosedPullRequests
}
json
end
def compund_changelog (tag_time, pull_requests)
def compund_changelog(tag_time, pull_requests)
log = ''
last_tag = exec_command('git describe --abbrev=0 --tags').strip
log += "## [#{last_tag}] (https://github.com/#{@github_user}/#{@github_repo_name}/tree/#{last_tag})\n"
@ -84,5 +82,4 @@ pull_requests.delete_if { |req|
t < tag_time
}
compund_changelog(tag_time, pull_requests)
compund_changelog tag_time, pull_requests

4
dummy_constants.rb Normal file
View File

@ -0,0 +1,4 @@
@project_path = '/path/to/project'
@github_user = 'login'
@github_repo_name = 'projectName'
@oauth_token = 'your40digitGitHubToken'