mangabey 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 +37 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +58 -0
- data/LICENSE +21 -0
- data/README.md +4 -0
- data/Rakefile +44 -0
- data/bin/mangabey +4 -0
- data/lib/mangabey/server.rb +62 -0
- data/lib/mangabey/version.rb +3 -0
- data/lib/mangabey/views/index.erb +1 -0
- data/lib/mangabey.rb +2 -0
- data/mangabey.gemspec +28 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 27afacb6c68779bc4881e536cecf6a937402daf6
|
4
|
+
data.tar.gz: 24242aac2d4ea90f437ea465a4181dc6b86524c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 068fa5d155fd548c92b48a3b8631b1084408e31d1482b35217999b9790be1e6123e715442988d3b79bd5daf0442584590445672c08ff95a1e75f774fa7344869
|
7
|
+
data.tar.gz: 3e1490f3695f58d0309ec01656c149b3245b402ca9b0f0e3dde27436ae726c79aab33e07f660f5cc784e5da1be50fa20d3745919e174197a3e6e52c501358fb4
|
data/.gitignore
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.idea
|
4
|
+
*.htm
|
5
|
+
*.html
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
## Specific to RubyMotion:
|
16
|
+
.dat*
|
17
|
+
.repl_history
|
18
|
+
build/
|
19
|
+
|
20
|
+
## Documentation cache and generated files:
|
21
|
+
/.yardoc/
|
22
|
+
/_yardoc/
|
23
|
+
/doc/
|
24
|
+
/rdoc/
|
25
|
+
|
26
|
+
## Environment normalisation:
|
27
|
+
/.bundle/
|
28
|
+
/lib/bundler/man/
|
29
|
+
|
30
|
+
# for a library or gem, you might want to ignore these files since the code is
|
31
|
+
# intended to run in multiple environments; otherwise, check them in:
|
32
|
+
# Gemfile.lock
|
33
|
+
# .ruby-version
|
34
|
+
# .ruby-gemset
|
35
|
+
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
+
.rvmrc
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
mangabey
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.1
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mangabey (0.0.1)
|
5
|
+
nfsadmin (= 0.0.3)
|
6
|
+
sinatra (= 1.4.5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
aruba (0.5.4)
|
12
|
+
childprocess (>= 0.3.6)
|
13
|
+
cucumber (>= 1.1.1)
|
14
|
+
rspec-expectations (>= 2.7.0)
|
15
|
+
builder (3.2.2)
|
16
|
+
childprocess (0.5.2)
|
17
|
+
ffi (~> 1.0, >= 1.0.11)
|
18
|
+
cucumber (1.3.14)
|
19
|
+
builder (>= 2.1.2)
|
20
|
+
diff-lcs (>= 1.1.3)
|
21
|
+
gherkin (~> 2.12)
|
22
|
+
multi_json (>= 1.7.5, < 2.0)
|
23
|
+
multi_test (>= 0.1.1)
|
24
|
+
diff-lcs (1.2.5)
|
25
|
+
ffi (1.9.3)
|
26
|
+
gherkin (2.12.2)
|
27
|
+
multi_json (~> 1.3)
|
28
|
+
gli (2.9.0)
|
29
|
+
json (1.8.1)
|
30
|
+
multi_json (1.9.2)
|
31
|
+
multi_test (0.1.1)
|
32
|
+
nfsadmin (0.0.3)
|
33
|
+
gli (~> 2.9)
|
34
|
+
rack (1.5.2)
|
35
|
+
rack-protection (1.5.3)
|
36
|
+
rack
|
37
|
+
rake (10.2.2)
|
38
|
+
rdoc (4.1.1)
|
39
|
+
json (~> 1.4)
|
40
|
+
rspec-expectations (2.14.5)
|
41
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
42
|
+
shotgun (0.9)
|
43
|
+
rack (>= 1.0)
|
44
|
+
sinatra (1.4.5)
|
45
|
+
rack (~> 1.4)
|
46
|
+
rack-protection (~> 1.4)
|
47
|
+
tilt (~> 1.3, >= 1.3.4)
|
48
|
+
tilt (1.4.1)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
aruba (~> 0.5)
|
55
|
+
mangabey!
|
56
|
+
rake (~> 10.2)
|
57
|
+
rdoc (~> 4.1)
|
58
|
+
shotgun (= 0.9)
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Bastiaan Schaap
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('mangabey.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/mangabey
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'nfsadmin'
|
2
|
+
require 'sinatra'
|
3
|
+
require 'json'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
module Mangabey
|
7
|
+
|
8
|
+
class Server < Sinatra::Base
|
9
|
+
|
10
|
+
exportsfile = '/etc/exports'
|
11
|
+
|
12
|
+
set :static, true
|
13
|
+
set :public, File.dirname(__FILE__) + '/static'
|
14
|
+
|
15
|
+
get '/' do
|
16
|
+
erb :index
|
17
|
+
end
|
18
|
+
|
19
|
+
get '/exports' do
|
20
|
+
puts 'Getting all shares'
|
21
|
+
content_type :json
|
22
|
+
({ :exports => Nfsadmin::Tasks.get_shares(exportsfile)}).to_json
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/exports/*' do
|
26
|
+
puts "Finding share: /#{params[:splat][0]}"
|
27
|
+
content_type :json
|
28
|
+
Nfsadmin::Tasks.get_share(exportsfile, "/#{params[:splat][0]}").to_json
|
29
|
+
end
|
30
|
+
|
31
|
+
post '/exports/*' do
|
32
|
+
begin
|
33
|
+
request.body.rewind
|
34
|
+
@request_payload = JSON.parse request.body.read
|
35
|
+
rescue
|
36
|
+
fail 'Must POST a valid JSON document'
|
37
|
+
end
|
38
|
+
location = '/' + params[:splat][0]
|
39
|
+
acl = @request_payload['acl']
|
40
|
+
# Bug in nfsadmin for now: only 1 address+option combo allowed..
|
41
|
+
address = acl[0]['address']
|
42
|
+
options = acl[0]['options']
|
43
|
+
puts "Creating new share: #{location} with options: #{address}(#{options})"
|
44
|
+
Nfsadmin::Tasks.create_share(exportsfile,location,address,options,true)
|
45
|
+
Nfsadmin::Tasks.reload_config
|
46
|
+
end
|
47
|
+
|
48
|
+
delete '/exports/*' do
|
49
|
+
content_type :json
|
50
|
+
location = '/' + params[:splat][0]
|
51
|
+
puts "Deleting share: #{location}"
|
52
|
+
begin
|
53
|
+
Nfsadmin::Tasks.delete_share(exportsfile,location)
|
54
|
+
Nfsadmin::Tasks.reload_config
|
55
|
+
'{ "result": "true" }'
|
56
|
+
rescue
|
57
|
+
'{ "result": "false" }'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Welcome to Mangabey!</h1>
|
data/lib/mangabey.rb
ADDED
data/mangabey.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','mangabey','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'mangabey'
|
5
|
+
s.version = Mangabey::VERSION
|
6
|
+
s.author = 'Bastiaan Schaap'
|
7
|
+
s.email = 'b.schaap@siteminds.nl'
|
8
|
+
s.homepage = 'https://github.com/bjwschaap/mangabey'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'Mangabey is a RESTful web API for using nfsadmin'
|
11
|
+
s.description = <<eos
|
12
|
+
This is a Sinatra RESTful web application that wraps the nfsadmin tool.
|
13
|
+
It can be used to manage NFS using REST and JSON.
|
14
|
+
eos
|
15
|
+
s.license = 'MIT'
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.require_paths << 'lib'
|
18
|
+
s.has_rdoc = false
|
19
|
+
s.bindir = 'bin'
|
20
|
+
s.executables << 'mangabey'
|
21
|
+
s.required_ruby_version = '~> 2.0'
|
22
|
+
s.add_development_dependency('rake', '~> 10.2' )
|
23
|
+
s.add_development_dependency('rdoc', '~> 4.1')
|
24
|
+
s.add_development_dependency('aruba', '~> 0.5')
|
25
|
+
s.add_development_dependency('shotgun', '0.9')
|
26
|
+
s.add_runtime_dependency('sinatra','1.4.5')
|
27
|
+
s.add_runtime_dependency('nfsadmin', '0.0.3')
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mangabey
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bastiaan Schaap
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.2'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aruba
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: shotgun
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sinatra
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.4.5
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.4.5
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: nfsadmin
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.0.3
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.0.3
|
97
|
+
description: |2
|
98
|
+
This is a Sinatra RESTful web application that wraps the nfsadmin tool.
|
99
|
+
It can be used to manage NFS using REST and JSON.
|
100
|
+
email: b.schaap@siteminds.nl
|
101
|
+
executables:
|
102
|
+
- mangabey
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".ruby-gemset"
|
108
|
+
- ".ruby-version"
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- LICENSE
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- bin/mangabey
|
115
|
+
- lib/mangabey.rb
|
116
|
+
- lib/mangabey/server.rb
|
117
|
+
- lib/mangabey/version.rb
|
118
|
+
- lib/mangabey/views/index.erb
|
119
|
+
- mangabey.gemspec
|
120
|
+
homepage: https://github.com/bjwschaap/mangabey
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '2.0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.2.2
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: Mangabey is a RESTful web API for using nfsadmin
|
145
|
+
test_files: []
|