ood_appkit 2.1.0 → 2.1.4
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 +29 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec0ba73ed6fe4e22e0fec2ee9b517bbf6c6936901b3fa551d749bdbd37f41750
|
4
|
+
data.tar.gz: b886c68b390e7778a202a170ee6c91b3c14e634d503e0fd29819783ea3eeb0b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81ff7cd9661603e2c5061653de406f7570cdc3ee3c476b6de52b161c541900b738d6064478758a50b997331adb8a5adef2e09aaf10775296144e639f26741214
|
7
|
+
data.tar.gz: 51241e4dabb81e0695135bf7fd7dbebb0c4994a481dbfefc0e61fa61d61079d3b3324bca756520d60087ae4ce9798d883e162dea97f3f314760f2ec36a912a15
|
@@ -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.4
|
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: 2024-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,9 +18,6 @@ dependencies:
|
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 6.0.0
|
21
|
-
- - "<"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '7'
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,9 +25,6 @@ dependencies:
|
|
28
25
|
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 6.0.0
|
31
|
-
- - "<"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '7'
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: ood_core
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,43 +186,43 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
186
|
- !ruby/object:Gem::Version
|
193
187
|
version: '0'
|
194
188
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
189
|
+
rubygems_version: 3.3.26
|
196
190
|
signing_key:
|
197
191
|
specification_version: 4
|
198
192
|
summary: Open OnDemand gem to help build OOD apps and interface with other OOD apps.
|
199
193
|
test_files:
|
200
|
-
- test/
|
201
|
-
- test/test_helper.rb
|
202
|
-
- test/dummy/public/favicon.ico
|
203
|
-
- test/dummy/public/500.html
|
204
|
-
- test/dummy/public/404.html
|
205
|
-
- test/dummy/public/422.html
|
194
|
+
- test/dummy/README.rdoc
|
206
195
|
- test/dummy/Rakefile
|
196
|
+
- test/dummy/app/assets/config/manifest.js
|
197
|
+
- test/dummy/app/assets/javascripts/application.js
|
198
|
+
- test/dummy/app/assets/stylesheets/application.css
|
199
|
+
- test/dummy/app/controllers/application_controller.rb
|
200
|
+
- test/dummy/app/helpers/application_helper.rb
|
201
|
+
- test/dummy/app/views/layouts/application.html.erb
|
202
|
+
- test/dummy/bin/bundle
|
203
|
+
- test/dummy/bin/rails
|
204
|
+
- test/dummy/bin/rake
|
207
205
|
- test/dummy/config/application.rb
|
208
|
-
- test/dummy/config/environment.rb
|
209
|
-
- test/dummy/config/database.yml
|
210
|
-
- test/dummy/config/routes.rb
|
211
206
|
- test/dummy/config/boot.rb
|
212
|
-
- test/dummy/config/
|
213
|
-
- test/dummy/config/
|
207
|
+
- test/dummy/config/database.yml
|
208
|
+
- test/dummy/config/environment.rb
|
209
|
+
- test/dummy/config/environments/development.rb
|
210
|
+
- test/dummy/config/environments/production.rb
|
211
|
+
- test/dummy/config/environments/test.rb
|
212
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
214
213
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
215
214
|
- test/dummy/config/initializers/inflections.rb
|
216
|
-
- test/dummy/config/initializers/
|
217
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
215
|
+
- test/dummy/config/initializers/mime_types.rb
|
218
216
|
- test/dummy/config/initializers/secret_token.rb
|
219
|
-
- test/dummy/config/
|
220
|
-
- test/dummy/config/
|
221
|
-
- test/dummy/config/environments/production.rb
|
217
|
+
- test/dummy/config/initializers/session_store.rb
|
218
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
222
219
|
- test/dummy/config/locales/en.yml
|
223
|
-
- test/dummy/
|
224
|
-
- test/dummy/bin/rake
|
225
|
-
- test/dummy/bin/bundle
|
226
|
-
- test/dummy/app/helpers/application_helper.rb
|
227
|
-
- test/dummy/app/assets/config/manifest.js
|
228
|
-
- test/dummy/app/assets/javascripts/application.js
|
229
|
-
- test/dummy/app/assets/stylesheets/application.css
|
230
|
-
- test/dummy/app/controllers/application_controller.rb
|
231
|
-
- test/dummy/app/views/layouts/application.html.erb
|
220
|
+
- test/dummy/config/routes.rb
|
232
221
|
- test/dummy/config.ru
|
233
|
-
- test/dummy/
|
222
|
+
- test/dummy/public/404.html
|
223
|
+
- test/dummy/public/422.html
|
224
|
+
- test/dummy/public/500.html
|
225
|
+
- test/dummy/public/favicon.ico
|
234
226
|
- test/integration/navigation_test.rb
|
227
|
+
- test/ood_appkit_test.rb
|
228
|
+
- test/test_helper.rb
|