fragmentary 0.4.0 → 0.4.1

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
  SHA256:
3
- metadata.gz: 61a94b394035bb4b3ec317316e46fa77ca925cc15a162a76d6401500e6636b5d
4
- data.tar.gz: 8db2f91e9a9b23f3ccdafbc2f800695e653426a656887959f807c80eca10c901
3
+ metadata.gz: 47a728de19bdd3ebd2e42cd30cda6d6695117c4ee4d441d673c3fb768eb23edf
4
+ data.tar.gz: 8fc6c056ddfead81b826ecb6b368b263eb44764771de9461db4263d56870a6c5
5
5
  SHA512:
6
- metadata.gz: bc4f5da40872cfb5327af28cb81862e61ba201258bc8338fa6ad9871439dac0133af4c102c10b09cd0ed25acb883c53d428ba3632085ac4b67cb7f662ccf6c16
7
- data.tar.gz: '0628b394849e14ed4fed5ebe18e7b59a4badfe83d16b63f24965e6e6a2a4d656aec57f627000d70286c79152d2d028fb231c0b7c89a2eabfffb455140f7404e6'
6
+ metadata.gz: 2f78656b88bcc12cd81a8e75f1e0dab8fb3db88ca0bfdda6d79e739b3633a08a48c458dadb2f10c842b34eaa5df5648d6e7fb20451db3921bc34b407a0ad5317
7
+ data.tar.gz: 8f710ebb2a98800c676811c60dcbfd4cb2e558bb22676ad259994b9a4f8447cebe035fb51214adca26d3113d9f625590d36ae0e2621db43f1a32b354bb048a61
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### 0.4.1
2
+ - Fixes a problem with session initialization when sending requests generated by Handler subclasses
3
+
1
4
  ### 0.4.0
2
5
  - Uses ActiveJob as the interface for asynchronous processes instead of using Delayed::Job directly.
3
6
  - Updates Rails dependency to ~>6.0 as earlier versions lack support for the custom job serialization needed to use ActiveJob. Accordingly, Rails 5.x and earlier are no longer supported.
data/README.md CHANGED
@@ -857,12 +857,6 @@ Again, this configuration will be different for each instance, and so in our cas
857
857
 
858
858
  Note that if you configure [Delayed::Job](https://github.com/collectiveidea/delayed_job) (or other backend) to work only from specific queues, you'll need to make sure that _any_ asynchronous tasks created by your application are submitted to one of those queues.
859
859
 
860
- ## Dependencies
861
-
862
- - Fragmentary is currently being used in production with Rails 6.0. Versions >=0.4 do not work with earlier versions of Rails for a couple of reasons:
863
- - The version of ActiveJob in Rails 5.x does not support the custom serialization needed to enqueue asynchronous tasks for sending internal requests. A repository branch 'delayed_job' is available that uses the [Delayed::Job](https://github.com/collectiveidea/delayed_job) gem directly (i.e. without ActiveJob) and this works well with Rails 5.x. However, this branch is no longer maintained.
864
- - The API for the Rails `ActionDispatch::Integration::Session` class, which is used to handle internal application requests, was changed in Rails 5.0. Consequently the current version of Fragmentary is incompatible with Rails 4.x and earlier. We do have a 'Rails.4.2' branch in the repository that uses the older API. However, this branch is no longer maintained.
865
-
866
860
  ## Timestamps
867
861
 
868
862
  Fragmentary allows HTML comments to be optionally inserted into cached fragments identifying the time at which the fragment was last cached. Simply add `config.insert_timestamps = true` to the configuration block in your `config/initializers/fragmentary.rb` file.
@@ -889,6 +883,12 @@ The `Fragment` class and its subclasses provide a number of utility instance met
889
883
  - `delete_cache` - removes the fragment's content from the cache.
890
884
  - `delete_cache_tree` - recursively removes from the cache all content for the fragment and its descendants.
891
885
 
886
+ ## Dependencies
887
+
888
+ - Fragmentary is currently being used in production with Rails 6.0. Versions >=0.4 do not work with earlier versions of Rails for a couple of reasons:
889
+ - The version of ActiveJob in Rails 5.x does not support the custom serialization needed to enqueue asynchronous tasks for sending internal requests. A repository branch 'delayed_job' is available that uses the [Delayed::Job](https://github.com/collectiveidea/delayed_job) gem directly (i.e. without ActiveJob) and this works well with Rails 5.x. However, this branch is no longer maintained.
890
+ - The API for the Rails `ActionDispatch::Integration::Session` class, which is used to handle internal application requests, was changed in Rails 5.0. Consequently the current version of Fragmentary is incompatible with Rails 4.x and earlier. We do have a 'Rails.4.2' branch in the repository that uses the older API. However, this branch is no longer maintained.
891
+
892
892
  ## Contributing
893
893
 
894
894
  Bug reports and usage questions are welcome at https://github.com/MarkMT/fragmentary.
@@ -6,7 +6,7 @@ module Fragmentary
6
6
 
7
7
  def perform(tasks)
8
8
  tasks.each do |task|
9
- Rails.logger.info "***** Dispatching task for handler class #{task.class.name}"
9
+ Rails.logger.info "\n***** Dispatching task for handler class #{task.class.name}"
10
10
  task.call
11
11
  end
12
12
  RequestQueue.all.each do |queue|
@@ -131,6 +131,7 @@ module Fragmentary
131
131
  private
132
132
 
133
133
  def send_all_requests
134
+ clear_session
134
135
  while queue.size > 0
135
136
  send_next_request
136
137
  end
@@ -56,9 +56,9 @@ module Fragmentary
56
56
  def sign_in
57
57
  raise "Can't sign in without user credentials" unless session_credentials
58
58
  send_request(:method => :get, :path => session_sign_in_path, :options => session_options) # necessary in order to get the csrf token
59
- # NOTE: In Rails 5, params is changed to a named argument, i.e. :params => {...}. Will need to be changed.
60
59
  # Note that request is called on session, returning an ActionDispatch::Request; request.session is an ActionDispatch::Request::Session
61
60
  puts " * Signing in as #{session_credentials.inspect}"
61
+ Rails.logger.info " * Signing in as #{session_credentials.inspect}"
62
62
  parameters = session_credentials.merge(:authenticity_token => request.session[:_csrf_token])
63
63
  send_request(:method => :post, :path => session_sign_in_path, :parameters => parameters, :options => session_options)
64
64
  if @session.redirect?
@@ -143,6 +143,7 @@ module Fragmentary
143
143
  # The first request retrieves the authentication token
144
144
  response = send_request(:method => :get, :path => Fragmentary.config.get_sign_in_path)
145
145
  puts " * Signing in as #{@credentials.inspect}"
146
+ Rails.logger.info " * Signing in as #{@credentials.inspect}"
146
147
  response = send_request(:method => :post, :path => Fragmentary.config.post_sign_in_path,
147
148
  :parameters => @credentials.merge(:authenticity_token => @authenticity_token),
148
149
  :options => {:headers => {:accept => "text/html,application/xhtml+xml,application/xml"}})
@@ -1,3 +1,3 @@
1
1
  module Fragmentary
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fragmentary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Thomson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-22 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails