filesystem_queue 0.1.0 → 0.1.1

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
2
  SHA256:
3
- metadata.gz: b9e3ab5ddf19ea8ef07cf949fa4e273c5498c3c71922318be16619f788a648dc
4
- data.tar.gz: 51f0f96c5299d04c3777fff7f20fbfa2ec476923464f19fed4e8a11b53f4abbc
3
+ metadata.gz: 51d0fe57ac440673ae98c9fa2a782ddfe6552450bf984dd44c4edc0d0f972e2f
4
+ data.tar.gz: e61ded49f3eb2919f0da55ce20627a5d3a732c22c71bf747b64def5f42f0e2a4
5
5
  SHA512:
6
- metadata.gz: b1999fc8c23de8854d08aadc53993dc1fb128ad8dfd1a682cea44fb7315c5939ac75341d05c8ea2b9eac41820c51e422193924c422ece9dd9c01f109f0caf20e
7
- data.tar.gz: 191ad7aa123dcd9cdde4056f820190eeff45204e36fda24ca3c97d0029751b1b63b06f44832e485915903c0bb3a81afe12040330b44ca8897f35f1929155d15b
6
+ metadata.gz: 7ecb0a4780632dcedcbe33593460c9b827c4bc1402b967fe9cd010ca3cbb2ab97f4e7bcdcbe33f707caf7bf8a90d964c65f8e773cf806f2a2e3436e203398c85
7
+ data.tar.gz: 73b113cb15f2cd5eb285565ceb82c62b8d3b0f6180c49c75c374228becd4ba0f1877dc49794cc01b7ca0e3b4442b43614d229e21f093e43739e4c7ab84da2eed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.1] - 2024-09-13
4
+ - Added unit tests
5
+ - Fixed Github Actions
6
+ - Minor refactors
3
7
  ## [0.1.0] - 2024-09-12
4
-
5
8
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- filesystem_queue (0.1.0)
4
+ filesystem_queue (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -35,6 +35,7 @@ GEM
35
35
 
36
36
  PLATFORMS
37
37
  x86_64-darwin-19
38
+ x86_64-linux
38
39
 
39
40
  DEPENDENCIES
40
41
  filesystem_queue!
data/README.md CHANGED
@@ -1,18 +1,32 @@
1
1
  # FilesystemQueue
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/filesystem_queue.svg)](https://badge.fury.io/rb/filesystem_queue)
4
+
3
5
  `FileSystemQueue` is a persistent queue system based on the local filesystem. It allows you to enqueue and dequeue jobs, and keeps track of completed and failed jobs.
4
6
 
5
- ## Installation
6
7
 
7
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
8
+ ## What is this for?
9
+
10
+ `FileSystemQueue` is designed for applications that need a simple, embedded queue system with minimal footprint. It consists of just a single class and utilizes your local filesystem for storage. This makes it an excellent choice for lightweight applications or development environments where setting up a full-fledged queue service is overkill. If you are looking to scale up your queue into a service architecture, Ruby offers other solutions like Resque (Redis-based), or various suites from cloud providers such as AWS-SQS.
11
+
12
+ ### Features
13
+
14
+ - **Persistence**: Jobs are stored on the filesystem, ensuring they are not lost between application restarts.
15
+ - **Minimal Overhead**: No need for external dependencies or services.
16
+ - **Ease of Use**: Simple API for enqueuing and dequeuing jobs.
17
+ - **Improved Performance**: Enhances filesystem performance by using an index file that keeps track of files by the time they are written in the queue.
18
+ - **Tailored for Local Use**: This system is designed for local use with a single consumer (at the moment).
19
+ - **Job Management**: Completed and failed jobs are tracked in separate folders for easy management.
20
+
21
+ ## Installation
8
22
 
9
23
  Install the gem and add to the application's Gemfile by executing:
10
24
 
11
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
25
+ $ bundle add filesystem_queue
12
26
 
13
27
  If bundler is not being used to manage dependencies, install the gem by executing:
14
28
 
15
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
29
+ $ gem install filesystem_queue
16
30
 
17
31
  ## Methods
18
32
 
@@ -9,7 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["carloswestman@gmail.com"]
10
10
 
11
11
  spec.summary = "A persistent queue system based on the local filesystem"
12
- spec.description = "FilesystemQueue is a Ruby gem that provides a persistent queue system using the local filesystem. It allows you to enqueue and dequeue jobs, and keeps track of completed and failed jobs."
12
+ spec.description = "FilesystemQueue is a Ruby gem that provides a persistent queue system "\
13
+ "using the local filesystem.It allows you to enqueue and dequeue jobs, and keeps track of completed and failed jobs."
13
14
  spec.homepage = "https://github.com/carloswestman/filesystem_queue"
14
15
  spec.license = "MIT"
15
16
  spec.required_ruby_version = ">= 2.6.0"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FilesystemQueue
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -31,17 +31,7 @@ module FilesystemQueue
31
31
  end
32
32
 
33
33
  def dequeue
34
- job_file = nil
35
- File.open(@index_file, "r+") do |f|
36
- lines = f.each_line.to_a
37
- return nil if lines.empty?
38
-
39
- job_file = lines.shift.strip
40
- f.rewind
41
- f.write(lines.join)
42
- f.truncate(f.pos)
43
- end
44
-
34
+ job_file = extract_job_file_from_index
45
35
  return nil unless job_file && File.exist?(job_file)
46
36
 
47
37
  job_data = JSON.parse(File.read(job_file), symbolize_names: true)
@@ -71,5 +61,19 @@ module FilesystemQueue
71
61
  rescue StandardError => e
72
62
  puts "Failed to move job file: #{e.message}"
73
63
  end
64
+
65
+ def extract_job_file_from_index
66
+ job_file = nil
67
+ File.open(@index_file, "r+") do |f|
68
+ lines = f.each_line.to_a
69
+ return nil if lines.empty?
70
+
71
+ job_file = lines.shift.strip
72
+ f.rewind
73
+ f.write(lines.join)
74
+ f.truncate(f.pos)
75
+ end
76
+ job_file
77
+ end
74
78
  end
75
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filesystem_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Westman
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2024-09-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: FilesystemQueue is a Ruby gem that provides a persistent queue system
14
- using the local filesystem. It allows you to enqueue and dequeue jobs, and keeps
14
+ using the local filesystem.It allows you to enqueue and dequeue jobs, and keeps
15
15
  track of completed and failed jobs.
16
16
  email:
17
17
  - carloswestman@gmail.com