wfs_rails 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +36 -2
- data/Rakefile +1 -1
- data/app/controllers/wfs_rails/application_controller.rb +1 -1
- data/app/controllers/wfs_rails/workflow_controller.rb +30 -3
- data/app/views/wfs_rails/workflow/{workflows.xml.builder → index.xml.builder} +0 -0
- data/config/routes.rb +14 -16
- data/lib/generators/wfs_rails/install_generator.rb +0 -4
- data/lib/wfs_rails/engine.rb +1 -0
- data/lib/wfs_rails/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d0e773620a0175206c1408629e9faddc261cc0ebe6d3c50e6ce3db989b555850
|
4
|
+
data.tar.gz: 748531162b2d00125b45e79b77b273793843397ca385ebd8695c13a4b2d0cbdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71d3c82b9fa1f0a940ec4a0729613e6a942647b8edb849c943696815bece1c6f2987d87a4de4487a8e884818a59073c53dcef9eae3c4052aa1180f1674dabaf5
|
7
|
+
data.tar.gz: 3a38697aea8fc9f50c33f0096eb63ab2ae7aacb2215e95a237977ec64f0ae4be5f4576de7df8b6c13bedb0fd35cb1c30a634ee57766ab1a7756d095f98aceb35
|
data/README.md
CHANGED
@@ -1,7 +1,41 @@
|
|
1
1
|
## WFS Rails
|
2
2
|
[![Build Status](https://travis-ci.org/sul-dlss/wfs_rails.svg)](https://travis-ci.org/sul-dlss/wfs_rails)
|
3
3
|
|
4
|
-
|
4
|
+
WFS Rails is a Rails engine for testing and development with Stanford's DOR Worklow Services.
|
5
5
|
|
6
|
-
|
6
|
+
The Rails engine stubs several of the most frequently
|
7
|
+
used Workflow Services routes (but not all of them). See `config/routes.rb` for implemented routes.
|
7
8
|
|
9
|
+
### Installing
|
10
|
+
Add to `Gemfile`
|
11
|
+
```ruby
|
12
|
+
gem 'wfs_rails'
|
13
|
+
```
|
14
|
+
Then `bundle install`
|
15
|
+
|
16
|
+
Next add this to `config/routes.rb`:
|
17
|
+
```ruby
|
18
|
+
Rails.application.routes.draw do
|
19
|
+
mount WfsRails::Engine => '/'
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
Finally run:
|
24
|
+
```
|
25
|
+
rake wfs_rails:install:migrations
|
26
|
+
```
|
27
|
+
|
28
|
+
|
29
|
+
### Alternative install
|
30
|
+
You may choose to use
|
31
|
+
[Capybara::Discoball](https://github.com/thoughtbot/capybara_discoball) which
|
32
|
+
expects to use your application's Rails database as storage for Workflow Service data. The advantage of using WFS Rails is that you don't need
|
33
|
+
to access any external Workflow APIs during development or testing (this is especially useful when building on Travis).
|
34
|
+
|
35
|
+
To set up and use WFS Rails in your project, take a look at this Argo pull request:
|
36
|
+
|
37
|
+
https://github.com/sul-dlss/argo/pull/317/files
|
38
|
+
|
39
|
+
Or this stanalone server:
|
40
|
+
|
41
|
+
https://github.com/sul-dlss-labs/workflow-server-rails/
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ RSpec::Core::RakeTask.new(:spec) do |t|
|
|
15
15
|
t.pattern = 'spec/**/*_spec.rb'
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--api'
|
19
19
|
|
20
20
|
desc 'Run test suite'
|
21
21
|
task ci: ['wfs_rails:generate'] do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WfsRails
|
2
4
|
##
|
3
5
|
# API for handling workflow request. Implemented as an isolated Rails::Engine
|
@@ -10,19 +12,44 @@ module WfsRails
|
|
10
12
|
)
|
11
13
|
end
|
12
14
|
|
13
|
-
def
|
15
|
+
def index
|
14
16
|
@processes = Workflow.where(
|
15
17
|
repository: params[:repo], druid: params[:druid]
|
16
18
|
).order(:datastream, created_at: :asc).group_by(&:datastream)
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
21
|
+
def show
|
20
22
|
@processes = Workflow.where(
|
21
23
|
repository: params[:repo],
|
22
24
|
druid: params[:druid],
|
23
25
|
datastream: params[:workflow]
|
24
26
|
).order(:datastream, created_at: :asc).group_by(&:datastream)
|
25
|
-
render :
|
27
|
+
render :index
|
28
|
+
end
|
29
|
+
|
30
|
+
def update
|
31
|
+
@process = Workflow.find_by!(
|
32
|
+
repository: params[:repo],
|
33
|
+
druid: params[:druid],
|
34
|
+
datastream: params[:workflow],
|
35
|
+
process: params[:process]
|
36
|
+
)
|
37
|
+
|
38
|
+
if params['current-status'].present?
|
39
|
+
@process.update(status: params['current-status'])
|
40
|
+
else
|
41
|
+
@process.update(status: 'completed')
|
42
|
+
end
|
43
|
+
head :no_content
|
44
|
+
end
|
45
|
+
|
46
|
+
def destroy
|
47
|
+
@processes = Workflow.where(
|
48
|
+
repository: params[:repo],
|
49
|
+
druid: params[:druid],
|
50
|
+
datastream: params[:workflow]
|
51
|
+
).destroy_all
|
52
|
+
head :no_content
|
26
53
|
end
|
27
54
|
|
28
55
|
def archive
|
File without changes
|
data/config/routes.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
WfsRails::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
put '/:repo/objects/:druid/workflows/:workflow',
|
15
|
-
to: 'workflow#create',
|
16
|
-
constraints: { druid: %r{[^\/]+} },
|
17
|
-
defaults: { format: :xml }
|
4
|
+
scope ':repo/objects/:druid', constraints: { druid: %r{[^\/]+} }, defaults: { format: :xml } do
|
5
|
+
get 'lifecycle', to: 'workflow#lifecycle'
|
6
|
+
|
7
|
+
resources :workflows, only: %i[show index destroy], controller: 'workflow', param: :workflow do
|
8
|
+
collection do
|
9
|
+
# Create should be a POST, but this is what the Java WFS app did.
|
10
|
+
put ':workflow', to: 'workflow#create'
|
11
|
+
put ':workflow/:process', to: 'workflow#update'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
18
16
|
get '/workflow_archive',
|
19
17
|
to: 'workflow#archive',
|
20
18
|
constraints: { druid: %r{[^\/]+} },
|
data/lib/wfs_rails/engine.rb
CHANGED
data/lib/wfs_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wfs_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Reed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jbuilder
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.7'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: sqlite3
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +58,14 @@ dependencies:
|
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '2.0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '2.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec-rails
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,8 +127,8 @@ files:
|
|
113
127
|
- app/views/layouts/wfs_rails/application.html.erb
|
114
128
|
- app/views/wfs_rails/workflow/archive.xml.builder
|
115
129
|
- app/views/wfs_rails/workflow/create.xml.builder
|
130
|
+
- app/views/wfs_rails/workflow/index.xml.builder
|
116
131
|
- app/views/wfs_rails/workflow/lifecycle.xml.builder
|
117
|
-
- app/views/wfs_rails/workflow/workflows.xml.builder
|
118
132
|
- config/routes.rb
|
119
133
|
- db/migrate/20151112054510_create_wfs_rails_workflows.rb
|
120
134
|
- lib/generators/wfs_rails/install_generator.rb
|
@@ -144,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
158
|
version: '0'
|
145
159
|
requirements: []
|
146
160
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.7.6
|
148
162
|
signing_key:
|
149
163
|
specification_version: 4
|
150
164
|
summary: A Rails engine for using/testing Stanford Libraries Workflow Services.
|