opentie-core 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/LICENSE +165 -0
- data/README.md +1 -1
- data/lib/opentie/core/account.rb +5 -9
- data/lib/opentie/core/bureau.rb +2 -4
- data/lib/opentie/core/form_schema.rb +81 -0
- data/lib/opentie/core/group.rb +3 -7
- data/lib/opentie/core/message.rb +7 -16
- data/lib/opentie/core/persona.rb +2 -12
- data/lib/opentie/core/project.rb +7 -7
- data/lib/opentie/core/request.rb +14 -14
- data/lib/opentie/core/version.rb +1 -1
- data/lib/opentie/core.rb +3 -3
- data/opentie-core.gemspec +6 -1
- data/spec/form_schema_spec.rb +32 -0
- data/spec/mongoid.yml +6 -0
- data/spec/project_spec.rb +0 -3
- data/spec/request_spec.rb +0 -20
- data/spec/spec_helper.rb +67 -2
- metadata +65 -4
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 298d1f52211842355c14ef75e27bec7627ec4f66
|
4
|
+
data.tar.gz: a8dcd7773623c4f97d939f3ea607536541ae0bd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cdc41d9145d8b572fe2aad9ddd48feb14847cf714f58ea56da1c65f48f43eb5398ff8367230f6ae2362353a546c325d27b6826f81cecd58695c686765c4c8a1
|
7
|
+
data.tar.gz: f006961422cac2c9911e294ce0f543326131be30b32958c8d61b3747e2390e848a907cd69dcdabcb5308c6c8029c477eca9154ff1695a90f696f5ccd6e233d19
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Opentie::Core [![Circle CI](https://circleci.com/gh/opentie/opentie-core.svg?style=svg)](https://circleci.com/gh/opentie/opentie-core) [![Build Status](https://travis-ci.org/opentie/opentie-core.svg?branch=master)](https://travis-ci.org/opentie/opentie-core)
|
1
|
+
# Opentie::Core [![Circle CI](https://circleci.com/gh/opentie/opentie-core.svg?style=svg)](https://circleci.com/gh/opentie/opentie-core) [![Build Status](https://travis-ci.org/opentie/opentie-core.svg?branch=master)](https://travis-ci.org/opentie/opentie-core) [![Gem Version](https://badge.fury.io/rb/opentie-core.svg)](http://badge.fury.io/rb/opentie-core)
|
2
2
|
|
3
3
|
opentie core library
|
4
4
|
|
data/lib/opentie/core/account.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
include Mongoid::Document
|
7
|
-
|
8
|
-
belongs_to :persona, inverse_of: :accounts
|
9
|
-
|
1
|
+
module Opentie::Core
|
2
|
+
module Account
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
10
6
|
field :auth_token, type: Hash
|
11
7
|
end
|
12
8
|
end
|
data/lib/opentie/core/bureau.rb
CHANGED
@@ -0,0 +1,81 @@
|
|
1
|
+
module Opentie::Core
|
2
|
+
module FormSchema
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
class IllDefinedField < StandardError; end
|
6
|
+
|
7
|
+
included do
|
8
|
+
class_attribute :schema
|
9
|
+
self.schema = []
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def radio(name, title, options)
|
14
|
+
schema = create_schema(name, title, :radio, { values: {} }, options)
|
15
|
+
|
16
|
+
raise IllDefinedField, "there must be least 2 values" if schema[:values].length < 2
|
17
|
+
|
18
|
+
form_field :enum, schema
|
19
|
+
end
|
20
|
+
|
21
|
+
def yes_no(name, title, options)
|
22
|
+
raise IllDefinedField, "field `yes` must be specified" if options[:yes].nil?
|
23
|
+
raise IllDefinedField, "field `no` must be specified" if options[:no].nil?
|
24
|
+
|
25
|
+
options[:values] = { yes: options[:yes], no: options[:no] }
|
26
|
+
|
27
|
+
radio(name, title, options)
|
28
|
+
end
|
29
|
+
|
30
|
+
def checkbox(name, title, options)
|
31
|
+
schema = create_schema(name, title, :checkbox,
|
32
|
+
{ value: nil, label: nil }, options)
|
33
|
+
|
34
|
+
raise IllDefinedField, "value must be specified" if schema[:value].nil?
|
35
|
+
raise IllDefinedField, "label must be specified" if schema[:label].nil?
|
36
|
+
|
37
|
+
form_field Boolean, schema
|
38
|
+
end
|
39
|
+
|
40
|
+
def textarea(name, title, options)
|
41
|
+
schema = create_schema(name, title, :textarea, { default: '' }, options)
|
42
|
+
|
43
|
+
form_field String, schema
|
44
|
+
end
|
45
|
+
|
46
|
+
def text(name, title, options)
|
47
|
+
schema = create_schema(name, title, :text, { default: '' }, options)
|
48
|
+
|
49
|
+
form_field String, schema
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def create_schema(name, title, type, additional, options)
|
55
|
+
schema = { name: name, type: type, title: title }
|
56
|
+
{
|
57
|
+
description: "",
|
58
|
+
required: true,
|
59
|
+
validation: []
|
60
|
+
}.merge(additional).each {|sym, default|
|
61
|
+
if options[sym].nil?
|
62
|
+
schema[sym] = default
|
63
|
+
else
|
64
|
+
schema[sym] = options[sym]
|
65
|
+
end
|
66
|
+
}
|
67
|
+
schema
|
68
|
+
end
|
69
|
+
|
70
|
+
def form_field(type, options)
|
71
|
+
schema << options
|
72
|
+
|
73
|
+
if type == :enum
|
74
|
+
enum options[:name], options[:values].keys
|
75
|
+
else
|
76
|
+
field options[:name], type: type, default: options[:default]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/opentie/core/group.rb
CHANGED
data/lib/opentie/core/message.rb
CHANGED
@@ -1,25 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
module Opentie
|
5
|
-
module Core
|
6
|
-
class Message
|
7
|
-
include Mongoid::Document
|
8
|
-
|
9
|
-
has_one :persona, as: :from
|
10
|
-
has_one :persona, as: :to
|
11
|
-
|
12
|
-
has_one :message, as: :in_reply_to
|
13
|
-
belongs_to :message
|
1
|
+
module Opentie::Core
|
2
|
+
module Message
|
3
|
+
extend ActiveSupport::Concern
|
14
4
|
|
5
|
+
included do
|
15
6
|
field :created_at, type: Time
|
16
7
|
|
17
8
|
field :subject, type: String
|
18
9
|
field :body, type: String
|
10
|
+
end
|
19
11
|
|
20
|
-
|
21
|
-
|
22
|
-
end
|
12
|
+
def get_thread
|
13
|
+
Message.find _id: self._id
|
23
14
|
end
|
24
15
|
end
|
25
16
|
end
|
data/lib/opentie/core/persona.rb
CHANGED
@@ -1,14 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Opentie
|
4
|
-
module Core
|
5
|
-
class Persona
|
6
|
-
include Mongoid::Document
|
7
|
-
|
8
|
-
has_many :accounts, inverse_of: :persona
|
9
|
-
has_many :groups, inverse_of: :persona
|
10
|
-
|
11
|
-
belongs_to :message
|
12
|
-
end
|
1
|
+
module Opentie::Core
|
2
|
+
class Persona
|
13
3
|
end
|
14
4
|
end
|
data/lib/opentie/core/project.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require_relative 'request'
|
2
2
|
|
3
|
-
module Opentie
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module Opentie::Core
|
4
|
+
module Project
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
def available_requests
|
8
|
+
Opentie::Core::Request.all_request_types.select do |req|
|
9
|
+
req.available? self
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/lib/opentie/core/request.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
|
1
|
+
require_relative 'form_schema'
|
2
2
|
|
3
3
|
module Opentie
|
4
4
|
module Core
|
5
|
-
|
6
|
-
|
5
|
+
module Request
|
6
|
+
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
included do
|
9
|
+
# list of all requests / applications
|
10
|
+
@all_kinds = []
|
11
|
+
|
12
|
+
field :commited, type: Boolean, default: false
|
13
|
+
field :created_at, type: Time
|
14
|
+
field :updated_at, type: Time
|
15
|
+
end
|
16
16
|
|
17
|
-
|
17
|
+
module ClassMethods
|
18
18
|
# helpers for DSL
|
19
19
|
def subject(t)
|
20
20
|
@subject = t
|
@@ -22,8 +22,8 @@ module Opentie
|
|
22
22
|
def application_period(t)
|
23
23
|
@application_period = t
|
24
24
|
end
|
25
|
-
def
|
26
|
-
@
|
25
|
+
def optional(t)
|
26
|
+
@optional = t
|
27
27
|
end
|
28
28
|
def in_charge_of(t)
|
29
29
|
@in_charge_of = t
|
data/lib/opentie/core/version.rb
CHANGED
data/lib/opentie/core.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support"
|
2
|
+
|
1
3
|
require "opentie/core/version"
|
2
4
|
require "opentie/core/account"
|
3
5
|
require "opentie/core/group"
|
@@ -7,7 +9,5 @@ require "opentie/core/persona"
|
|
7
9
|
require "opentie/core/request"
|
8
10
|
require "opentie/core/message"
|
9
11
|
|
10
|
-
module Opentie
|
11
|
-
module Core
|
12
|
-
end
|
12
|
+
module Opentie::Core
|
13
13
|
end
|
data/opentie-core.gemspec
CHANGED
@@ -17,7 +17,11 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "
|
20
|
+
spec.add_dependency "activesupport"
|
21
|
+
|
22
|
+
spec.add_development_dependency "mongoid"
|
23
|
+
spec.add_development_dependency "mongoid-tree"
|
24
|
+
spec.add_development_dependency "mongoid-enum"
|
21
25
|
|
22
26
|
spec.add_development_dependency "bundler", "~> 1.7"
|
23
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -25,4 +29,5 @@ Gem::Specification.new do |spec|
|
|
25
29
|
spec.add_development_dependency "guard"
|
26
30
|
spec.add_development_dependency "guard-rspec"
|
27
31
|
spec.add_development_dependency "factory_girl"
|
32
|
+
spec.add_development_dependency "database_cleaner"
|
28
33
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative 'spec_helper'
|
3
|
+
require 'database_cleaner'
|
4
|
+
|
5
|
+
RSpec.describe Opentie::Core::Project, :type => :model do
|
6
|
+
describe "FakeProject" do
|
7
|
+
before :each do
|
8
|
+
DatabaseCleaner.start
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
DatabaseCleaner.clean
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be able to create" do
|
16
|
+
FakeProject.create!(hoge: :foo)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be querable" do
|
20
|
+
a = FakeProject.create(hoge: :foo)
|
21
|
+
b = FakeProject.create(hoge: :bar)
|
22
|
+
|
23
|
+
x = FakeProject.where(hoge: :foo)
|
24
|
+
expect(x.first.id).to eq(a.id)
|
25
|
+
expect(x.first.hoge).to eq(:foo)
|
26
|
+
|
27
|
+
y = FakeProject.where(hoge: :bar)
|
28
|
+
expect(y.first.id).to eq(b.id)
|
29
|
+
expect(y.first.hoge).to eq(:bar)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/mongoid.yml
ADDED
data/spec/project_spec.rb
CHANGED
data/spec/request_spec.rb
CHANGED
@@ -3,26 +3,6 @@ require_relative 'spec_helper'
|
|
3
3
|
|
4
4
|
RSpec.describe Opentie::Core::Request do
|
5
5
|
describe "TestRequest" do
|
6
|
-
class TestRequest < Opentie::Core::Request
|
7
|
-
subject "test request"
|
8
|
-
application_period (Time.local 2015, 4, 1, 10)..(Time.local 2015, 5, 1, 10)
|
9
|
-
declinable false
|
10
|
-
in_charge_of :soumu
|
11
|
-
|
12
|
-
field :fake_number, type: Integer
|
13
|
-
field :fake_text, type: String
|
14
|
-
field :fake_array, type: Array
|
15
|
-
end
|
16
|
-
class AnotherTestRequest < Opentie::Core::Request
|
17
|
-
subject "test request twooo"
|
18
|
-
application_period (Time.local 2015, 5, 3, 10)..(Time.local 2015, 6, 1, 10)
|
19
|
-
declinable true
|
20
|
-
in_charge_of :soumu
|
21
|
-
|
22
|
-
field :another_fake_number, type: Integer
|
23
|
-
field :another_fake_hash, type: Hash
|
24
|
-
end
|
25
|
-
|
26
6
|
subject(:tr) { TestRequest.new }
|
27
7
|
|
28
8
|
it 'can be inherited' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,69 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require 'bundler/setup'
|
2
|
-
require 'factory_girl'
|
3
|
-
require 'opentie/core'
|
4
3
|
require 'rspec'
|
4
|
+
require 'opentie/core'
|
5
|
+
require 'mongoid'
|
6
|
+
Mongoid.load!('./spec/mongoid.yml')
|
7
|
+
require 'mongoid/enum'
|
8
|
+
|
9
|
+
require 'database_cleaner'
|
10
|
+
|
11
|
+
DatabaseCleaner.strategy = :truncation
|
12
|
+
|
13
|
+
class FakeGroup
|
14
|
+
include Mongoid::Document
|
15
|
+
include Mongoid::Enum
|
16
|
+
include Opentie::Core::Group
|
17
|
+
include Opentie::Core::FormSchema
|
18
|
+
end
|
19
|
+
|
20
|
+
class FakeBureau < FakeGroup
|
21
|
+
include Opentie::Core::Bureau
|
22
|
+
end
|
23
|
+
|
24
|
+
class FakeProject < FakeGroup
|
25
|
+
include Opentie::Core::Project
|
26
|
+
|
27
|
+
yes_no "is_ok", "よいか",
|
28
|
+
yes: "よい",
|
29
|
+
no: "わるい"
|
30
|
+
|
31
|
+
radio "hoge", "ほげフィールド",
|
32
|
+
description: "",
|
33
|
+
values: {
|
34
|
+
foo: "ふー",
|
35
|
+
bar: "ばー",
|
36
|
+
baz: "ばず"
|
37
|
+
}
|
38
|
+
|
39
|
+
textarea "text", "書け",
|
40
|
+
description: "オイ 書け オラ"
|
41
|
+
|
42
|
+
has_many :requests, class_name: 'FakeRequest', inverse_of: :project
|
43
|
+
end
|
44
|
+
|
45
|
+
class FakeRequest
|
46
|
+
include Mongoid::Document
|
47
|
+
include Mongoid::Enum
|
48
|
+
include Opentie::Core::Request
|
49
|
+
include Opentie::Core::FormSchema
|
50
|
+
|
51
|
+
belongs_to :project, class_name: 'FakeProject', inverse_of: :requests
|
52
|
+
end
|
53
|
+
|
54
|
+
class TestRequest < FakeRequest
|
55
|
+
subject "test request"
|
56
|
+
application_period (Time.local 2015, 4, 1, 10)..(Time.local 2015, 5, 1, 10)
|
57
|
+
optional false
|
58
|
+
in_charge_of :soumu
|
59
|
+
end
|
60
|
+
|
61
|
+
class AnotherTestRequest < FakeRequest
|
62
|
+
subject "test request twooo"
|
63
|
+
application_period (Time.local 2015, 5, 3, 10)..(Time.local 2015, 6, 1, 10)
|
64
|
+
optional false
|
65
|
+
in_charge_of :soumu
|
66
|
+
|
67
|
+
field :another_fake_number, type: Integer
|
68
|
+
field :another_fake_hash, type: Hash
|
69
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentie-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- polamjag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -24,6 +24,48 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mongoid
|
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: mongoid-tree
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mongoid-enum
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: bundler
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +150,20 @@ dependencies:
|
|
108
150
|
- - ">="
|
109
151
|
- !ruby/object:Gem::Version
|
110
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: database_cleaner
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
111
167
|
description:
|
112
168
|
email:
|
113
169
|
- s@polamjag.info
|
@@ -119,13 +175,14 @@ files:
|
|
119
175
|
- ".travis.yml"
|
120
176
|
- Gemfile
|
121
177
|
- Guardfile
|
122
|
-
- LICENSE
|
178
|
+
- LICENSE
|
123
179
|
- README.md
|
124
180
|
- Rakefile
|
125
181
|
- circle.yml
|
126
182
|
- lib/opentie/core.rb
|
127
183
|
- lib/opentie/core/account.rb
|
128
184
|
- lib/opentie/core/bureau.rb
|
185
|
+
- lib/opentie/core/form_schema.rb
|
129
186
|
- lib/opentie/core/group.rb
|
130
187
|
- lib/opentie/core/message.rb
|
131
188
|
- lib/opentie/core/persona.rb
|
@@ -133,6 +190,8 @@ files:
|
|
133
190
|
- lib/opentie/core/request.rb
|
134
191
|
- lib/opentie/core/version.rb
|
135
192
|
- opentie-core.gemspec
|
193
|
+
- spec/form_schema_spec.rb
|
194
|
+
- spec/mongoid.yml
|
136
195
|
- spec/project_spec.rb
|
137
196
|
- spec/request_spec.rb
|
138
197
|
- spec/spec_helper.rb
|
@@ -161,6 +220,8 @@ signing_key:
|
|
161
220
|
specification_version: 4
|
162
221
|
summary: core library for opentie project
|
163
222
|
test_files:
|
223
|
+
- spec/form_schema_spec.rb
|
224
|
+
- spec/mongoid.yml
|
164
225
|
- spec/project_spec.rb
|
165
226
|
- spec/request_spec.rb
|
166
227
|
- spec/spec_helper.rb
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 polamjag
|
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.
|