bulldoggy 0.0.3.alpha → 0.0.4.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d8a4206ac727653745dcbe517a26fdb0ab714a4
4
- data.tar.gz: 0b015676023a0aaf41bac6e3280058238d2db3fe
3
+ metadata.gz: dec01c191923c7efa17a1180c172158553b78be5
4
+ data.tar.gz: b48212664b74ba0846ede26190994b9dbfbe8599
5
5
  SHA512:
6
- metadata.gz: 64b2e1c2cee54cf378ea5bb331eb97e2e39ba5670ca623dd5f4e4c92ecb73e52ede8c0150c0515832388e3aec7ed191203c538986d3f6db8148ffc6695fec1a9
7
- data.tar.gz: 2445bfea6850c94a4a408dac7fe0a2b7492bb662a6553da3ce7e284563fc70173daf37e6edcd43e5ffc28af1cf210e5abf100dd4c1978bb7e81809a696f0073e
6
+ metadata.gz: 93be88ea83d33a5bb8dafc516f268ee871f62dab37d904417deb04d6371c532c6f22cec90d654cec73db78b49dce96beb866b04b1e9867401e458c0560a5d567
7
+ data.tar.gz: 01917a3f3d46d074d2b81125de4d7d6bbbc2ddeeb10dd13779daa3574b03d6f135ef2f9b3c80925de178da67112b872f2d26ab1c59ddaee92c29efab3304edab
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Bulldoggy
2
2
 
3
+ [![Build Status](https://travis-ci.org/bezelga/bulldoggy.png?branch=master)](https://travis-ci.org/bezelga/bulldoggy)
4
+ [![Code Climate](https://codeclimate.com/repos/52e6f81869568017b5003aa8/badges/a99a662bbea4283cf60f/gpa.png)](https://codeclimate.com/repos/52e6f81869568017b5003aa8/feed)
5
+
3
6
  A proof of concept inspired on Uncle Bob's Clean Architecture examplified by a **to-do list app** named Bulldoggy.
4
7
 
5
8
  This gem is the core of the to-do list.
@@ -18,16 +21,18 @@ And then execute:
18
21
 
19
22
  Or install it yourself as:
20
23
 
21
- $ gem install bulldoggy
24
+ $ gem install bulldoggy --pre
22
25
 
23
26
  ## Usage
24
27
 
25
- TODO: Write usage instructions here
28
+ ### Adding tasks:
29
+
30
+ task = Bulldoggy.add_task('go to the cinema')
31
+
32
+ ### Checking tasks:
33
+
34
+ Bulldoggy.check_task(task.id)
26
35
 
27
- ## Contributing
36
+ ### Fetching tasks:
28
37
 
29
- 1. Fork it ( http://github.com/<my-github-username>/bulldoggy/fork )
30
- 2. Create your feature branch (`git checkout -b my-new-feature`)
31
- 3. Commit your changes (`git commit -am 'Add some feature'`)
32
- 4. Push to the branch (`git push origin my-new-feature`)
33
- 5. Create new Pull Request
38
+ Bulldoggy.fetch
data/bulldoggy.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["fabiano@fbzga.com"]
11
11
  spec.summary = %q{Bulldoggy is a to-do list app inspired by Uncle Bob's Clean Architecture}
12
12
  spec.description = spec.summary
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/bezelga/bulldoggy"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -1,10 +1,11 @@
1
1
  module Bulldoggy
2
2
  module Entities
3
3
  class Task
4
- attr_accessor :id, :description
4
+ attr_accessor :id, :description, :done
5
5
 
6
6
  def initialize(description)
7
7
  @description = description
8
+ @done = false
8
9
  end
9
10
  end
10
11
  end
@@ -14,6 +14,10 @@ module Bulldoggy
14
14
  task
15
15
  end
16
16
 
17
+ def find(id)
18
+ @tasks[id]
19
+ end
20
+
17
21
  def all
18
22
  @tasks
19
23
  end
@@ -0,0 +1,25 @@
1
+ module Bulldoggy
2
+ module UseCases
3
+ class TaskChecker
4
+ def initialize(task_id)
5
+ @task_id = task_id
6
+ end
7
+
8
+ def check
9
+ return :task_not_found unless task
10
+ task.done = true
11
+ task
12
+ end
13
+
14
+ private
15
+
16
+ def task_repo
17
+ Repository.for(:task)
18
+ end
19
+
20
+ def task
21
+ @task ||= task_repo.find(@task_id)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Bulldoggy
2
- VERSION = "0.0.3.alpha"
2
+ VERSION = "0.0.4.alpha"
3
3
  end
data/lib/bulldoggy.rb CHANGED
@@ -4,13 +4,13 @@ require 'bulldoggy/entities/task'
4
4
  require 'bulldoggy/repository'
5
5
 
6
6
  require 'bulldoggy/use_cases/task_adder'
7
+ require 'bulldoggy/use_cases/task_checker'
7
8
  require 'bulldoggy/use_cases/tasks_fetcher'
8
9
 
9
10
  Bulldoggy::Repository.register :task, Bulldoggy::Repositories::InMemory::Tasks.new
10
11
 
11
12
  module Bulldoggy
12
13
  class << self
13
- # TODO: test me
14
14
  def add_task(description)
15
15
  UseCases::TaskAdder.new.add(description)
16
16
  end
@@ -18,6 +18,9 @@ module Bulldoggy
18
18
  def fetch
19
19
  UseCases::TasksFetcher.new.fetch
20
20
  end
21
+
22
+ def check_task(task_id)
23
+ UseCases::TaskChecker.new(task_id).check
24
+ end
21
25
  end
22
26
  end
23
-
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ module Bulldoggy
4
+ module UseCases
5
+ describe TaskChecker do
6
+ subject(:checker) { described_class.new(task_id) }
7
+
8
+ describe '#check' do
9
+ subject(:check) { checker.check }
10
+ let(:task) { Bulldoggy.add_task('hi') }
11
+ let(:task_id) { task.id }
12
+
13
+ context 'when the task with the given id exists' do
14
+ it 'checks the task' do
15
+ expect { check }.to change { task.done }.from(false).to(true)
16
+ end
17
+ end
18
+
19
+ context 'when there is no task with this id' do
20
+ let(:task_id) { 42 }
21
+ it { should == :task_not_found }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulldoggy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.alpha
4
+ version: 0.0.4.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabiano B.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,13 +72,15 @@ files:
72
72
  - lib/bulldoggy/repositories/in_memory/tasks.rb
73
73
  - lib/bulldoggy/repository.rb
74
74
  - lib/bulldoggy/use_cases/task_adder.rb
75
+ - lib/bulldoggy/use_cases/task_checker.rb
75
76
  - lib/bulldoggy/use_cases/tasks_fetcher.rb
76
77
  - lib/bulldoggy/version.rb
77
78
  - spec/repositories/in_memory/tasks_spec.rb
78
79
  - spec/spec_helper.rb
79
80
  - spec/use_cases/task_adder_spec.rb
81
+ - spec/use_cases/task_checker_spec.rb
80
82
  - spec/use_cases/tasks_fetcher_spec.rb
81
- homepage: ''
83
+ homepage: https://github.com/bezelga/bulldoggy
82
84
  licenses:
83
85
  - MIT
84
86
  metadata: {}
@@ -106,4 +108,5 @@ test_files:
106
108
  - spec/repositories/in_memory/tasks_spec.rb
107
109
  - spec/spec_helper.rb
108
110
  - spec/use_cases/task_adder_spec.rb
111
+ - spec/use_cases/task_checker_spec.rb
109
112
  - spec/use_cases/tasks_fetcher_spec.rb