ood_appkit 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ood_appkit/urls/editor.rb +4 -2
- data/lib/ood_appkit/urls/files.rb +7 -3
- data/lib/ood_appkit/version.rb +1 -1
- data/test/ood_appkit_test.rb +17 -0
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d163ac06cf40cc8dea949f1df6874690f96b2989e9b907e8431f628299d00d9
|
4
|
+
data.tar.gz: fcd62555677e38e455a36bc10b908062b65d3f6b127f5717eae535c229b50d29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 754d47c3c91011814f14afcbab77b59a17a78a14a62821a891ffe3ae20e5dc824acd8113fd5ae6b04f036a35975111457d0c2ec0b5ed29c7e6e01e66aba60747
|
7
|
+
data.tar.gz: 1ca2ff5da88e8576590cb5c60417d9a3cfb70d76793cd65286db415498fd46951df9c64ae97431c219ec959648c02bcf3cf150f43c677db2422755382cacc87e
|
@@ -4,7 +4,7 @@ module OodAppkit
|
|
4
4
|
class Editor < Url
|
5
5
|
# @param (see Url#initialize)
|
6
6
|
# @param edit_url [#to_s] the URL used to request the file editor api
|
7
|
-
def initialize(edit_url: '/edit', template: '{/url*}{+path}', **kwargs)
|
7
|
+
def initialize(edit_url: '/edit', template: '{/url*}{/fs}{+path}', **kwargs)
|
8
8
|
super(template: template, **kwargs)
|
9
9
|
@edit_url = parse_url_segments(edit_url.to_s)
|
10
10
|
end
|
@@ -13,13 +13,15 @@ module OodAppkit
|
|
13
13
|
# @param opts [#to_h] the available options for this method
|
14
14
|
# @option opts [#to_s, nil] :path ("") The absolute path to the file on
|
15
15
|
# the filesystem
|
16
|
+
# @option opts [#to_s, nil] :fs ("") The filesystem for the path
|
16
17
|
# @return [Addressable::URI] absolute url to access path in file editor
|
17
18
|
# api
|
18
19
|
def edit(opts = {})
|
19
20
|
opts = opts.to_h.compact.symbolize_keys
|
20
21
|
|
21
22
|
path = opts.fetch(:path, "").to_s
|
22
|
-
|
23
|
+
fs = opts.fetch(:fs, "fs").to_s
|
24
|
+
@template.expand url: @base_url + @edit_url, fs: fs, path: path
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -5,7 +5,7 @@ module OodAppkit
|
|
5
5
|
# @param (see Url#initialize)
|
6
6
|
# @param fs_url [#to_s] the URL used to request a filesystem view in the app
|
7
7
|
# @param api_url [#to_s] the URL used to request the app's api
|
8
|
-
def initialize(fs_url: '
|
8
|
+
def initialize(fs_url: '', api_url: '/api/v1', template: '{/url*}{/fs}{+path}', **kwargs)
|
9
9
|
super(template: template, **kwargs)
|
10
10
|
@fs_url = parse_url_segments(fs_url.to_s)
|
11
11
|
@api_url = parse_url_segments(api_url.to_s)
|
@@ -15,24 +15,28 @@ module OodAppkit
|
|
15
15
|
# @param opts [#to_h] the available options for this method
|
16
16
|
# @option opts [#to_s, nil] :path ("") The absolute path to the file on
|
17
17
|
# the filesystem
|
18
|
+
# @option opts [#to_s, nil] :fs ("") The filesystem for the path
|
18
19
|
# @return [Addressable::URI] absolute url to access path in file app
|
19
20
|
def url(opts = {})
|
20
21
|
opts = opts.to_h.compact.symbolize_keys
|
21
22
|
|
22
23
|
path = opts.fetch(:path, "").to_s
|
23
|
-
|
24
|
+
fs = opts.fetch(:fs, "fs").to_s
|
25
|
+
@template.expand url: @base_url + @fs_url, fs: fs, path: path
|
24
26
|
end
|
25
27
|
|
26
28
|
# URL to access this app's API for a given absolute file path
|
27
29
|
# @param opts [#to_h] the available options for this method
|
28
30
|
# @option opts [#to_s, nil] :path ("") The absolute path to the file on
|
29
31
|
# the filesystem
|
32
|
+
# @option opts [#to_s, nil] :fs ("") The filesystem for the path
|
30
33
|
# @return [Addressable::URI] absolute url to access path in files app api
|
31
34
|
def api(opts = {})
|
32
35
|
opts = opts.to_h.compact.symbolize_keys
|
33
36
|
|
34
37
|
path = opts.fetch(:path, "").to_s
|
35
|
-
|
38
|
+
fs = opts.fetch(:fs, "fs").to_s
|
39
|
+
@template.expand url: @base_url + @api_url, fs: fs, path: path
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
data/lib/ood_appkit/version.rb
CHANGED
data/test/ood_appkit_test.rb
CHANGED
@@ -23,6 +23,23 @@ class OodAppkitTest < ActiveSupport::TestCase
|
|
23
23
|
|
24
24
|
assert_equal "/f/fs/nfs/17/efranz/ood_dev", f.url(path: "/nfs/17/efranz/ood_dev").to_s
|
25
25
|
assert_equal "/f/fs/nfs/17/efranz/ood_dev", f.url(path: Pathname.new("/nfs/17/efranz/ood_dev")).to_s
|
26
|
+
|
27
|
+
assert_equal "/f/s3/mybucket/foo", f.url(path: "/mybucket/foo", fs: "s3").to_s
|
28
|
+
assert_equal "/f/s3/mybucket/foo", f.url(path: Pathname.new("/mybucket/foo"), fs: "s3").to_s
|
29
|
+
|
30
|
+
assert_equal "/f/api/v1/fs/foo/bar", f.api(path: "/foo/bar").to_s
|
31
|
+
assert_equal "/f/api/v1/s3/foo/bar", f.api(path: "/foo/bar", fs: "s3").to_s
|
32
|
+
|
33
|
+
assert_equal "/f/Remote%200.-_/foo/bar", f.url(path: "/foo/bar", fs: "Remote 0.-_").to_s
|
26
34
|
end
|
27
35
|
|
36
|
+
test "editor urls" do
|
37
|
+
e = OodAppkit::Urls::Editor.new(base_url: "/f")
|
38
|
+
|
39
|
+
assert_equal "/f/edit/fs/foo/bar", e.edit(path: "/foo/bar").to_s
|
40
|
+
assert_equal "/f/edit/fs/foo/bar", e.edit(path: Pathname.new("/foo/bar")).to_s
|
41
|
+
assert_equal "/f/edit/s3/foo/bar", e.edit(path: "/foo/bar", fs: "s3").to_s
|
42
|
+
|
43
|
+
assert_equal "/f/edit/Remote%200.-_/foo/bar", e.edit(path: "/foo/bar", fs: "Remote 0.-_").to_s
|
44
|
+
end
|
28
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ood_appkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Franz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -199,36 +199,36 @@ summary: Open OnDemand gem to help build OOD apps and interface with other OOD a
|
|
199
199
|
test_files:
|
200
200
|
- test/ood_appkit_test.rb
|
201
201
|
- test/test_helper.rb
|
202
|
-
- test/dummy/
|
202
|
+
- test/dummy/config.ru
|
203
|
+
- test/dummy/bin/rake
|
204
|
+
- test/dummy/bin/bundle
|
205
|
+
- test/dummy/bin/rails
|
206
|
+
- test/dummy/public/422.html
|
203
207
|
- test/dummy/public/500.html
|
208
|
+
- test/dummy/public/favicon.ico
|
204
209
|
- test/dummy/public/404.html
|
205
|
-
- test/dummy/
|
206
|
-
- test/dummy/
|
207
|
-
- test/dummy/config/
|
208
|
-
- test/dummy/config/
|
210
|
+
- test/dummy/README.rdoc
|
211
|
+
- test/dummy/config/locales/en.yml
|
212
|
+
- test/dummy/config/environments/test.rb
|
213
|
+
- test/dummy/config/environments/production.rb
|
214
|
+
- test/dummy/config/environments/development.rb
|
209
215
|
- test/dummy/config/database.yml
|
210
|
-
- test/dummy/config/
|
216
|
+
- test/dummy/config/application.rb
|
211
217
|
- test/dummy/config/boot.rb
|
212
|
-
- test/dummy/config/
|
213
|
-
- test/dummy/config/initializers/session_store.rb
|
214
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
218
|
+
- test/dummy/config/environment.rb
|
215
219
|
- test/dummy/config/initializers/inflections.rb
|
220
|
+
- test/dummy/config/initializers/session_store.rb
|
216
221
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
217
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
218
222
|
- test/dummy/config/initializers/secret_token.rb
|
219
|
-
- test/dummy/config/
|
220
|
-
- test/dummy/config/
|
221
|
-
- test/dummy/config/
|
222
|
-
- test/dummy/config/
|
223
|
-
- test/dummy/bin/rails
|
224
|
-
- test/dummy/bin/rake
|
225
|
-
- test/dummy/bin/bundle
|
223
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
224
|
+
- test/dummy/config/initializers/mime_types.rb
|
225
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
226
|
+
- test/dummy/config/routes.rb
|
226
227
|
- test/dummy/app/helpers/application_helper.rb
|
228
|
+
- test/dummy/app/views/layouts/application.html.erb
|
229
|
+
- test/dummy/app/controllers/application_controller.rb
|
230
|
+
- test/dummy/app/assets/stylesheets/application.css
|
227
231
|
- test/dummy/app/assets/config/manifest.js
|
228
232
|
- test/dummy/app/assets/javascripts/application.js
|
229
|
-
- test/dummy/
|
230
|
-
- test/dummy/app/controllers/application_controller.rb
|
231
|
-
- test/dummy/app/views/layouts/application.html.erb
|
232
|
-
- test/dummy/config.ru
|
233
|
-
- test/dummy/README.rdoc
|
233
|
+
- test/dummy/Rakefile
|
234
234
|
- test/integration/navigation_test.rb
|