Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tcob committed Apr 15, 2018
1 parent 1f0e655 commit 7eb7ea1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
18 changes: 7 additions & 11 deletions lib/orgbots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
require_relative 'tasks/schedule'
require_relative 'config'

puts TaskManager.new.shuffle_file
# Run through the setup checklist before proceeding
Config.new.checklist

# Query.new.authed_ratelimit
# Clear the screen and show a welcome message
system 'clear'
Reporter.new.welcome

# # Run through the setup checklist before proceeding
# Config.new.checklist

# # Clear the screen and show a welcome message
# system 'clear'
# Reporter.new.welcome

# # Prompt the user to select which mode to run Orgbots in
# Config.new.mode_config
# Prompt the user to select which mode to run Orgbots in
Config.new.mode_config
4 changes: 0 additions & 4 deletions lib/tasks/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ def initialize(r, t)
@genword = RandCommit.new(r, t).genword
end

def hooks
@c.hooks(@repo)
end

def nice_commit
content = @genword
randombranch = BranchBot.new(@repo, @token).list_branches.sample
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/queries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ def user
@c = Octokit::Client.new(access_token: @t)
@c.user[:login]
end

def hooks
@c.hooks(@repo)
end
end
7 changes: 5 additions & 2 deletions test/suppress_output.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# rubocop:disable Metrics/MethodLength

# Temporarily redirects STDOUT and STDERR to /dev/null
# but does print exceptions should there occur any.
# Call as:
Expand All @@ -10,7 +12,7 @@ def suppress_output
$stderr.reopen(File.new('/dev/null', 'w'))
$stdout.reopen(File.new('/dev/null', 'w'))
retval = yield
rescue Exception => e
rescue StandardError => e
$stdout.reopen(original_stdout)
$stderr.reopen(original_stderr)
raise e
Expand All @@ -19,4 +21,5 @@ def suppress_output
$stderr.reopen(original_stderr)
end
retval
end
end
# rubocop:enable Metrics/MethodLength
9 changes: 8 additions & 1 deletion test/test_branches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ class TestBranches < Test::Unit::TestCase
def test_list_branches
brancher = BranchBot.new(ENV['REPO'], ENV['TOKEN'])
assert_nothing_raised do
brancher.list_branches
puts brancher.list_branches
end
end

def test_rand_branch
brancher = BranchBot.new(ENV['REPO'], ENV['TOKEN'])
assert_nothing_raised do
puts brancher.rand_branch
end
end
end
2 changes: 1 addition & 1 deletion test/test_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TestReporter < Test::Unit::TestCase
def test_welcome
rep = Reporter.new
assert_nothing_raised do
suppress_output { rep.welcome }
suppress_output { rep.welcome }
end
end
end

0 comments on commit 7eb7ea1

Please sign in to comment.