Skip to content

Commit

Permalink
increase swag
Browse files Browse the repository at this point in the history
  • Loading branch information
tcob committed Apr 17, 2018
1 parent 0e82775 commit 47374a6
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 32 deletions.
10 changes: 5 additions & 5 deletions lib/orgbots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
Config.new.checklist
Prompter.new.confirm

# # Clear the screen and show a welcome message
# system 'clear'
# Reporter.new.welcome
# 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
23 changes: 0 additions & 23 deletions lib/tasks/diff.rb

This file was deleted.

10 changes: 7 additions & 3 deletions lib/tasks/random_commit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@
class RandCommit
def initialize(r, t)
@c = Octokit::Client.new(access_token: t)
@pastel = Pastel.new
@repo = r
@token = t
@spin = TTY::Spinner.new('[:spinner] GitHubbing...', format: :classic)
format = "[#{@pastel.yellow(':spinner')}] " + @pastel.yellow('GitHubbing...')
@spinner = TTY::Spinner.new(format, success_mark: @pastel.green('+'))
end

def commit
@spin.auto_spin
@spinner.auto_spin
content = genword
randombranch = BranchBot.new(@repo, @token).rand_branch
file = pick_file(randombranch)
file = genword.to_s + txt_ext if maybe
CommitBot.new(@repo, randombranch, @token).commit(file, content, genword)
@spin.success("📈 Created extreme swag on branch #{randombranch} in #{file}")
@spinner.success("📈 Created extreme swag on branch #{randombranch} in #{file}")
end

def shuffle_file(branch, file, content, message)
@spinner.auto_spin
lines = Base64.decode64(content).lines.shuffle.flatten.join
CommitBot.new(@repo, branch, @token).commit(file, lines, message)
@spinner.success("📈 Created extreme swag on branch #{branch} in #{file}")
end

def pick_file(branch)
Expand Down
1 change: 0 additions & 1 deletion lib/tasks/tasks.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require_relative '../utils/utils'
require_relative 'random_commit'
require_relative 'diff'
require 'octokit'

Dotenv.load('orgbot.env')
Expand Down
2 changes: 2 additions & 0 deletions test/suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
require_relative 'test_issues'
require_relative 'test_pull_requests'
require_relative 'test_queries'
require_relative 'test_random_commit'
require_relative 'test_reacter'
require_relative 'test_reporter'
require_relative 'test_tasks'
require_relative 'test_utils'
36 changes: 36 additions & 0 deletions test/test_random_commit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'test/unit'
require_relative '../lib/config'
require_relative '../lib/tasks/tasks'

class TestRandCommit < Test::Unit::TestCase
def test_pick_file
rc = RandCommit.new(ENV['REPO'], ENV['TOKEN'])
assert_nothing_raised do
rc.pick_file('master')
end
end

# only add when cleanup step easily available
# def test_random_commit
# rc = RandCommit.new(ENV['REPO'], ENV['TOKEN'])
# assert_nothing_raised do
# rc.commit
# end
# end

def test_gen_word_maybe
rc = RandCommit.new(ENV['REPO'], ENV['TOKEN'])
assert_nothing_raised do
rc.genword
rc.maybe
end
end

def test_txt_code_ext
rc = RandCommit.new(ENV['REPO'], ENV['TOKEN'])
assert_nothing_raised do
rc.txt_ext
rc.code_ext
end
end
end
12 changes: 12 additions & 0 deletions test/test_tasks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'test/unit'
require_relative '../lib/config'
require_relative '../lib/tasks/tasks'

class TestTasks < Test::Unit::TestCase
def test_basic_task
tm = TaskManager.new
assert_nothing_raised do
tm.shuffle_rand_file
end
end
end

0 comments on commit 47374a6

Please sign in to comment.