bulldoggy 0.0.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/bulldoggy.gemspec +24 -0
- data/lib/bulldoggy/entities/list.rb +10 -0
- data/lib/bulldoggy/repositories/in_memory/lists.rb +33 -0
- data/lib/bulldoggy/repository.rb +15 -0
- data/lib/bulldoggy/use_cases/list_creator.rb +29 -0
- data/lib/bulldoggy/version.rb +3 -0
- data/lib/bulldoggy.rb +12 -0
- data/spec/entities/list_spec.rb +13 -0
- data/spec/repositories/in_memory/lists_spec.rb +14 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/use_cases/list_creator_spec.rb +20 -0
- data/spec/use_cases/task_adder_spec.rb +18 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f48fe74e4aa62febcfb9f08593c6b04f47ef348e
|
4
|
+
data.tar.gz: 5df532e81fb4aa021c164b95f1f34efc7c52725f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2ed1674eb51c129182b8a2e3c26d52ddc103596d494e64b2c080d47b493f800e4e35fc689d595e7b853b1875a7c80d50dd56bfd2a685511b1258929e79c3390
|
7
|
+
data.tar.gz: 81083e43cb8e43d1b43448b531dcccd9bf8b945ff34d62cddcbb077e8d5067671f464e2448f88a2bc4bd096a5d6135c7ff5a03de24c13fc7762135afc2f6a9eb
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Fabiano B.
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Bulldoggy
|
2
|
+
|
3
|
+
A proof of concept inspired on Uncle Bob's Clean Architecture examplified by a **to-do list app** named Bulldoggy.
|
4
|
+
|
5
|
+
This gem is the core of the to-do list.
|
6
|
+
|
7
|
+
The delivery mechanisms and the databases are deferred decisions, for now the focus on the app itself and not on these details, but the idea is that they act as plugins.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'bulldoggy'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install bulldoggy
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
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
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bulldoggy.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bulldog/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bulldoggy"
|
8
|
+
spec.version = Bulldog::VERSION
|
9
|
+
spec.authors = ["Fabiano B."]
|
10
|
+
spec.email = ["fabiano@fbzga.com"]
|
11
|
+
spec.summary = %q{Bulldoggy is a to-do list app inspired by Uncle Bob's Clean Architecture}
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Bulldoggy
|
2
|
+
module Repositories
|
3
|
+
module InMemory
|
4
|
+
class Lists
|
5
|
+
def initialize
|
6
|
+
@lists = {}
|
7
|
+
@next_id = 1
|
8
|
+
end
|
9
|
+
|
10
|
+
def save(list)
|
11
|
+
list.id = @next_id
|
12
|
+
@lists[@next_id] = list
|
13
|
+
@next_id += 1
|
14
|
+
list
|
15
|
+
end
|
16
|
+
|
17
|
+
def all
|
18
|
+
@lists
|
19
|
+
end
|
20
|
+
|
21
|
+
def first
|
22
|
+
first_key = @lists.keys.sort.first
|
23
|
+
@lists[first_key]
|
24
|
+
end
|
25
|
+
|
26
|
+
def last
|
27
|
+
last_key = @lists.keys.sort.last
|
28
|
+
@lists[last_key]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Bulldoggy
|
2
|
+
module UseCases
|
3
|
+
class ListCreator
|
4
|
+
def self.create(name)
|
5
|
+
params = { name: name }
|
6
|
+
new(params).create
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(params)
|
10
|
+
@params = params
|
11
|
+
end
|
12
|
+
|
13
|
+
def create
|
14
|
+
saved_list = list_repo.save(list)
|
15
|
+
saved_list.id
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def list
|
21
|
+
Bulldoggy::Entities::List.new(@params[:name])
|
22
|
+
end
|
23
|
+
|
24
|
+
def list_repo
|
25
|
+
Bulldoggy::Repository.for(:list)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/bulldoggy.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "bulldoggy/version"
|
2
|
+
|
3
|
+
require 'bulldoggy/use_cases/list_creator'
|
4
|
+
require 'bulldoggy/entities/list'
|
5
|
+
require 'bulldoggy/repository'
|
6
|
+
require 'bulldoggy/repositories/in_memory/lists'
|
7
|
+
|
8
|
+
module Bulldoggy
|
9
|
+
# Your code goes here...
|
10
|
+
end
|
11
|
+
|
12
|
+
Bulldoggy::Repository.register :list, Bulldoggy::Repositories::InMemory::Lists.new
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bulldoggy::Entities::List do
|
4
|
+
subject(:list) { described_class }
|
5
|
+
|
6
|
+
describe 'instantiating a new list' do
|
7
|
+
let(:name) { 'my awesome list name' }
|
8
|
+
|
9
|
+
it 'instantiates a new list with a name' do
|
10
|
+
list.new(name).should be_kind_of(list)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bulldoggy::Repositories::InMemory::Lists do
|
4
|
+
subject(:lists) { described_class.new }
|
5
|
+
|
6
|
+
describe '#save' do
|
7
|
+
let(:list) { Bulldoggy::Entities::List.new('hello world list') }
|
8
|
+
|
9
|
+
it 'saves the list' do
|
10
|
+
lists.save(list)
|
11
|
+
expect { lists.save(list) }.to change { lists.all.size }.by(1)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'bulldoggy'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
17
|
+
# the seed, which is printed after each run.
|
18
|
+
# --seed 1234
|
19
|
+
config.order = 'random'
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bulldoggy::UseCases::ListCreator do
|
4
|
+
subject(:creator) { described_class }
|
5
|
+
|
6
|
+
describe '.create' do
|
7
|
+
subject(:create) { creator.create(name) }
|
8
|
+
|
9
|
+
let(:name) { 'Learning Clean Architecture' }
|
10
|
+
let(:list_repo) { Bulldoggy::Repository.for(:list) }
|
11
|
+
|
12
|
+
it 'creates a list' do
|
13
|
+
expect { create }.to change { list_repo.all.size }.by(1)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'responds the list id' do
|
17
|
+
create.should == list_repo.all.size
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
#describe TaskAdder do
|
4
|
+
#subject(:adder) { described_class }
|
5
|
+
|
6
|
+
#describe '.add' do
|
7
|
+
#subject(:add) { adder.add(description, list_id) }
|
8
|
+
|
9
|
+
#let(:description) { 'Create an app with clean architecture' }
|
10
|
+
#let(:id) { 1 }
|
11
|
+
|
12
|
+
#context 'when the list exists' do
|
13
|
+
#xit 'adds a task to the list' do
|
14
|
+
#add.should be_true
|
15
|
+
#end
|
16
|
+
#end
|
17
|
+
#end
|
18
|
+
#end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bulldoggy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabiano B.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Bulldoggy is a to-do list app inspired by Uncle Bob's Clean Architecture
|
56
|
+
email:
|
57
|
+
- fabiano@fbzga.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bulldoggy.gemspec
|
70
|
+
- lib/bulldoggy.rb
|
71
|
+
- lib/bulldoggy/entities/list.rb
|
72
|
+
- lib/bulldoggy/repositories/in_memory/lists.rb
|
73
|
+
- lib/bulldoggy/repository.rb
|
74
|
+
- lib/bulldoggy/use_cases/list_creator.rb
|
75
|
+
- lib/bulldoggy/version.rb
|
76
|
+
- spec/entities/list_spec.rb
|
77
|
+
- spec/repositories/in_memory/lists_spec.rb
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
- spec/use_cases/list_creator_spec.rb
|
80
|
+
- spec/use_cases/task_adder_spec.rb
|
81
|
+
homepage: ''
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>'
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.3.1
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.0.5
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Bulldoggy is a to-do list app inspired by Uncle Bob's Clean Architecture
|
105
|
+
test_files:
|
106
|
+
- spec/entities/list_spec.rb
|
107
|
+
- spec/repositories/in_memory/lists_spec.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/use_cases/list_creator_spec.rb
|
110
|
+
- spec/use_cases/task_adder_spec.rb
|