This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version of bulldoggy thor client of bulldoggy API
- Loading branch information
0 parents
commit 37a91ce
Showing
5 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'thor' | ||
gem 'bulldoggy', '~> 0.0.1.alpha' | ||
gem 'rake' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
bulldoggy (0.0.3.alpha) | ||
rake (10.1.1) | ||
thor (0.18.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bulldoggy (~> 0.0.1.alpha) | ||
rake | ||
thor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
task :default => [:test] | ||
|
||
desc "Runs API tests" | ||
task :test do | ||
ruby "test/bulldoggy-thor/api_test.rb" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'thor' | ||
require 'bulldoggy' | ||
|
||
module BulldoggyThor | ||
class API < ::Thor | ||
desc "add_task DESCRIPTION", "Type a task to create with DESCRIPTION" | ||
def add_task(description) | ||
Bulldoggy.add_task(description) | ||
end | ||
|
||
desc "remove_task TASK_ID", "Removes a task with TASK_ID" | ||
def remove_task(task_id) | ||
Bulldoggy.remove_task(task_id) | ||
end | ||
|
||
desc "fetch", "fetches all tasks" | ||
def fetch | ||
Bulldoggy.fetch | ||
end | ||
|
||
desc "check_task TASK_ID", "Mark a task as done" | ||
def check_task(task_id) | ||
Bulldoggy.check_task(task_id) | ||
end | ||
|
||
desc "uncheck_task TASK_ID", "Mark a task as undone" | ||
def uncheck_task(task_id) | ||
Bulldoggy.uncheck_task(task_id) | ||
end | ||
end | ||
end | ||
|
||
BulldoggyThor::API.start(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'test/unit' | ||
require './lib/bulldoggy-thor/api' | ||
|
||
module BulldoggyThor | ||
class APITest < Test::Unit::TestCase | ||
def test_add_task | ||
task_name = "Read Uncle Bob Articles" | ||
API.new.add_task(task_name) | ||
|
||
assert_equal task_name, Bulldoggy.fetch.first.fetch(:description) | ||
end | ||
|
||
#def test_remove_task | ||
#Bulldoggy.add_task("New Task") | ||
#API.new.remove_task(1) | ||
|
||
#assert Bulldoggy.fetch.empty? | ||
#end | ||
end | ||
end |