missle 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/missle.rb +0 -2
- data/lib/missle/version.rb +1 -1
- data/missle-0.1.2.gem +0 -0
- data/missle.gemspec +3 -7
- metadata +13 -58
- data/lib/missle/crud.rb +0 -54
- data/lib/missle/validatable.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41aa3a112ef3fb6bb50fc191f92a0353fc69ce88
|
4
|
+
data.tar.gz: 902263ec9e95fb7edbe01d99acdd67eadcb14104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58e4005d8429cabbc1ddb058670ce0dc0572a346f7267963403ed190a1d1dbbeed71247da3ddd3c8b3ece3d15a3996d4fa788e71011e05874f29fa806f838af8
|
7
|
+
data.tar.gz: c4bfc35a96134a0c413e4107e63476413209e0d2c63b33b76c9a6769ded3cfe4e2cda5fe852aecf80e4d23345554fe4adb447c773dbc39c4b46eb4fb62ce9683
|
data/lib/missle.rb
CHANGED
data/lib/missle/version.rb
CHANGED
data/missle-0.1.2.gem
ADDED
Binary file
|
data/missle.gemspec
CHANGED
@@ -28,12 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
30
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
-
spec.add_development_dependency 'rspec', '~> 3.3.0'
|
32
|
-
spec.add_development_dependency 'pry'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.3.0', '>= 3.3.0'
|
32
|
+
spec.add_development_dependency 'pry', '~> 0'
|
33
33
|
spec.add_development_dependency 'wisper-rspec', '~> 0.0.2'
|
34
|
-
spec.add_dependency 'wisper', '~> 1.6.1'
|
35
|
-
spec.add_dependency 'uber', '~> 0.0.13'
|
36
|
-
spec.add_dependency 'reform', '~> 1.2.6'
|
37
|
-
spec.add_dependency 'wepo'
|
38
|
-
spec.add_dependency 'activemodel', '~> 4.2.0'
|
34
|
+
spec.add_dependency 'wisper', '~> 1.6.1', '>= 1.6.1'
|
39
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: missle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Deeden
|
@@ -45,6 +45,9 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 3.3.0
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.3.0
|
48
51
|
type: :development
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,18 +55,21 @@ dependencies:
|
|
52
55
|
- - "~>"
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: 3.3.0
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.3.0
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: pry
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - "
|
65
|
+
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
67
|
version: '0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - "
|
72
|
+
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
@@ -87,69 +93,19 @@ dependencies:
|
|
87
93
|
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
95
|
version: 1.6.1
|
90
|
-
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
96
|
+
- - ">="
|
95
97
|
- !ruby/object:Gem::Version
|
96
98
|
version: 1.6.1
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: uber
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.0.13
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.0.13
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: reform
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 1.2.6
|
118
99
|
type: :runtime
|
119
100
|
prerelease: false
|
120
101
|
version_requirements: !ruby/object:Gem::Requirement
|
121
102
|
requirements:
|
122
103
|
- - "~>"
|
123
104
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: wepo
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
105
|
+
version: 1.6.1
|
136
106
|
- - ">="
|
137
107
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: activemodel
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 4.2.0
|
146
|
-
type: :runtime
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 4.2.0
|
108
|
+
version: 1.6.1
|
153
109
|
description: Command abstraction
|
154
110
|
email:
|
155
111
|
- jdeeden@gmail.com
|
@@ -167,9 +123,8 @@ files:
|
|
167
123
|
- bin/setup
|
168
124
|
- lib/missle.rb
|
169
125
|
- lib/missle/command.rb
|
170
|
-
- lib/missle/crud.rb
|
171
|
-
- lib/missle/validatable.rb
|
172
126
|
- lib/missle/version.rb
|
127
|
+
- missle-0.1.2.gem
|
173
128
|
- missle.gemspec
|
174
129
|
homepage: http://github.com/gangster/missle
|
175
130
|
licenses: []
|
data/lib/missle/crud.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'missle/validatable'
|
2
|
-
require 'wepo/adapters/active_record'
|
3
|
-
|
4
|
-
module Missle
|
5
|
-
module Crud
|
6
|
-
|
7
|
-
def self.included(base)
|
8
|
-
base.instance_eval do
|
9
|
-
extend Uber::InheritableAttr
|
10
|
-
inheritable_attr :repo_class
|
11
|
-
|
12
|
-
self.repo_class = nil
|
13
|
-
|
14
|
-
def repo(*args)
|
15
|
-
if args[0]
|
16
|
-
self.repo_class = args[0]
|
17
|
-
else
|
18
|
-
self.repo_class
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def repo
|
25
|
-
@repo ||= self.class.repo_class.new(adapter: Wepo::Adapters::ActiveRecord.new)
|
26
|
-
end
|
27
|
-
|
28
|
-
attr_reader :adapter
|
29
|
-
|
30
|
-
def find(id)
|
31
|
-
repo.find(id)
|
32
|
-
end
|
33
|
-
|
34
|
-
def save(entity)
|
35
|
-
repo.save(entity)
|
36
|
-
end
|
37
|
-
|
38
|
-
def create(entity)
|
39
|
-
repo.save(entity)
|
40
|
-
end
|
41
|
-
|
42
|
-
def update(entity, attributes)
|
43
|
-
repo.update(entity, attributes)
|
44
|
-
end
|
45
|
-
|
46
|
-
def delete(entity)
|
47
|
-
repo.delete(entity)
|
48
|
-
end
|
49
|
-
|
50
|
-
def new_entity
|
51
|
-
entity_class.new
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
data/lib/missle/validatable.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'uber/inheritable_attr'
|
2
|
-
require 'reform'
|
3
|
-
require 'reform/form/active_model/validations'
|
4
|
-
|
5
|
-
module Missle
|
6
|
-
module Validatable
|
7
|
-
attr_reader :contract
|
8
|
-
def self.included(base)
|
9
|
-
base.instance_eval do
|
10
|
-
extend Uber::InheritableAttr
|
11
|
-
inheritable_attr :contract_class
|
12
|
-
|
13
|
-
self.contract_class = Reform::Form.clone
|
14
|
-
self.contract_class.class_eval do
|
15
|
-
include Reform::Form::ActiveModel::Validations
|
16
|
-
def self.name # FIXME: don't use ActiveModel::Validations in Reform, it sucks.
|
17
|
-
# for whatever reason, validations climb up the inheritance tree and require _every_ class to have a name (4.1).
|
18
|
-
"Reform::Form"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def contract(*contract_class, &block)
|
23
|
-
if block_given?
|
24
|
-
self.contract_class.class_eval(&block)
|
25
|
-
else
|
26
|
-
self.contract_class = contract_class[0]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def validate(params, entity, contract_class=nil)
|
33
|
-
@contract = contract_for(contract_class, entity)
|
34
|
-
if @valid = validate_contract(params)
|
35
|
-
contract.sync
|
36
|
-
yield entity if block_given?
|
37
|
-
else
|
38
|
-
broadcast(:failure, { errors: @contract.errors.messages })
|
39
|
-
end
|
40
|
-
@valid
|
41
|
-
end
|
42
|
-
|
43
|
-
def validate_contract(params)
|
44
|
-
contract.validate(params)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Instantiate the contract, either by using the user's contract passed into #validate
|
48
|
-
# or infer the Operation contract.
|
49
|
-
def contract_for(contract_class, *entity)
|
50
|
-
(contract_class || self.class.contract_class).new(*entity)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|