polarbear 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/dictionaries/pat.xml +41 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/polarbear.iml +60 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +818 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +26 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +22 -0
- data/VERSION +1 -0
- data/bin/poohbear +133 -0
- data/bin/poohbear-login +93 -0
- data/bin/poohbear-logout +67 -0
- data/bin/poohbear-review +31 -0
- data/bin/poohbear-review-cancel +93 -0
- data/bin/poohbear-review-create +146 -0
- data/bin/poohbear-review-delete +93 -0
- data/bin/poohbear-review-status +93 -0
- data/bin/poohbear-review-update +125 -0
- data/lib/polarbear/codecollab.rb +112 -0
- data/lib/polarbear/command/admin.rb +64 -0
- data/lib/polarbear/command/admin_review.rb +82 -0
- data/lib/polarbear/command/batch.rb +51 -0
- data/lib/polarbear/command/config.rb +32 -0
- data/lib/polarbear/command/report.rb +78 -0
- data/lib/polarbear/model/configuration.rb +20 -0
- data/lib/polarbear/model/review.rb +107 -0
- data/lib/polarbear/utils/ccollab_locator.rb +32 -0
- data/lib/polarbear/utils/executor.rb +40 -0
- data/lib/polarbear/version.rb +3 -0
- data/lib/polarbear.rb +15 -0
- data/polarbear.gemspec +40 -0
- data/pp +0 -0
- data/spec/spec_helper.rb +26 -0
- metadata +334 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'highline/import'
|
4
|
+
require 'base64'
|
5
|
+
require 'polarbear'
|
6
|
+
|
7
|
+
#-----------------------------------------------------------------------------
|
8
|
+
#-----------------------------------------------------------------------------
|
9
|
+
def usage
|
10
|
+
puts 'Commands for login in your code collaborator server.'
|
11
|
+
exit 0
|
12
|
+
end
|
13
|
+
|
14
|
+
#-----------------------------------------------------------------------------
|
15
|
+
# ................ A R G U M E N T S .. P R O C E S S I N G .................
|
16
|
+
#-----------------------------------------------------------------------------
|
17
|
+
|
18
|
+
#-----------------------------------------------------------------------------
|
19
|
+
# This hash will hold all of the options parsed from the command-line by
|
20
|
+
# OptionParser.
|
21
|
+
# login/logout
|
22
|
+
# creating a new review (reviewer/observers, title)
|
23
|
+
# adding diff to an existing review
|
24
|
+
# cancelling review
|
25
|
+
# finishing a review
|
26
|
+
# deleting a review
|
27
|
+
# open a review in the browser
|
28
|
+
# get review info such as state by id or by title
|
29
|
+
#-----------------------------------------------------------------------------
|
30
|
+
options = {}
|
31
|
+
|
32
|
+
optparse = OptionParser.new do |opts|
|
33
|
+
# Set a banner, displayed at the top of the help screen.
|
34
|
+
opts.banner = 'Usage: poohbear [options] oldbranch newbranch ...'
|
35
|
+
|
36
|
+
# Define the options, and what they do
|
37
|
+
options[:username] = nil
|
38
|
+
opts.on('-n', '--username username', 'username') do |l|
|
39
|
+
options[:username] = l
|
40
|
+
end
|
41
|
+
|
42
|
+
options[:password] = nil
|
43
|
+
opts.on('-p', '--password PASSWORD', 'password') do |l|
|
44
|
+
options[:password] = l
|
45
|
+
end
|
46
|
+
|
47
|
+
options[:url] = nil
|
48
|
+
opts.on('-s', '--url URL', 'url') do |l|
|
49
|
+
options[:url] = l
|
50
|
+
end
|
51
|
+
|
52
|
+
options[:usage] = nil
|
53
|
+
opts.on( '-u', '--usage', 'Print one liner about this script' ) do
|
54
|
+
options[:usage] = true
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on( '-v', '--verbose', 'Verbose ') do
|
58
|
+
options[:loglevel] = :info
|
59
|
+
end
|
60
|
+
|
61
|
+
# This displays the help screen, all programs are assumed to have this
|
62
|
+
# option.
|
63
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
64
|
+
puts opts
|
65
|
+
exit
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
#-----------------------------------------------------------------------------
|
70
|
+
# Parse the command-line. Remember there are two forms of the parse method.
|
71
|
+
# The 'parse' method simply parses ARGV, while the 'parse!' method parses
|
72
|
+
# ARGV and removes any options found there, as well as any parameters for the
|
73
|
+
# the options. What's left is the list of files to resize.
|
74
|
+
#-----------------------------------------------------------------------------
|
75
|
+
begin
|
76
|
+
optparse.parse!
|
77
|
+
rescue => ex
|
78
|
+
puts ex.to_s
|
79
|
+
exit 1
|
80
|
+
end
|
81
|
+
|
82
|
+
usage if options[:usage]
|
83
|
+
|
84
|
+
_codecollab = PolarBear::CodeCollab.new
|
85
|
+
|
86
|
+
options[:url] = _codecollab.configuration.url if options[:url].nil?
|
87
|
+
options[:username] = _codecollab.configuration.username if options[:username].nil?
|
88
|
+
|
89
|
+
options[:url] = ask('URL: ') if options[:url].nil? || options[:url].empty?
|
90
|
+
options[:username] = ask('Username: ') if options[:username].nil? || options[:username].empty?
|
91
|
+
options[:password] = ask('Password: ') { |q| q.echo = '*' } if options[:password].nil?
|
92
|
+
|
93
|
+
_codecollab.login("#{options[:url]}", "#{options[:username]}", "\"#{options[:password]}\"")
|
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'highline/import'
|
4
|
+
require 'base64'
|
5
|
+
require 'polarbear'
|
6
|
+
|
7
|
+
#-----------------------------------------------------------------------------
|
8
|
+
#-----------------------------------------------------------------------------
|
9
|
+
def usage
|
10
|
+
puts 'Commands for login in your code collaborator server.'
|
11
|
+
exit 0
|
12
|
+
end
|
13
|
+
|
14
|
+
#-----------------------------------------------------------------------------
|
15
|
+
# ................ A R G U M E N T S .. P R O C E S S I N G .................
|
16
|
+
#-----------------------------------------------------------------------------
|
17
|
+
|
18
|
+
#-----------------------------------------------------------------------------
|
19
|
+
# This hash will hold all of the options parsed from the command-line by
|
20
|
+
# OptionParser.
|
21
|
+
# login/logout
|
22
|
+
# creating a new review (reviewer/observers, title)
|
23
|
+
# adding diff to an existing review
|
24
|
+
# cancelling review
|
25
|
+
# finishing a review
|
26
|
+
# deleting a review
|
27
|
+
# open a review in the browser
|
28
|
+
# get review info such as state by id or by title
|
29
|
+
#-----------------------------------------------------------------------------
|
30
|
+
options = {}
|
31
|
+
|
32
|
+
optparse = OptionParser.new do |opts|
|
33
|
+
# Set a banner, displayed at the top of the help screen.
|
34
|
+
opts.banner = 'Usage: poohbear [options] oldbranch newbranch ...'
|
35
|
+
|
36
|
+
# Define the options, and what they do
|
37
|
+
options[:username] = nil
|
38
|
+
opts.on('-n', '--username username', 'username') do |l|
|
39
|
+
options[:username] = l
|
40
|
+
end
|
41
|
+
|
42
|
+
options[:password] = nil
|
43
|
+
opts.on('-p', '--password PASSWORD', 'password') do |l|
|
44
|
+
options[:password] = l
|
45
|
+
end
|
46
|
+
|
47
|
+
options[:url] = nil
|
48
|
+
opts.on('-s', '--url URL', 'url') do |l|
|
49
|
+
options[:url] = l
|
50
|
+
end
|
51
|
+
|
52
|
+
options[:usage] = nil
|
53
|
+
opts.on( '-u', '--usage', 'Print one liner about this script' ) do
|
54
|
+
options[:usage] = true
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on( '-v', '--verbose', 'Verbose ') do
|
58
|
+
options[:loglevel] = :info
|
59
|
+
end
|
60
|
+
|
61
|
+
# This displays the help screen, all programs are assumed to have this
|
62
|
+
# option.
|
63
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
64
|
+
puts opts
|
65
|
+
exit
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
#-----------------------------------------------------------------------------
|
70
|
+
# Parse the command-line. Remember there are two forms of the parse method.
|
71
|
+
# The 'parse' method simply parses ARGV, while the 'parse!' method parses
|
72
|
+
# ARGV and removes any options found there, as well as any parameters for the
|
73
|
+
# the options. What's left is the list of files to resize.
|
74
|
+
#-----------------------------------------------------------------------------
|
75
|
+
begin
|
76
|
+
optparse.parse!
|
77
|
+
rescue => ex
|
78
|
+
puts ex.to_s
|
79
|
+
exit 1
|
80
|
+
end
|
81
|
+
|
82
|
+
usage if options[:usage]
|
83
|
+
|
84
|
+
_codecollab = PolarBear::CodeCollab.new
|
85
|
+
|
86
|
+
options[:url] = _codecollab.configuration.url if options[:url].nil?
|
87
|
+
options[:username] = _codecollab.configuration.username if options[:username].nil?
|
88
|
+
|
89
|
+
options[:url] = ask('URL: ') if options[:url].nil? || options[:url].empty?
|
90
|
+
options[:username] = ask('Username: ') if options[:username].nil? || options[:username].empty?
|
91
|
+
options[:password] = ask('Password: ') { |q| q.echo = '*' } if options[:password].nil?
|
92
|
+
|
93
|
+
_codecollab.login("#{options[:url]}", "#{options[:username]}", "\"#{options[:password]}\"")
|
@@ -0,0 +1,125 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'highline/import'
|
4
|
+
require 'base64'
|
5
|
+
require 'polarbear'
|
6
|
+
require 'gitit'
|
7
|
+
|
8
|
+
#-----------------------------------------------------------------------------
|
9
|
+
#-----------------------------------------------------------------------------
|
10
|
+
def usage
|
11
|
+
puts 'Commands for updating an existing review.'
|
12
|
+
exit 0
|
13
|
+
end
|
14
|
+
|
15
|
+
#-----------------------------------------------------------------------------
|
16
|
+
# ................ A R G U M E N T S .. P R O C E S S I N G .................
|
17
|
+
#-----------------------------------------------------------------------------
|
18
|
+
|
19
|
+
#-----------------------------------------------------------------------------
|
20
|
+
# Will try to infer the source control mechanism if possible and call.
|
21
|
+
#-----------------------------------------------------------------------------
|
22
|
+
options = {}
|
23
|
+
|
24
|
+
optparse = OptionParser.new do |opts|
|
25
|
+
# Set a banner, displayed at the top of the help screen.
|
26
|
+
opts.banner = 'Usage: poohbear update [options]'
|
27
|
+
|
28
|
+
# Define the options, and what they do
|
29
|
+
options[:title] = nil
|
30
|
+
opts.on('-t', '--title title', 'review title') do |title|
|
31
|
+
options[:title] = title
|
32
|
+
end
|
33
|
+
|
34
|
+
options[:id] = nil
|
35
|
+
opts.on('-i', '--id reviewid', 'review id') do |reviewid|
|
36
|
+
options[:id] = reviewid
|
37
|
+
end
|
38
|
+
|
39
|
+
options[:base_branch] = nil
|
40
|
+
opts.on('-b', '--base_branch branch', 'base branch name') do |branch|
|
41
|
+
options[:base_branch] = branch
|
42
|
+
end
|
43
|
+
|
44
|
+
options[:current_branch] = nil
|
45
|
+
opts.on('-c', '--current_branch branch', 'current branch name') do |branch|
|
46
|
+
options[:current_branch] = branch
|
47
|
+
end
|
48
|
+
|
49
|
+
options[:usage] = nil
|
50
|
+
opts.on( '-u', '--usage', 'Print one liner about this script' ) do
|
51
|
+
options[:usage] = true
|
52
|
+
end
|
53
|
+
|
54
|
+
options[:auto_answer] = nil
|
55
|
+
opts.on( '-y', '--auto_answer', 'Won\'t prompt the user for anything and rely on args and defaults' ) do
|
56
|
+
options[:auto_answer] = true
|
57
|
+
end
|
58
|
+
|
59
|
+
opts.on( '-v', '--verbose', 'Verbose ') do
|
60
|
+
options[:loglevel] = :info
|
61
|
+
end
|
62
|
+
|
63
|
+
# This displays the help screen, all programs are assumed to have this
|
64
|
+
# option.
|
65
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
66
|
+
puts opts
|
67
|
+
exit
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
#-----------------------------------------------------------------------------
|
72
|
+
# Parse the command-line. Remember there are two forms of the parse method.
|
73
|
+
# The 'parse' method simply parses ARGV, while the 'parse!' method parses
|
74
|
+
# ARGV and removes any options found there, as well as any parameters for the
|
75
|
+
# the options. What's left is the list of files to resize.
|
76
|
+
#-----------------------------------------------------------------------------
|
77
|
+
begin
|
78
|
+
optparse.parse!
|
79
|
+
rescue => ex
|
80
|
+
puts ex.to_s
|
81
|
+
exit 1
|
82
|
+
end
|
83
|
+
|
84
|
+
usage if options[:usage]
|
85
|
+
|
86
|
+
# Do some validation
|
87
|
+
_gitit = Gitit::Git.new(Dir.pwd)
|
88
|
+
unless _gitit.repo.valid?
|
89
|
+
p 'poohbear must be run from a folder that is a valid git repo'
|
90
|
+
exit 1
|
91
|
+
end
|
92
|
+
|
93
|
+
_current_branch = _gitit.branches.get_current_branch
|
94
|
+
_base_branch = _gitit.branches.exists_locally?('develop') ? 'develop' : 'master'
|
95
|
+
|
96
|
+
# Ask user if we have to.
|
97
|
+
if options[:auto_answer]
|
98
|
+
options[:title] = _current_branch if options[:title].nil?
|
99
|
+
options[:base_branch] = _base_branch if options[:base_branch].nil?
|
100
|
+
options[:current_branch] = _current_branch if options[:current_branch].nil?
|
101
|
+
else
|
102
|
+
options[:title] = ask('title: ') { |q| q.default = _current_branch } if options[:title].nil?
|
103
|
+
options[:base_branch] = ask('base branch diffing against: ') { |q| q.default = _base_branch } if options[:base_branch].nil?
|
104
|
+
options[:current_branch] = ask('current branch diffed against base_branch: ') { |q| q.default = _current_branch } if options[:current_branch].nil?
|
105
|
+
end
|
106
|
+
|
107
|
+
# Update the review
|
108
|
+
begin
|
109
|
+
_codecollab = PolarBear::CodeCollab.new
|
110
|
+
if options[:id].nil?
|
111
|
+
_review = _codecollab.get_review_with_title(options[:title])
|
112
|
+
else
|
113
|
+
_review = _codecollab.get_review_with_id(options[:id])
|
114
|
+
end
|
115
|
+
raise "can't find review with title #{title}" if _review.empty?
|
116
|
+
|
117
|
+
_review[0].add_git_diff(options[:base_branch], options[:current_branch])
|
118
|
+
p "Review successfully updated. Id is: #{_review[0].id}"
|
119
|
+
|
120
|
+
exit 0
|
121
|
+
rescue => ex
|
122
|
+
p ex.to_s
|
123
|
+
exit 1
|
124
|
+
end
|
125
|
+
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'polarbear/utils/ccollab_locator'
|
2
|
+
require 'polarbear/command/admin'
|
3
|
+
require 'polarbear/command/report'
|
4
|
+
require 'polarbear/command/config'
|
5
|
+
|
6
|
+
require 'polarbear/model/review'
|
7
|
+
require 'polarbear/model/configuration'
|
8
|
+
|
9
|
+
require 'nori'
|
10
|
+
require 'open-uri'
|
11
|
+
require 'csv'
|
12
|
+
require 'etc'
|
13
|
+
|
14
|
+
module PolarBear
|
15
|
+
|
16
|
+
# ----------------------------------------------------------------------------
|
17
|
+
# ----------------------------------------------------------------------------
|
18
|
+
class CodeCollab
|
19
|
+
include PolarBear::Utils
|
20
|
+
|
21
|
+
attr_reader :commands
|
22
|
+
attr_reader :configuration
|
23
|
+
|
24
|
+
# --------------------------------------------------------------------------
|
25
|
+
# --------------------------------------------------------------------------
|
26
|
+
# @return [Object]
|
27
|
+
def initialize
|
28
|
+
|
29
|
+
# do we have a config file? If so, load that and see if the exec path.
|
30
|
+
load_pb_options
|
31
|
+
|
32
|
+
if @polarbear_options[:ccollab_execpath].nil?
|
33
|
+
p 'Searching for code collaborator executable...'
|
34
|
+
@polarbear_options[:ccollab_execpath] = find_ccollab_executable
|
35
|
+
save_pb_options
|
36
|
+
end
|
37
|
+
raise "Can't find code collab executable on your system" if @polarbear_options[:ccollab_execpath].nil?
|
38
|
+
|
39
|
+
Utils::Executor.instance.set_codecollab_exec_path(@polarbear_options[:ccollab_execpath])
|
40
|
+
|
41
|
+
@commands = {}
|
42
|
+
@commands[:admin] = Command::Admin.new
|
43
|
+
@commands[:config] = Command::Config.new
|
44
|
+
@commands[:report] = Command::Report.new
|
45
|
+
|
46
|
+
@configuration = Configuration.new(@commands[:config].load_from_local_settings)
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def active_reviews
|
51
|
+
reports_result = @commands[:report].request_active_report_for(@configuration.username)
|
52
|
+
reports_result.map { |report| Review.new(report) }
|
53
|
+
end
|
54
|
+
|
55
|
+
def reviews_in_planning
|
56
|
+
reports_result = @commands[:report].request_report_in_planning_for(@configuration.username)
|
57
|
+
reports_result.map { |report| Review.new(report) }
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_review_with_title(title)
|
61
|
+
reports_result = @commands[:report].get_review_with_title_for(@configuration.username, title)
|
62
|
+
reports_result.map { |report| Review.new(report) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_review_with_id(id)
|
66
|
+
parser = Nori.new(:convert_tags_to => lambda { |tag| tag.snakecase.to_sym })
|
67
|
+
review_hash = parser.parse(@commands[:admin].get_review_xml_info(id))
|
68
|
+
Review.new(review_hash[:reviews][:review][:general])
|
69
|
+
end
|
70
|
+
|
71
|
+
def last_review
|
72
|
+
parser = Nori.new(:convert_tags_to => lambda { |tag| tag.snakecase.to_sym })
|
73
|
+
review_hash = parser.parse(@commands[:admin].get_review_xml_info('last'))
|
74
|
+
Review.new(review_hash[:reviews][:review][:general])
|
75
|
+
end
|
76
|
+
|
77
|
+
def delete_reviews(reviews)
|
78
|
+
options = PolarBear::Command::GlobalOptions.new()
|
79
|
+
batch = PolarBear::Command::Batch.new(options)
|
80
|
+
|
81
|
+
reviews.each do |review|
|
82
|
+
puts review.inspect
|
83
|
+
batch.add_command('admin_review_cancel', {':review' => "#{review.id}"})
|
84
|
+
end
|
85
|
+
|
86
|
+
batch.execute
|
87
|
+
end
|
88
|
+
|
89
|
+
def login(url, username, password)
|
90
|
+
Utils::Executor.instance.execute_command("login #{url} #{username} #{password}")
|
91
|
+
end
|
92
|
+
|
93
|
+
def logout
|
94
|
+
Utils::Executor.instance.execute_command('logout')
|
95
|
+
end
|
96
|
+
|
97
|
+
def load_pb_options
|
98
|
+
option_file="#{Dir.home}/.polarbear"
|
99
|
+
if File.exist?(option_file)
|
100
|
+
@polarbear_options = YAML.load_file(option_file)
|
101
|
+
else
|
102
|
+
@polarbear_options = {}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def save_pb_options
|
107
|
+
option_file="#{Dir.home}/.polarbear"
|
108
|
+
File.open(option_file, 'w') { |fo| fo.puts @polarbear_options.to_yaml }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'polarbear/utils/executor'
|
2
|
+
|
3
|
+
module PolarBear
|
4
|
+
module Command
|
5
|
+
|
6
|
+
# --------------------------------------------------------------------------
|
7
|
+
# --------------------------------------------------------------------------
|
8
|
+
class Admin
|
9
|
+
|
10
|
+
# ------------------------------------------------------------------------
|
11
|
+
# ------------------------------------------------------------------------
|
12
|
+
def initialize
|
13
|
+
end
|
14
|
+
|
15
|
+
# ------------------------------------------------------------------------
|
16
|
+
# ------------------------------------------------------------------------
|
17
|
+
# @param [Object] version
|
18
|
+
def get_review_xml_info(version)
|
19
|
+
execute_command("admin review-xml #{version}")
|
20
|
+
end
|
21
|
+
|
22
|
+
# ------------------------------------------------------------------------
|
23
|
+
# ------------------------------------------------------------------------
|
24
|
+
# @param [int] reviewid
|
25
|
+
def cancel_review(reviewid)
|
26
|
+
execute_admin_command('cancel', "#{reviewid}")
|
27
|
+
end
|
28
|
+
|
29
|
+
# ------------------------------------------------------------------------
|
30
|
+
# ------------------------------------------------------------------------
|
31
|
+
# @param [int] reviewid
|
32
|
+
def delete_review(reviewid)
|
33
|
+
execute_admin_command('delete', "#{reviewid}")
|
34
|
+
end
|
35
|
+
|
36
|
+
# ------------------------------------------------------------------------
|
37
|
+
# ------------------------------------------------------------------------
|
38
|
+
# @param [int] reviewid
|
39
|
+
def move_to_next_phase(reviewid)
|
40
|
+
execute_admin_command('finish', "#{reviewid}")
|
41
|
+
end
|
42
|
+
|
43
|
+
# ------------------------------------------------------------------------
|
44
|
+
# ------------------------------------------------------------------------
|
45
|
+
def finish_review(reviewid)
|
46
|
+
execute_admin_command('finish', "#{reviewid}")
|
47
|
+
end
|
48
|
+
|
49
|
+
# ------------------------------------------------------------------------
|
50
|
+
# ------------------------------------------------------------------------
|
51
|
+
#def add_participants(reviewers, observers)
|
52
|
+
#end
|
53
|
+
|
54
|
+
# @param [Object] command
|
55
|
+
# @param [Object] args
|
56
|
+
# @return [Object]
|
57
|
+
def execute_admin_command(command, args)
|
58
|
+
execute_command("--no-browser --quiet admin review #{command} #{args}")
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'polarbear/utils/executor'
|
2
|
+
|
3
|
+
module PolarBear
|
4
|
+
module Command
|
5
|
+
|
6
|
+
# --------------------------------------------------------------------------
|
7
|
+
# --------------------------------------------------------------------------
|
8
|
+
class AdminReview
|
9
|
+
|
10
|
+
# Create a new Review
|
11
|
+
def create
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
# Edit an existing Review
|
16
|
+
def edit
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
# Delete an existing Review
|
21
|
+
def delete
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
# Cancel an in-progress Review
|
26
|
+
def cancel
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
# Reject an in-progress Review
|
31
|
+
def reject
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
# Wait for a response in a Review
|
36
|
+
def wait
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
# Finish current phase of a Review
|
41
|
+
def finish
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
# Move a review from Planning to Annotating
|
46
|
+
def annotate
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
# Copy Participants from one Review to another
|
51
|
+
def copy_participants
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
# Set Participants for a Review
|
56
|
+
def set_participants
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Administer Review Participants
|
61
|
+
def participant
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
# Administer Review Comments
|
66
|
+
def comment
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
# Administer Review Defects
|
71
|
+
def defect
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
# Administer Review Conversations
|
76
|
+
def conversation
|
77
|
+
|
78
|
+
end
|
79
|
+
end # class Admin Review
|
80
|
+
|
81
|
+
end # module Command
|
82
|
+
end # module PolarBear
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'gyoku'
|
2
|
+
|
3
|
+
module PolarBear
|
4
|
+
module Command
|
5
|
+
|
6
|
+
class GlobalOptions
|
7
|
+
|
8
|
+
attr_accessor :show_browser
|
9
|
+
attr_accessor :interactive
|
10
|
+
attr_accessor :must_be_quiet
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@show_browser = false
|
14
|
+
@interactive = false
|
15
|
+
@must_be_quiet = true
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_hash
|
19
|
+
Hash result = {}
|
20
|
+
result[:'no-browser/'] = '' if !@show_browser
|
21
|
+
result[:'non-interactive/'] = '' if !@show_browser
|
22
|
+
result[:'quiet'] = (@must_be_quiet ?'yes':'no')
|
23
|
+
result
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class Batch
|
29
|
+
|
30
|
+
attr_reader :command
|
31
|
+
|
32
|
+
def initialize (options = nil)
|
33
|
+
options = GlobalOptions.new if options == nil
|
34
|
+
|
35
|
+
@command = {}
|
36
|
+
@command[':batch-commands'] = {}
|
37
|
+
@command[':batch-commands'][:'global-options'] = options.to_hash
|
38
|
+
@command[':batch-commands'].compare_by_identity
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_command(command_name, hash)
|
42
|
+
@command[':batch-commands'][":#{command_name}"] = hash
|
43
|
+
end
|
44
|
+
|
45
|
+
def execute
|
46
|
+
Utils::Executor.instance.execute_command('--quiet admin batch - ', Gyoku.xml(@command))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'polarbear/utils/executor'
|
2
|
+
|
3
|
+
module PolarBear
|
4
|
+
module Command
|
5
|
+
|
6
|
+
# --------------------------------------------------------------------------
|
7
|
+
# --------------------------------------------------------------------------
|
8
|
+
class Config
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
end
|
12
|
+
|
13
|
+
def load_from_local_settings
|
14
|
+
config_data = Utils::Executor.instance.execute_command('set')
|
15
|
+
|
16
|
+
hash = {}
|
17
|
+
config_data.each_line { |l|
|
18
|
+
updated_line = l.gsub(/\s+/, '').chomp
|
19
|
+
|
20
|
+
regex = /(([^=;]*)=([^=;]*);?)+/
|
21
|
+
match = updated_line.match regex
|
22
|
+
if !match.nil? && !match[3].empty? && match[3] != '(Empty)'
|
23
|
+
hash[match[2]] = match[3]
|
24
|
+
end
|
25
|
+
}
|
26
|
+
hash
|
27
|
+
end
|
28
|
+
|
29
|
+
end #class Config
|
30
|
+
|
31
|
+
end #module Command
|
32
|
+
end #module PolarBear
|