bulldoggy 0.0.6.alpha → 0.0.7.alpha
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 +4 -4
- data/README.md +16 -3
- data/lib/bulldoggy.rb +0 -2
- data/lib/bulldoggy/entities/task.rb +2 -2
- data/lib/bulldoggy/repositories/in_memory/tasks.rb +15 -1
- data/lib/bulldoggy/use_cases/task_checker.rb +1 -7
- data/lib/bulldoggy/use_cases/task_unchecker.rb +1 -7
- data/lib/bulldoggy/use_cases/tasks_fetcher.rb +2 -2
- data/lib/bulldoggy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b8f48158b1ab987418c0ce36448255fe30272a1
|
|
4
|
+
data.tar.gz: 981454050d6fbca1a22ac11d1acd7bf99d92ace7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5d1f13bc2303e0204f1b1e085bfec91b40da7cf3e79d5b7e700395f9baa96d1e91bf021f8c5a41343d5cec701455ee62d814c822bc1abe3c1db8e6bda0b8c0d
|
|
7
|
+
data.tar.gz: 07f5e0da91299a64e8b5b9baa924c2fdb3d43096ab6b886cff3c576281b89e804acbdb1ffd614f11eb9723f5ab300d1decbe3372ecf5df8146b08b644726b5fd
|
data/README.md
CHANGED
|
@@ -9,11 +9,12 @@ The idea of is to have a concrete implementation of the architecture and use var
|
|
|
9
9
|
|
|
10
10
|
Implementations of the delivery mechanisms are welcome and will be listed here:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Web as the delivery mechanism:
|
|
13
13
|
|
|
14
14
|
* [bulldoggy-sinatra](https://github.com/bezelga/bulldoggy-sinatra)
|
|
15
|
+
* [bulldoggy-rails](https://github.com/bezelga/bulldoggy-rails)
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
## CLI (command line interface) as the delivery mechanism:
|
|
17
18
|
|
|
18
19
|
* [bulldoggy-thor](https://github.com/philss/bulldoggy-thor)
|
|
19
20
|
|
|
@@ -21,7 +22,7 @@ Implementations of the delivery mechanisms are welcome and will be listed here:
|
|
|
21
22
|
|
|
22
23
|
Add this line to your application's Gemfile:
|
|
23
24
|
|
|
24
|
-
gem 'bulldoggy'
|
|
25
|
+
gem 'bulldoggy', '~> 0.0.1.alpha'
|
|
25
26
|
|
|
26
27
|
And then execute:
|
|
27
28
|
|
|
@@ -52,3 +53,15 @@ Or install it yourself as:
|
|
|
52
53
|
### Fetching tasks:
|
|
53
54
|
|
|
54
55
|
Bulldoggy.fetch
|
|
56
|
+
|
|
57
|
+
## Usage with Rails:
|
|
58
|
+
|
|
59
|
+
### Connecting entities to ActiveRecord models
|
|
60
|
+
|
|
61
|
+
Inside your Rails app, create an initializer and register your repository adapters to make it work with Rails AR models.
|
|
62
|
+
|
|
63
|
+
config/initializers/bulldoggy.rb:
|
|
64
|
+
|
|
65
|
+
Bulldoggy::Repository.register :task, TasksRespositoryAdapter.new
|
|
66
|
+
|
|
67
|
+
TODO: add repository adapter example
|
data/lib/bulldoggy.rb
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
require "bulldoggy/version"
|
|
2
|
-
|
|
3
2
|
require 'bulldoggy/entities/task'
|
|
4
3
|
require 'bulldoggy/repository'
|
|
5
|
-
|
|
6
4
|
Dir[File.dirname(__FILE__) + "/bulldoggy/use_cases/**/*.rb"].each { |file| require file }
|
|
7
5
|
|
|
8
6
|
Bulldoggy::Repository.register :task, Bulldoggy::Repositories::InMemory::Tasks.new
|
|
@@ -8,13 +8,27 @@ module Bulldoggy
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def all
|
|
11
|
-
@tasks
|
|
11
|
+
@tasks.values
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def find(id)
|
|
15
15
|
@tasks[id]
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
def check(id)
|
|
19
|
+
task = @tasks[id]
|
|
20
|
+
return :task_not_found unless task
|
|
21
|
+
task.done = true
|
|
22
|
+
task
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def uncheck(id)
|
|
26
|
+
task = @tasks[id]
|
|
27
|
+
return :task_not_found unless task
|
|
28
|
+
task.done = false
|
|
29
|
+
task
|
|
30
|
+
end
|
|
31
|
+
|
|
18
32
|
def save(task)
|
|
19
33
|
task.id = @next_id
|
|
20
34
|
@tasks[@next_id] = task
|
|
@@ -6,9 +6,7 @@ module Bulldoggy
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def check
|
|
9
|
-
|
|
10
|
-
task.done = true
|
|
11
|
-
task
|
|
9
|
+
task_repo.check(@task_id)
|
|
12
10
|
end
|
|
13
11
|
|
|
14
12
|
private
|
|
@@ -16,10 +14,6 @@ module Bulldoggy
|
|
|
16
14
|
def task_repo
|
|
17
15
|
Repository.for(:task)
|
|
18
16
|
end
|
|
19
|
-
|
|
20
|
-
def task
|
|
21
|
-
@task ||= task_repo.find(@task_id)
|
|
22
|
-
end
|
|
23
17
|
end
|
|
24
18
|
end
|
|
25
19
|
end
|
|
@@ -6,9 +6,7 @@ module Bulldoggy
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def uncheck
|
|
9
|
-
|
|
10
|
-
task.done = false
|
|
11
|
-
task
|
|
9
|
+
task_repo.uncheck(@task_id)
|
|
12
10
|
end
|
|
13
11
|
|
|
14
12
|
private
|
|
@@ -16,10 +14,6 @@ module Bulldoggy
|
|
|
16
14
|
def task_repo
|
|
17
15
|
Repository.for(:task)
|
|
18
16
|
end
|
|
19
|
-
|
|
20
|
-
def task
|
|
21
|
-
@task ||= task_repo.find(@task_id)
|
|
22
|
-
end
|
|
23
17
|
end
|
|
24
18
|
end
|
|
25
19
|
end
|
|
@@ -2,9 +2,9 @@ module Bulldoggy
|
|
|
2
2
|
module UseCases
|
|
3
3
|
class TasksFetcher
|
|
4
4
|
def fetch
|
|
5
|
-
Bulldoggy::Repository.for(:task).all.map do |
|
|
5
|
+
Bulldoggy::Repository.for(:task).all.map do |task|
|
|
6
6
|
# IMPROVE: create a TaskSerializer to do this job
|
|
7
|
-
{ id: id, description: task.description, :done => task.done }
|
|
7
|
+
{ id: task.id, description: task.description, :done => task.done }
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
end
|
data/lib/bulldoggy/version.rb
CHANGED