wfs_rails 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 93afc7ee2ee310809ee14375f509e17c06a6275c
4
- data.tar.gz: f05aeecd99a271c420411e757a72847a676efba1
2
+ SHA256:
3
+ metadata.gz: d0e773620a0175206c1408629e9faddc261cc0ebe6d3c50e6ce3db989b555850
4
+ data.tar.gz: 748531162b2d00125b45e79b77b273793843397ca385ebd8695c13a4b2d0cbdd
5
5
  SHA512:
6
- metadata.gz: 427f2847a024de186edb0560f20e54bb3daddba565426f5219400abaabbaceb37ccf46c2d050e86e79813cbbd07e61dbb27940001f9a4893219e8f9a70107f68
7
- data.tar.gz: 0223b5dbe3a5e8f17f3b833230007e70b1b358e895427574a788adbc5e2983b16cf5c6635b1d7003358b4b3b3c61d9d7a4ded7ba0688a1a3dee1ae149bf42c48
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
- A Rails engine for testing/using Stanford WorkFlowServices
4
+ WFS Rails is a Rails engine for testing and development with Stanford's DOR Worklow Services.
5
5
 
6
- See `config/routes.rb` for implemented routes
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
- EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
18
+ ENV['ENGINE_CART_RAILS_OPTIONS'] = '--api'
19
19
 
20
20
  desc 'Run test suite'
21
21
  task ci: ['wfs_rails:generate'] do
@@ -1,4 +1,4 @@
1
1
  module WfsRails
2
- class ApplicationController < ActionController::Base
2
+ class ApplicationController < ActionController::API
3
3
  end
4
4
  end
@@ -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 workflows
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 workflows_by_datastream
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 :workflows
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
@@ -1,20 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  WfsRails::Engine.routes.draw do
2
- get '/:repo/objects/:druid/lifecycle',
3
- to: 'workflow#lifecycle',
4
- constraints: { druid: %r{[^\/]+} },
5
- defaults: { format: :xml }
6
- get '/:repo/objects/:druid/workflows',
7
- to: 'workflow#workflows',
8
- constraints: { druid: %r{[^\/]+} },
9
- defaults: { format: :xml }
10
- get '/:repo/objects/:druid/workflows/:workflow',
11
- to: 'workflow#workflows_by_datastream',
12
- constraints: { druid: %r{[^\/]+} },
13
- defaults: { format: :xml }
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{[^\/]+} },
@@ -5,9 +5,5 @@ module WfsRails
5
5
  mount WfsRails::Engine => '/'
6
6
  EOF
7
7
  end
8
-
9
- def install_migrations
10
- rake('wfs_rails:install:migrations')
11
- end
12
8
  end
13
9
  end
@@ -2,6 +2,7 @@ module WfsRails
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace WfsRails
4
4
 
5
+ require 'jbuilder'
5
6
  require 'wfs_rails/workflow_parser'
6
7
  require 'wfs_rails/process_parser'
7
8
 
@@ -1,3 +1,3 @@
1
1
  module WfsRails
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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: 2017-08-02 00:00:00.000000000 Z
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: '1.0'
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: '1.0'
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.5.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.