opentie-core 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/Guardfile +64 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/lib/opentie/core/bureau.rb +6 -0
- data/lib/opentie/core/group.rb +6 -0
- data/lib/opentie/core/project.rb +13 -0
- data/lib/opentie/core/request.rb +45 -0
- data/lib/opentie/core/version.rb +5 -0
- data/lib/opentie/core.rb +10 -0
- data/opentie-core.gemspec +27 -0
- data/spec/project_spec.rb +15 -0
- data/spec/request_spec.rb +32 -0
- data/spec/spec_helper.rb +4 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 736a3ba0ef5aa345bb21807830bc1f8d100b8e9e
|
4
|
+
data.tar.gz: 8df97d08ea9d8a7c76478859c3f483a7d856efa2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f95fa8a4c5e92112aec765f448b43b38edf4b3528b5b3a08de73b8730738f547d9bfe53ade727b86ac169f5f9e5222c607152b5359ced6ff5e51edc3f53df904
|
7
|
+
data.tar.gz: a6710bff2c1360f1d7ef4936a3ea50ff271301f67db95b05c1993a6f6b7623016fa29f6e86e2c9b22edd38500186495ced1065afe67abc7ac7f80e36c7206a96
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec feature)
|
6
|
+
|
7
|
+
## Uncomment to clear the screen before every task
|
8
|
+
# clearing :on
|
9
|
+
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
12
|
+
## shell loop, e.g.:
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
15
|
+
##
|
16
|
+
## Note: if you are using the `directories` clause above and you are not
|
17
|
+
## watching the project directory ('.'), the you will want to move the Guardfile
|
18
|
+
## to a watched dir and symlink it back, e.g.
|
19
|
+
#
|
20
|
+
# $ mkdir config
|
21
|
+
# $ mv Guardfile config/
|
22
|
+
# $ ln -s config/Guardfile .
|
23
|
+
#
|
24
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
25
|
+
|
26
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
27
|
+
# rspec may be run, below are examples of the most common uses.
|
28
|
+
# * bundler: 'bundle exec rspec'
|
29
|
+
# * bundler binstubs: 'bin/rspec'
|
30
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
31
|
+
# installed the spring binstubs per the docs)
|
32
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
33
|
+
# * 'just' rspec: 'rspec'
|
34
|
+
|
35
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
36
|
+
# require "guard/rspec/dsl"
|
37
|
+
# dsl = Guard::RSpec::Dsl.new(self)
|
38
|
+
#
|
39
|
+
# # Feel free to open issues for suggestions and improvements
|
40
|
+
#
|
41
|
+
# # RSpec files
|
42
|
+
# rspec = dsl.rspec
|
43
|
+
# watch(rspec.spec_helper) { rspec.spec_dir }
|
44
|
+
# watch(rspec.spec_support) { rspec.spec_dir }
|
45
|
+
# watch(rspec.spec_files)
|
46
|
+
#
|
47
|
+
# # Ruby files
|
48
|
+
# ruby = dsl.ruby
|
49
|
+
# dsl.watch_spec_files_for(ruby.lib_files)
|
50
|
+
#
|
51
|
+
# # Rails files
|
52
|
+
# rails = dsl.rails(view_extensions: %w(erb haml slim))
|
53
|
+
# dsl.watch_spec_files_for(rails.app_files)
|
54
|
+
# dsl.watch_spec_files_for(rails.views)
|
55
|
+
#
|
56
|
+
# # Turnip features and steps
|
57
|
+
# watch(%r{^spec/acceptance/(.+)\.feature$})
|
58
|
+
# watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
59
|
+
# Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
60
|
+
# end
|
61
|
+
watch(%r{^spec/.+_spec\.rb$})
|
62
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
63
|
+
watch('spec/spec_helper.rb') { "spec" }
|
64
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Opentie::Core
|
2
|
+
|
3
|
+
opentie core library
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'opentie-core'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install opentie-core
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/opentie-core/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'mongoid'
|
2
|
+
|
3
|
+
module Opentie
|
4
|
+
module Core
|
5
|
+
class Request
|
6
|
+
include Mongoid::Document
|
7
|
+
|
8
|
+
# list of all requests / applications
|
9
|
+
@all_kinds = []
|
10
|
+
|
11
|
+
belongs_to :project, inverse_of: :project
|
12
|
+
|
13
|
+
field :commited, type: Boolean, default: false
|
14
|
+
field :created_at, type: Time
|
15
|
+
field :updated_at, type: Time
|
16
|
+
|
17
|
+
class << self
|
18
|
+
# helpers for DSL
|
19
|
+
def subject(t)
|
20
|
+
@subject = t
|
21
|
+
end
|
22
|
+
def application_period(t)
|
23
|
+
@application_period = t
|
24
|
+
end
|
25
|
+
def declinable(t)
|
26
|
+
@declinable = t
|
27
|
+
end
|
28
|
+
def in_charge_of(t)
|
29
|
+
@in_charge_of = t
|
30
|
+
end
|
31
|
+
|
32
|
+
def available? (project)
|
33
|
+
@application_period.cover? Time.now
|
34
|
+
end
|
35
|
+
|
36
|
+
def inherited(subclass)
|
37
|
+
@all_kinds << subclass
|
38
|
+
end
|
39
|
+
def all_request_types
|
40
|
+
@all_kinds
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/opentie/core.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'opentie/core/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "opentie-core"
|
8
|
+
spec.version = Opentie::Core::VERSION
|
9
|
+
spec.authors = ["polamjag"]
|
10
|
+
spec.email = ["s@polamjag.info"]
|
11
|
+
spec.summary = %q{core library for opentie project}
|
12
|
+
spec.homepage = "https://github.com/opentie/"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "mongoid"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "guard"
|
26
|
+
spec.add_development_dependency "guard-rspec"
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Opentie::Core::Project, :type => :model do
|
5
|
+
describe "FakeProject" do
|
6
|
+
class FakeProject < Opentie::Core::Project
|
7
|
+
end
|
8
|
+
|
9
|
+
subject(:pr) { FakeProject.new }
|
10
|
+
|
11
|
+
it 'can create instance' do
|
12
|
+
expect(pr).to be_an_instance_of FakeProject
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Opentie::Core::Request do
|
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
|
+
subject(:tr) { TestRequest.new }
|
27
|
+
|
28
|
+
it 'can be inherited' do
|
29
|
+
expect(tr).to be_an_instance_of TestRequest
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opentie-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- polamjag
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mongoid
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
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'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- s@polamjag.info
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- Guardfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- lib/opentie/core.rb
|
111
|
+
- lib/opentie/core/bureau.rb
|
112
|
+
- lib/opentie/core/group.rb
|
113
|
+
- lib/opentie/core/project.rb
|
114
|
+
- lib/opentie/core/request.rb
|
115
|
+
- lib/opentie/core/version.rb
|
116
|
+
- opentie-core.gemspec
|
117
|
+
- spec/project_spec.rb
|
118
|
+
- spec/request_spec.rb
|
119
|
+
- spec/spec_helper.rb
|
120
|
+
homepage: https://github.com/opentie/
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.4.5
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: core library for opentie project
|
144
|
+
test_files:
|
145
|
+
- spec/project_spec.rb
|
146
|
+
- spec/request_spec.rb
|
147
|
+
- spec/spec_helper.rb
|
148
|
+
has_rdoc:
|