sibu_apidae 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +160 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/sibu_apidae.rb +52 -0
- data/lib/sibu_apidae/version.rb +3 -0
- data/sibu_apidae.gemspec +31 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 819b7d4ac4fb7ea0a870ff22ce6c985d254b1dbf
|
4
|
+
data.tar.gz: a522cd94484e2ae5f9e54ce57cb42b36de621bbf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9d452efccbff4d6afa19f7776b9469238144b8a5c56466ca00a666f3a68f8c357854ef9e52203741226bd66713fb02116cad8b405b0daef17038b1e249a3c5a3
|
7
|
+
data.tar.gz: ea6d24c46d58a818e94d85739a027f204dd9605f52732c8a0a9be0ab52df610d98b84350d8c6c2d920dd5868dae791c84d4ae163e996333405364a13de1d072b
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sibu_apidae (0.1.0)
|
5
|
+
apidae
|
6
|
+
sibu
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.1.6)
|
12
|
+
actionpack (= 5.1.6)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (~> 0.6.1)
|
15
|
+
actionmailer (5.1.6)
|
16
|
+
actionpack (= 5.1.6)
|
17
|
+
actionview (= 5.1.6)
|
18
|
+
activejob (= 5.1.6)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.1.6)
|
22
|
+
actionview (= 5.1.6)
|
23
|
+
activesupport (= 5.1.6)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.1.6)
|
29
|
+
activesupport (= 5.1.6)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.1.6)
|
35
|
+
activesupport (= 5.1.6)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.1.6)
|
38
|
+
activesupport (= 5.1.6)
|
39
|
+
activerecord (5.1.6)
|
40
|
+
activemodel (= 5.1.6)
|
41
|
+
activesupport (= 5.1.6)
|
42
|
+
arel (~> 8.0)
|
43
|
+
activesupport (5.1.6)
|
44
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
+
i18n (>= 0.7, < 2)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
apidae (0.4.5)
|
49
|
+
pg (~> 0.20)
|
50
|
+
rails (~> 5.1.4)
|
51
|
+
rubyzip (~> 1.0.0)
|
52
|
+
arel (8.0.0)
|
53
|
+
builder (3.2.3)
|
54
|
+
concurrent-ruby (1.0.5)
|
55
|
+
crass (1.0.4)
|
56
|
+
down (4.5.0)
|
57
|
+
erubi (1.7.1)
|
58
|
+
ffi (1.9.25)
|
59
|
+
globalid (0.4.1)
|
60
|
+
activesupport (>= 4.2.0)
|
61
|
+
i18n (1.1.0)
|
62
|
+
concurrent-ruby (~> 1.0)
|
63
|
+
image_processing (0.11.2)
|
64
|
+
jquery-rails (4.3.3)
|
65
|
+
rails-dom-testing (>= 1, < 3)
|
66
|
+
railties (>= 4.2.0)
|
67
|
+
thor (>= 0.14, < 2.0)
|
68
|
+
loofah (2.2.2)
|
69
|
+
crass (~> 1.0.2)
|
70
|
+
nokogiri (>= 1.5.9)
|
71
|
+
mail (2.7.0)
|
72
|
+
mini_mime (>= 0.1.1)
|
73
|
+
method_source (0.9.0)
|
74
|
+
mini_magick (4.8.0)
|
75
|
+
mini_mime (1.0.1)
|
76
|
+
mini_portile2 (2.3.0)
|
77
|
+
minitest (5.8.5)
|
78
|
+
nio4r (2.3.1)
|
79
|
+
nokogiri (1.8.4)
|
80
|
+
mini_portile2 (~> 2.3.0)
|
81
|
+
pg (0.21.0)
|
82
|
+
rack (2.0.5)
|
83
|
+
rack-test (1.1.0)
|
84
|
+
rack (>= 1.0, < 3)
|
85
|
+
rails (5.1.6)
|
86
|
+
actioncable (= 5.1.6)
|
87
|
+
actionmailer (= 5.1.6)
|
88
|
+
actionpack (= 5.1.6)
|
89
|
+
actionview (= 5.1.6)
|
90
|
+
activejob (= 5.1.6)
|
91
|
+
activemodel (= 5.1.6)
|
92
|
+
activerecord (= 5.1.6)
|
93
|
+
activesupport (= 5.1.6)
|
94
|
+
bundler (>= 1.3.0)
|
95
|
+
railties (= 5.1.6)
|
96
|
+
sprockets-rails (>= 2.0.0)
|
97
|
+
rails-dom-testing (2.0.3)
|
98
|
+
activesupport (>= 4.2.0)
|
99
|
+
nokogiri (>= 1.6)
|
100
|
+
rails-html-sanitizer (1.0.4)
|
101
|
+
loofah (~> 2.2, >= 2.2.2)
|
102
|
+
railties (5.1.6)
|
103
|
+
actionpack (= 5.1.6)
|
104
|
+
activesupport (= 5.1.6)
|
105
|
+
method_source
|
106
|
+
rake (>= 0.8.7)
|
107
|
+
thor (>= 0.18.1, < 2.0)
|
108
|
+
rake (10.4.2)
|
109
|
+
rb-fsevent (0.10.3)
|
110
|
+
rb-inotify (0.9.10)
|
111
|
+
ffi (>= 0.5.0, < 2)
|
112
|
+
rubyzip (1.0.0)
|
113
|
+
sass (3.5.7)
|
114
|
+
sass-listen (~> 4.0.0)
|
115
|
+
sass-listen (4.0.0)
|
116
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
117
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
118
|
+
sass-rails (5.0.7)
|
119
|
+
railties (>= 4.0.0, < 6)
|
120
|
+
sass (~> 3.1)
|
121
|
+
sprockets (>= 2.8, < 4.0)
|
122
|
+
sprockets-rails (>= 2.0, < 4.0)
|
123
|
+
tilt (>= 1.1, < 3)
|
124
|
+
shrine (2.12.0)
|
125
|
+
down (~> 4.1)
|
126
|
+
sibu (0.4.0)
|
127
|
+
image_processing (~> 0.4)
|
128
|
+
jquery-rails (~> 4.3)
|
129
|
+
mini_magick (~> 4.3)
|
130
|
+
pg (~> 0.2)
|
131
|
+
rails (~> 5.1)
|
132
|
+
sass-rails (~> 5.0)
|
133
|
+
shrine (~> 2.8)
|
134
|
+
sprockets (3.7.2)
|
135
|
+
concurrent-ruby (~> 1.0)
|
136
|
+
rack (> 1, < 3)
|
137
|
+
sprockets-rails (3.2.1)
|
138
|
+
actionpack (>= 4.0)
|
139
|
+
activesupport (>= 4.0)
|
140
|
+
sprockets (>= 3.0.0)
|
141
|
+
thor (0.20.0)
|
142
|
+
thread_safe (0.3.6)
|
143
|
+
tilt (2.0.8)
|
144
|
+
tzinfo (1.2.5)
|
145
|
+
thread_safe (~> 0.1)
|
146
|
+
websocket-driver (0.6.5)
|
147
|
+
websocket-extensions (>= 0.1.0)
|
148
|
+
websocket-extensions (0.1.3)
|
149
|
+
|
150
|
+
PLATFORMS
|
151
|
+
ruby
|
152
|
+
|
153
|
+
DEPENDENCIES
|
154
|
+
bundler (~> 1.16)
|
155
|
+
minitest (~> 5.0)
|
156
|
+
rake (~> 10.0)
|
157
|
+
sibu_apidae!
|
158
|
+
|
159
|
+
BUNDLED WITH
|
160
|
+
1.16.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Jean-Baptiste Vilain
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# SibuApidae
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sibu_apidae`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'sibu_apidae'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install sibu_apidae
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sibu_apidae.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sibu_apidae"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/sibu_apidae.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require "sibu_apidae/version"
|
2
|
+
|
3
|
+
module SibuApidae
|
4
|
+
class ApidaeList
|
5
|
+
attr_accessor :selection_id
|
6
|
+
|
7
|
+
def initialize(init_hash)
|
8
|
+
@selection_id = init_hash["selection"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def results
|
12
|
+
if selection_id.blank?
|
13
|
+
Apidae::Selection.first.objects.limit(2).includes(:town)
|
14
|
+
else
|
15
|
+
Apidae::Selection.find_by_apidae_id(selection_id).objects.includes(:town)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class ApidaeResult
|
21
|
+
attr_accessor :obj_id
|
22
|
+
|
23
|
+
def initialize(init_hash)
|
24
|
+
@obj_id = init_hash["obj_id"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def obj
|
28
|
+
Apidae::Obj.find_by_apidae_id(obj_id) || Apidae::Obj.first
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Helper
|
33
|
+
def self.import_pages(site_id)
|
34
|
+
conf = Rails.application.config.sibu_apidae
|
35
|
+
if conf && conf.key?(:obj_path) && conf.key?(:obj_sections) && conf.key?(:supported_types)
|
36
|
+
Apidae::Obj.all.each do |obj|
|
37
|
+
if conf[:supported_types].include?(obj.apidae_type)
|
38
|
+
obj_path = Rails.application.config.sibu_apidae[:obj_path].call(obj)
|
39
|
+
obj_page = Sibu::Page.where(site_id: site_id, path: obj_path).first
|
40
|
+
unless obj_page
|
41
|
+
p = Sibu::Page.new(name: obj.title, site_id: site_id, path: obj_path)
|
42
|
+
p.sections = Rails.application.config.sibu_apidae[:obj_sections].call(obj)
|
43
|
+
p.save!
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else
|
48
|
+
puts "Please provide a valid configuration for the sibu_apidae gem (obj_path and obj_sections procs are required)"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/sibu_apidae.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "sibu_apidae/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sibu_apidae"
|
8
|
+
spec.version = SibuApidae::VERSION
|
9
|
+
spec.authors = ["Jean-Baptiste Vilain", "Chloé David"]
|
10
|
+
spec.email = ["jbvilain@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "A set of utility classes for use with the Sibu and Apidae engines"
|
13
|
+
spec.description = "A set of utility classes for use with the Sibu and Apidae engines"
|
14
|
+
spec.homepage = "http://hotentic.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
29
|
+
spec.add_dependency "apidae"
|
30
|
+
spec.add_dependency "sibu"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sibu_apidae
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jean-Baptiste Vilain
|
8
|
+
- Chloé David
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.16'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.16'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: minitest
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '5.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '5.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: apidae
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: sibu
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
description: A set of utility classes for use with the Sibu and Apidae engines
|
85
|
+
email:
|
86
|
+
- jbvilain@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- lib/sibu_apidae.rb
|
101
|
+
- lib/sibu_apidae/version.rb
|
102
|
+
- sibu_apidae.gemspec
|
103
|
+
homepage: http://hotentic.com
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.6.13
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: A set of utility classes for use with the Sibu and Apidae engines
|
127
|
+
test_files: []
|