Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 76d95aa

Browse files
committed
NS catalogue. Initial commit
1 parent 6a6a523 commit 76d95aa

37 files changed

+3205
-0
lines changed

ns-catalogue/.rvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rvm use --create ruby-2.1.5@orchestrator_ns-catalogue

ns-catalogue/.yardoc/checksums

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
main.rb 1107e7aee9dd61f9424f5d32d24bd815fd7c32da
2+
helpers/ns.rb e439b8e2d1c6804d0c4de418f20eb28d36e9f8cd
3+
routes/ns.rb d734bd5768d505da7579315ea50929bbe1fd2961

ns-catalogue/.yardoc/object_types

339 Bytes
Binary file not shown.
7.97 KB
Binary file not shown.

ns-catalogue/.yardoc/proxy_types

4 Bytes
Binary file not shown.

ns-catalogue/Gemfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'sinatra', '~>1.4'
4+
gem 'thin', '~>1.6'
5+
gem 'json', '~>1.8'
6+
gem 'sinatra-contrib', '~>1.4'
7+
gem 'nokogiri', '~>1.6'
8+
gem 'json-schema', '~>2.5'
9+
gem 'rest-client', '~>1.8'
10+
gem 'logstash-logger'
11+
12+
group :development, :test do
13+
gem 'rerun'
14+
gem 'rspec'
15+
gem 'rack-test'
16+
gem 'database_cleaner'
17+
gem 'factory_girl'
18+
end
19+
20+
group :doc do
21+
gem 'yard', '~>0.8'
22+
end
23+
24+
# Database
25+
gem 'mongoid', '~>4.0' # MongoDB driver
26+
gem 'mongoid-pagination', '~>0.2' # Pagination library
27+
28+
gem 'sinatra-gkauth', '~>0.2.0', path: '../sinatra-gkauth-gem'

ns-catalogue/Gemfile.lock

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
PATH
2+
remote: ../sinatra-gkauth-gem
3+
specs:
4+
sinatra-gkauth (0.2.0)
5+
sinatra (~> 1.4)
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
activemodel (4.2.5)
11+
activesupport (= 4.2.5)
12+
builder (~> 3.1)
13+
activesupport (4.2.5)
14+
i18n (~> 0.7)
15+
json (~> 1.7, >= 1.7.7)
16+
minitest (~> 5.1)
17+
thread_safe (~> 0.3, >= 0.3.4)
18+
tzinfo (~> 1.1)
19+
addressable (2.3.8)
20+
backports (3.6.7)
21+
bson (3.2.6)
22+
builder (3.2.2)
23+
connection_pool (2.2.0)
24+
daemons (1.2.3)
25+
database_cleaner (1.5.1)
26+
diff-lcs (1.2.5)
27+
domain_name (0.5.25)
28+
unf (>= 0.0.5, < 1.0.0)
29+
eventmachine (1.0.9.1)
30+
factory_girl (4.5.0)
31+
activesupport (>= 3.0.0)
32+
ffi (1.9.10)
33+
http-cookie (1.0.2)
34+
domain_name (~> 0.5)
35+
i18n (0.7.0)
36+
json (1.8.3)
37+
json-schema (2.6.0)
38+
addressable (~> 2.3.8)
39+
listen (3.0.5)
40+
rb-fsevent (>= 0.9.3)
41+
rb-inotify (>= 0.9)
42+
logstash-event (1.2.02)
43+
logstash-logger (0.15.2)
44+
logstash-event (~> 1.2)
45+
stud
46+
mime-types (2.99)
47+
mini_portile2 (2.0.0)
48+
minitest (5.8.3)
49+
mongoid (4.0.2)
50+
activemodel (~> 4.0)
51+
moped (~> 2.0.0)
52+
origin (~> 2.1)
53+
tzinfo (>= 0.3.37)
54+
mongoid-pagination (0.2.0)
55+
activesupport
56+
mongoid
57+
moped (2.0.7)
58+
bson (~> 3.0)
59+
connection_pool (~> 2.0)
60+
optionable (~> 0.2.0)
61+
multi_json (1.11.2)
62+
netrc (0.11.0)
63+
nokogiri (1.6.7.1)
64+
mini_portile2 (~> 2.0.0.rc2)
65+
optionable (0.2.0)
66+
origin (2.1.1)
67+
rack (1.6.4)
68+
rack-protection (1.5.3)
69+
rack
70+
rack-test (0.6.3)
71+
rack (>= 1.0)
72+
rb-fsevent (0.9.7)
73+
rb-inotify (0.9.5)
74+
ffi (>= 0.5.0)
75+
rerun (0.11.0)
76+
listen (~> 3.0)
77+
rest-client (1.8.0)
78+
http-cookie (>= 1.0.2, < 2.0)
79+
mime-types (>= 1.16, < 3.0)
80+
netrc (~> 0.7)
81+
rspec (3.4.0)
82+
rspec-core (~> 3.4.0)
83+
rspec-expectations (~> 3.4.0)
84+
rspec-mocks (~> 3.4.0)
85+
rspec-core (3.4.1)
86+
rspec-support (~> 3.4.0)
87+
rspec-expectations (3.4.0)
88+
diff-lcs (>= 1.2.0, < 2.0)
89+
rspec-support (~> 3.4.0)
90+
rspec-mocks (3.4.1)
91+
diff-lcs (>= 1.2.0, < 2.0)
92+
rspec-support (~> 3.4.0)
93+
rspec-support (3.4.1)
94+
sinatra (1.4.6)
95+
rack (~> 1.4)
96+
rack-protection (~> 1.4)
97+
tilt (>= 1.3, < 3)
98+
sinatra-contrib (1.4.6)
99+
backports (>= 2.0)
100+
multi_json
101+
rack-protection
102+
rack-test
103+
sinatra (~> 1.4.0)
104+
tilt (>= 1.3, < 3)
105+
stud (0.0.22)
106+
thin (1.6.4)
107+
daemons (~> 1.0, >= 1.0.9)
108+
eventmachine (~> 1.0, >= 1.0.4)
109+
rack (~> 1.0)
110+
thread_safe (0.3.5)
111+
tilt (2.0.2)
112+
tzinfo (1.2.2)
113+
thread_safe (~> 0.1)
114+
unf (0.1.4)
115+
unf_ext
116+
unf_ext (0.0.7.1)
117+
yard (0.8.7.6)
118+
119+
PLATFORMS
120+
ruby
121+
122+
DEPENDENCIES
123+
database_cleaner
124+
factory_girl
125+
json (~> 1.8)
126+
json-schema (~> 2.5)
127+
logstash-logger
128+
mongoid (~> 4.0)
129+
mongoid-pagination (~> 0.2)
130+
nokogiri (~> 1.6)
131+
rack-test
132+
rerun
133+
rest-client (~> 1.8)
134+
rspec
135+
sinatra (~> 1.4)
136+
sinatra-contrib (~> 1.4)
137+
sinatra-gkauth (~> 0.2.0)!
138+
thin (~> 1.6)
139+
yard (~> 0.8)

ns-catalogue/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# T-NOVA WP3
2+
3+
## Orchestrator NS Catalogue
4+
5+
### Requirements
6+
7+
This code has been run on Ruby 2.1.
8+
9+
### Gems used
10+
11+
* [Sinatra](http://www.sinatrarb.com/) - Ruby framework
12+
* [Thin](https://github.com/macournoyer/thin/) - Web server
13+
* [json](https://github.com/flori/json) - JSON specification
14+
* [sinatra-contrib](https://github.com/sinatra/sinatra-contrib) - Sinatra extensions
15+
* [Nokogiri](https://github.com/sparklemotion/nokogiri) - XML parser
16+
* [JSON-schema](https://github.com/ruby-json-schema/json-schema) - JSON schema validator
17+
* [Rest-client](https://github.com/rest-client/rest-client) - HTTP and REST client
18+
* [Yard](https://github.com/lsegal/yard) - Documentation generator tool
19+
* [rerun](https://github.com/alexch/rerun) - Restarts the app when a file changes (used in development environment)
20+
21+
### Installation
22+
23+
After you cloned the source from the repository, you can run
24+
25+
```sh
26+
bundle install
27+
```
28+
29+
Which will install all the gems.
30+
31+
### Tests
32+
33+
TODO
34+
35+
### API Documentation
36+
37+
The API is documented with yardoc and can be built with a rake task:
38+
39+
```sh
40+
rake yard
41+
```
42+
43+
from here you can use the yard server to browse the docs from the source root:
44+
45+
```sh
46+
yard server
47+
```
48+
49+
and they can be viewed from http://localhost:8808/
50+
51+
### Run Server
52+
53+
The following shows how to start the API server:
54+
55+
```sh
56+
rake start
57+
```

ns-catalogue/Rakefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'yard'
2+
require 'rspec/core/rake_task'
3+
4+
RSpec::Core::RakeTask.new :specs do |task|
5+
task.pattern = Dir['spec/*_spec.rb']
6+
end
7+
8+
task :default => ['specs']
9+
10+
desc 'Start the service'
11+
task :start do
12+
conf = File.expand_path('config.ru', File.dirname(__FILE__))
13+
conf2 = File.expand_path('config/config.yml', File.dirname(__FILE__))
14+
exec("thin -C #{conf2} -R #{conf} --debug start")
15+
end
16+
17+
YARD::Rake::YardocTask.new do |t|
18+
t.files = ['main.rb', 'helpers/ns.rb', 'routes/ns.rb']
19+
end
20+
21+
namespace :db do
22+
task :load_config do
23+
require './main'
24+
end
25+
end

ns-catalogue/config.ru

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = ::File.dirname(__FILE__)
2+
require ::File.join(root, 'main')
3+
require 'sinatra/gk_auth'
4+
5+
run OrchestratorNsCatalogue.new

0 commit comments

Comments
 (0)