simple_workflow 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34764766cd7d35296cbe668b7df03b65e6b11ae0
4
- data.tar.gz: a135546d9b83704629e4d06955bf6fb97e425081
3
+ metadata.gz: d94b34544bfeb887a7841e639e48ead3908481df
4
+ data.tar.gz: dc481672d0f1bc31194b47ce6cf19c25162b21f3
5
5
  SHA512:
6
- metadata.gz: 1a7bc40e9e2dcaf541afd46dea3bd54940b5df7d82c213bf79036e6f810400e7c620f4f2c7ccb0517f901c5e505db34b86875df28434f1d01be03b9121581a98
7
- data.tar.gz: 9679cacbb10437142bdecbdd0c679ede1c218e6bee9d2ec142255f7e07e5494e8e8226d31fc93710c7af26034d891223f2276befb873c183f9c42f43043603c7
6
+ metadata.gz: 81301edfffd59d77826db957d1acf1a6f800b340ca0e060b12fadc3131336ebc0d71853ae982538285850427a777353e1b47d29c35e6dea6faba00978aa135e3
7
+ data.tar.gz: 2f38954db7d69ff1418f9001f7e7f838b13e56ef31b7987853d074854334e6418be21dd528b20c57dee6a29eb3e46de6a778cd3e520266c8bd34409744a6b59e
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org/'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,114 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ simple_workflow (1.0.7)
5
+ rails (~> 4.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.0)
11
+ actionpack (= 4.2.0)
12
+ actionview (= 4.2.0)
13
+ activejob (= 4.2.0)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.0)
17
+ actionview (= 4.2.0)
18
+ activesupport (= 4.2.0)
19
+ rack (~> 1.6.0)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
23
+ actionview (4.2.0)
24
+ activesupport (= 4.2.0)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
29
+ activejob (4.2.0)
30
+ activesupport (= 4.2.0)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.0)
33
+ activesupport (= 4.2.0)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.0)
36
+ activemodel (= 4.2.0)
37
+ activesupport (= 4.2.0)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.0)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ arel (6.0.0)
46
+ builder (3.2.2)
47
+ erubis (2.7.0)
48
+ globalid (0.3.0)
49
+ activesupport (>= 4.1.0)
50
+ hike (1.2.3)
51
+ i18n (0.7.0)
52
+ json (1.8.1)
53
+ json (1.8.1-java)
54
+ loofah (2.0.1)
55
+ nokogiri (>= 1.5.9)
56
+ mail (2.6.3)
57
+ mime-types (>= 1.16, < 3)
58
+ mime-types (2.4.3)
59
+ mini_portile (0.6.2)
60
+ minitest (5.5.0)
61
+ multi_json (1.10.1)
62
+ nokogiri (1.6.5)
63
+ mini_portile (~> 0.6.0)
64
+ nokogiri (1.6.5-java)
65
+ rack (1.6.0)
66
+ rack-test (0.6.2)
67
+ rack (>= 1.0)
68
+ rails (4.2.0)
69
+ actionmailer (= 4.2.0)
70
+ actionpack (= 4.2.0)
71
+ actionview (= 4.2.0)
72
+ activejob (= 4.2.0)
73
+ activemodel (= 4.2.0)
74
+ activerecord (= 4.2.0)
75
+ activesupport (= 4.2.0)
76
+ bundler (>= 1.3.0, < 2.0)
77
+ railties (= 4.2.0)
78
+ sprockets-rails
79
+ rails-deprecated_sanitizer (1.0.3)
80
+ activesupport (>= 4.2.0.alpha)
81
+ rails-dom-testing (1.0.5)
82
+ activesupport (>= 4.2.0.beta, < 5.0)
83
+ nokogiri (~> 1.6.0)
84
+ rails-deprecated_sanitizer (>= 1.0.1)
85
+ rails-html-sanitizer (1.0.1)
86
+ loofah (~> 2.0)
87
+ railties (4.2.0)
88
+ actionpack (= 4.2.0)
89
+ activesupport (= 4.2.0)
90
+ rake (>= 0.8.7)
91
+ thor (>= 0.18.1, < 2.0)
92
+ rake (10.4.2)
93
+ sprockets (2.12.3)
94
+ hike (~> 1.2)
95
+ multi_json (~> 1.0)
96
+ rack (~> 1.0)
97
+ tilt (~> 1.1, != 1.3.0)
98
+ sprockets-rails (2.2.2)
99
+ actionpack (>= 3.0)
100
+ activesupport (>= 3.0)
101
+ sprockets (>= 2.8, < 4.0)
102
+ thor (0.19.1)
103
+ thread_safe (0.3.4)
104
+ thread_safe (0.3.4-java)
105
+ tilt (1.4.1)
106
+ tzinfo (1.2.2)
107
+ thread_safe (~> 0.1)
108
+
109
+ PLATFORMS
110
+ java
111
+ ruby
112
+
113
+ DEPENDENCIES
114
+ simple_workflow!
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ == 1.0.7 2015-01-07
2
+
3
+ === Fixes
4
+
5
+ * Calculate the current session cookie size using the encryptor to avoid CookieOverflow.
6
+
7
+
1
8
  == 1.0.6 2014-10-10
2
9
 
3
10
  === Fixes
@@ -1,19 +1,22 @@
1
- = simple_workflow
1
+ simple_workflow
2
+ ===============
3
+
4
+ [![Build Status](https://travis-ci.org/donv/simple_workflow.svg?branch=master)](https://travis-ci.org/donv/simple_workflow)
2
5
 
3
6
  * http://github.com/donv/simple_workflow
4
7
  * http://rubydoc.info/gems/simple_workflow
5
8
  * https://rubygems.org/gems/simple_workflow
6
9
 
7
- == DESCRIPTION:
10
+ ## DESCRIPTION:
8
11
 
9
12
  Extension to Rails to allow detours with returns.
10
13
 
11
- == FEATURES/PROBLEMS:
14
+ ## FEATURES/PROBLEMS:
12
15
 
13
16
  * switch your "link_to" lines to "detour_to" and your controller "redirect_to" to "back_or_redirect_to" to allow users
14
17
  to return from whence they came.
15
18
 
16
- == SYNOPSIS:
19
+ ## SYNOPSIS:
17
20
 
18
21
  In views:
19
22
 
@@ -37,11 +40,11 @@ In your tests:
37
40
  assert_redirected_to "http://#{request.host}/bogus/location"
38
41
  end
39
42
 
40
- == REQUIREMENTS:
43
+ ## REQUIREMENTS:
41
44
 
42
45
  * Rails
43
46
 
44
- == INSTALL:
47
+ ## INSTALL:
45
48
 
46
49
  gem install simple_workflow
47
50
 
@@ -49,7 +52,7 @@ or in Gemfile
49
52
 
50
53
  gem 'simple_workflow'
51
54
 
52
- == LICENSE:
55
+ ## LICENSE:
53
56
 
54
57
  (The MIT License)
55
58
 
@@ -4,17 +4,17 @@ module SimpleWorkflow::Controller
4
4
  store_detour(params)
5
5
  redirect_to(options)
6
6
  end
7
-
7
+
8
8
  def rjs_detour_to(options)
9
9
  store_detour(params, request.post?)
10
10
  rjs_redirect_to(options)
11
11
  end
12
-
12
+
13
13
  def rjs_redirect_to(options)
14
14
  @options = options
15
15
  render :template => 'redirect', :layout => false, :formats => :js
16
16
  end
17
-
17
+
18
18
  def store_detour(options, post = false)
19
19
  options = options.dup.permit!.to_h if options.is_a?(ActionController::Parameters)
20
20
  options[:request_method] = :post if post
@@ -24,18 +24,30 @@ module SimpleWorkflow::Controller
24
24
  end
25
25
  session[:detours] ||= []
26
26
  session[:detours] << options
27
- ss = ws = nil
28
- loop do
29
- ss = Base64.encode64(Marshal.dump(session.to_hash)).size
30
- ws = Base64.encode64(Marshal.dump(session[:detours])).size
31
- break unless ws >= 2048 || (ss >= 3072 && session[:detours].size > 0)
32
- logger.warn "Workflow too large (#{ws}). Dropping oldest detour."
33
- session[:detours].shift
34
- reset_workflow if session[:detours].empty?
27
+
28
+ if Backlog::Application.config.session_store == ActionDispatch::Session::CookieStore
29
+ encryptor = cookies.signed_or_encrypted.instance_variable_get(:@encryptor)
30
+ ss = ws = nil
31
+ loop do
32
+ ser_val = cookies.signed_or_encrypted.send(:serialize, nil, session.to_hash)
33
+ new_value = encryptor.encrypt_and_sign(ser_val)
34
+ ss = new_value.size
35
+ wf_ser_val = cookies.signed_or_encrypted.send(:serialize, nil, session[:detours])
36
+ wf_crypt_val = encryptor.encrypt_and_sign(wf_ser_val)
37
+ ws = wf_crypt_val.size
38
+ puts "ss: #{ss}"
39
+ puts "ws: #{ws}"
40
+ break unless ws >= 2048 || (ss >= 3072 && session[:detours] && session[:detours].size > 0)
41
+ logger.warn "Workflow too large (#{ws}). Dropping oldest detour."
42
+ session[:detours].shift
43
+ reset_workflow if session[:detours].empty?
44
+ end
45
+ logger.debug "session: #{ss} bytes, workflow(#{session[:detours].try(:size) || 0}): #{ws} bytes"
35
46
  end
36
- logger.debug "Added detour: #{options.inspect}, session: #{ss} bytes, workflow(#{session[:detours].size}): #{ws} bytes"
47
+
48
+ logger.debug "Added detour (#{session[:detours].try(:size) || 0}): #{options.inspect}"
37
49
  end
38
-
50
+
39
51
  def store_detour_from_params
40
52
  if params[:detour]
41
53
  store_detour(params[:detour])
@@ -44,7 +56,7 @@ module SimpleWorkflow::Controller
44
56
  pop_detour
45
57
  end
46
58
  end
47
-
59
+
48
60
  def back(response_status_and_flash)
49
61
  return false if session[:detours].nil?
50
62
  detour = pop_detour
@@ -57,7 +69,7 @@ module SimpleWorkflow::Controller
57
69
  end
58
70
  true
59
71
  end
60
-
72
+
61
73
  def back_or_redirect_to(options = {}, response_status_and_flash = {})
62
74
  back(response_status_and_flash) or redirect_to(options, response_status_and_flash)
63
75
  end
@@ -101,5 +113,5 @@ module SimpleWorkflow::Controller
101
113
  </html>
102
114
  EOF
103
115
  end
104
-
116
+
105
117
  end
@@ -71,7 +71,11 @@ module SimpleWorkflow::Helper
71
71
  def back_or_link_to(title, options = nil, html_options = nil)
72
72
  if session[:detours]
73
73
  options = {:return_from_detour => true}.update(session[:detours].last)
74
+
75
+ # FIXME(uwe): Write a test to prove this line is needed.
74
76
  options['id'] ||= nil
77
+ # EMXIF
78
+
75
79
  logger.debug "linked return from detour: #{options.inspect}"
76
80
  end
77
81
  link_to(title, options, html_options) if options
@@ -1,3 +1,3 @@
1
1
  module SimpleWorkflow
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,17 @@
1
+ require 'rake'
2
+ require './lib/simple_workflow/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = %q{simple_workflow}
6
+ s.version = SimpleWorkflow::VERSION
7
+ s.date = Date.today.strftime '%Y-%m-%d'
8
+ s.authors = ['Uwe Kubosch']
9
+ s.email = %q{uwe@kubosch.no}
10
+ s.summary = %q{Add simple breadcrumbs "detour" workflow to Ruby On Rails.}
11
+ s.homepage = %q{https://github.com/donv/simple_workflow}
12
+ s.description = 'Expands Ruby On Rails to allow simple breadcrumb detour workflows.'
13
+ s.rubyforge_project = 'donv/simple_workflow'
14
+ s.licenses = %w(MIT)
15
+ s.files = FileList['[A-Z]*', 'lib/**/*', 'test/**/*'].to_a
16
+ s.add_dependency('rails','~>4.0')
17
+ end
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class SimpleWorkflowTest < Test::Unit::TestCase
3
+ class SimpleWorkflowTest < MiniTest::Test
4
4
  include SimpleWorkflow::Helper
5
5
 
6
6
  def setup
data/test/test_helper.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'stringio'
2
- require 'test/unit'
3
1
  require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'minitest/autorun'
4
4
  require File.dirname(__FILE__) + '/../lib/simple_workflow'
5
- require 'active_support/core_ext'
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: rails
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
- - - ~>
17
+ - - "~>"
17
18
  - !ruby/object:Gem::Version
18
19
  version: '4.0'
19
- name: rails
20
- prerelease: false
21
20
  type: :runtime
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  description: Expands Ruby On Rails to allow simple breadcrumb detour workflows.
@@ -30,38 +30,47 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - Gemfile
34
+ - Gemfile.lock
33
35
  - History.rdoc
34
- - README.rdoc
36
+ - README.md
35
37
  - Rakefile
36
38
  - lib/simple_workflow.rb
37
39
  - lib/simple_workflow/controller.rb
38
40
  - lib/simple_workflow/helper.rb
39
41
  - lib/simple_workflow/test_helper.rb
40
42
  - lib/simple_workflow/version.rb
43
+ - simple_workflow-1.0.1.gem
44
+ - simple_workflow-1.0.2.gem
45
+ - simple_workflow-1.0.3.gem
46
+ - simple_workflow-1.0.4.gem
47
+ - simple_workflow-1.0.5.gem
48
+ - simple_workflow-1.0.6.gem
49
+ - simple_workflow.gemspec
41
50
  - test/simple_workflow_test.rb
42
51
  - test/test_helper.rb
43
52
  homepage: https://github.com/donv/simple_workflow
44
53
  licenses:
45
54
  - MIT
46
55
  metadata: {}
47
- post_install_message:
56
+ post_install_message:
48
57
  rdoc_options: []
49
58
  require_paths:
50
59
  - lib
51
60
  required_ruby_version: !ruby/object:Gem::Requirement
52
61
  requirements:
53
- - - '>='
62
+ - - ">="
54
63
  - !ruby/object:Gem::Version
55
64
  version: '0'
56
65
  required_rubygems_version: !ruby/object:Gem::Requirement
57
66
  requirements:
58
- - - '>='
67
+ - - ">="
59
68
  - !ruby/object:Gem::Version
60
69
  version: '0'
61
70
  requirements: []
62
71
  rubyforge_project: donv/simple_workflow
63
- rubygems_version: 2.1.9
64
- signing_key:
72
+ rubygems_version: 2.4.5
73
+ signing_key:
65
74
  specification_version: 4
66
75
  summary: Add simple breadcrumbs "detour" workflow to Ruby On Rails.
67
76
  test_files: []