script_tracker 0.1.0 → 0.1.2

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: 6c4624d6b1fc0ede5e5691a6ec4b2ced79513620505434524b9d1d980e93d4ca
4
- data.tar.gz: 427a3b57e4fe3436db63864e7a9d323f285c4ad5d1c763c15813a9da92c2d43d
3
+ metadata.gz: 18d372a25d4ace7ddcd9d7cd978e4dc328deb3cc9fd24bcc4ea47b3efbf7c2b9
4
+ data.tar.gz: 42ad440f174f8e3fafdae807a898545893e631ae174fc3ad99a36737c65e38aa
5
5
  SHA512:
6
- metadata.gz: 776ff4218886ee763f1b93d8212dfae35c68fa2f685f89a2664d642b4934ace4a1a0c3260bd692b7688c3cfc58864dd812329f24161ac91462b5d2ee92cf183a
7
- data.tar.gz: 1ce7a1b8dc3b65888dbe2e9117b4cb06b3e31d0ff24f195d2e4bdb66d9b1782a2bd2441df09b66ff2aa4e8cb9ace86068bd0bb5af9c81051b2a90d325f1be7cf
6
+ metadata.gz: dc156bc040a0a421dc912e25163854ffae79ddf520d26e83d095a0f45905ee344882208b5559d6e9459a9d33565c9db3bf4bed54dae23aae61b09fd568eef0f4
7
+ data.tar.gz: d42cd031ccd17efe53b9bb69b790b3dc0eddf90aacb368ac7d16f24a620aebee6ba6af4c6430f0f70249fa65e9aa962301423b60139b55ce1a09746421aea182
data/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.2] - 2025-01-17
11
+
12
+ ### Fixed
13
+ - Updated GitHub Actions workflows to use v4 actions (fix deprecated upload-artifact)
14
+ - Refactored workflows to match successful gem release pattern
15
+ - Fixed RubyGems authentication configuration
16
+
17
+ ## [0.1.1] - 2025-01-17
18
+
19
+ ### Added
20
+ - CI/CD workflows for automated testing and releases
21
+ - GitHub Actions workflow for automatic releases on tag push
22
+ - Manual release workflow via GitHub Actions UI
23
+ - Local release script (`bin/release`)
24
+
25
+ ### Changed
26
+ - Improved workflow documentation in README
27
+
10
28
  ## [0.1.0] - 2025-01-17
11
29
 
12
30
  ### Added
@@ -26,5 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
44
  - Comprehensive RSpec test suite
27
45
  - Full documentation and examples
28
46
 
29
- [Unreleased]: https://github.com/blink-global/script_tracker/compare/v0.1.0...HEAD
30
- [0.1.0]: https://github.com/blink-global/script_tracker/releases/tag/v0.1.0
47
+ [Unreleased]: https://github.com/a-abdellatif98/script_tracker/compare/v0.1.2...HEAD
48
+ [0.1.2]: https://github.com/a-abdellatif98/script_tracker/compare/v0.1.1...v0.1.2
49
+ [0.1.1]: https://github.com/a-abdellatif98/script_tracker/compare/v0.1.0...v0.1.1
50
+ [0.1.0]: https://github.com/a-abdellatif98/script_tracker/releases/tag/v0.1.0
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Blink
3
+ Copyright (c) 2025 Ahmed Abd El-Latif
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -4,14 +4,14 @@ ScriptTracker is a Ruby gem that provides a migration-like system for managing o
4
4
 
5
5
  ## Features
6
6
 
7
- - **Execution Tracking**: Automatically tracks which scripts have been run and their status
8
- - **Transaction Support**: Wraps script execution in database transactions
9
- - **Status Management**: Track scripts as success, failed, running, or skipped
10
- - **Built-in Logging**: Convenient logging methods with timestamps
11
- - **Batch Processing**: Helper methods for processing large datasets efficiently
12
- - **Timeout Support**: Configure custom timeouts for long-running scripts
13
- - **Stale Script Cleanup**: Automatically identify and cleanup stuck scripts
14
- - **Migration Generator**: Generate timestamped script files with templates
7
+ * **Execution Tracking**: Automatically tracks which scripts have been run and their status
8
+ * **Transaction Support**: Wraps script execution in database transactions
9
+ * **Status Management**: Track scripts as success, failed, running, or skipped
10
+ * **Built-in Logging**: Convenient logging methods with timestamps
11
+ * **Batch Processing**: Helper methods for processing large datasets efficiently
12
+ * **Timeout Support**: Configure custom timeouts for long-running scripts
13
+ * **Stale Script Cleanup**: Automatically identify and cleanup stuck scripts
14
+ * **Migration Generator**: Generate timestamped script files with templates
15
15
 
16
16
  ## Installation
17
17
 
@@ -42,8 +42,8 @@ rails generate script_tracker:install
42
42
  ```
43
43
 
44
44
  This will:
45
- - Create a migration for the `executed_scripts` table
46
- - Create the `lib/scripts` directory for your scripts
45
+ * Create a migration for the `executed_scripts` table
46
+ * Create the `lib/scripts` directory for your scripts
47
47
 
48
48
  2. Run the migration:
49
49
 
@@ -70,7 +70,7 @@ Generate a new script with a descriptive name:
70
70
  rake scripts:create["update user preferences"]
71
71
  ```
72
72
 
73
- This creates a timestamped script file in `lib/scripts/`:
73
+ This creates a timestamped script file in `lib/scripts/` :
74
74
 
75
75
  ```ruby
76
76
  # lib/scripts/20231117120000_update_user_preferences.rb
@@ -107,6 +107,7 @@ rake scripts:status
107
107
  ```
108
108
 
109
109
  Output:
110
+
110
111
  ```
111
112
  Scripts:
112
113
  [SUCCESS] 20231117120000_update_user_preferences.rb (2.5s)
@@ -208,68 +209,120 @@ end
208
209
 
209
210
  ## API Reference
210
211
 
211
- ### ScriptTracker::Base
212
+ ### ScriptTracker:: Base
212
213
 
213
214
  Base class for all scripts.
214
215
 
215
216
  **Class Methods:**
216
217
 
217
- - `execute` - Implement this method with your script logic (required)
218
- - `run` - Execute the script with transaction and error handling
219
- - `timeout` - Override to set custom timeout (default: 300 seconds)
220
- - `skip!(reason)` - Skip script execution with optional reason
221
- - `log(message, level: :info)` - Log a message with timestamp
222
- - `log_progress(current, total, message = nil)` - Log progress percentage
223
- - `process_in_batches(relation, batch_size: 1000, &block)` - Process records in batches
218
+ * `execute` - Implement this method with your script logic (required)
219
+ * `run` - Execute the script with transaction and error handling
220
+ * `timeout` - Override to set custom timeout (default: 300 seconds)
221
+ * `skip!(reason)` - Skip script execution with optional reason
222
+ * `log(message, level: :info)` - Log a message with timestamp
223
+ * `log_progress(current, total, message = nil)` - Log progress percentage
224
+ * `process_in_batches(relation, batch_size: 1000, &block)` - Process records in batches
224
225
 
225
- ### ScriptTracker::ExecutedScript
226
+ ### ScriptTracker:: ExecutedScript
226
227
 
227
228
  ActiveRecord model for tracking script execution.
228
229
 
229
230
  **Scopes:**
230
231
 
231
- - `successful` - Scripts that completed successfully
232
- - `failed` - Scripts that failed
233
- - `running` - Scripts currently running
234
- - `skipped` - Scripts that were skipped
235
- - `completed` - Scripts that finished (success or failed)
236
- - `ordered` - Order by execution time ascending
237
- - `recent_first` - Order by execution time descending
232
+ * `successful` - Scripts that completed successfully
233
+ * `failed` - Scripts that failed
234
+ * `running` - Scripts currently running
235
+ * `skipped` - Scripts that were skipped
236
+ * `completed` - Scripts that finished (success or failed)
237
+ * `ordered` - Order by execution time ascending
238
+ * `recent_first` - Order by execution time descending
238
239
 
239
240
  **Class Methods:**
240
241
 
241
- - `executed?(filename)` - Check if a script has been executed
242
- - `mark_as_running(filename)` - Mark a script as running
243
- - `cleanup_stale_running_scripts(older_than: 1.hour.ago)` - Clean up stale scripts
242
+ * `executed?(filename)` - Check if a script has been executed
243
+ * `mark_as_running(filename)` - Mark a script as running
244
+ * `cleanup_stale_running_scripts(older_than: 1.hour.ago)` - Clean up stale scripts
244
245
 
245
246
  **Instance Methods:**
246
247
 
247
- - `mark_success!(output, duration)` - Mark as successful
248
- - `mark_failed!(error, duration)` - Mark as failed
249
- - `mark_skipped!(output, duration)` - Mark as skipped
250
- - `success?`, `failed?`, `running?`, `skipped?` - Status predicates
251
- - `formatted_duration` - Human-readable duration
252
- - `formatted_output` - Truncated output text
253
- - `timeout_seconds` - Get timeout value
254
- - `timed_out?` - Check if script has timed out
248
+ * `mark_success!(output, duration)` - Mark as successful
249
+ * `mark_failed!(error, duration)` - Mark as failed
250
+ * `mark_skipped!(output, duration)` - Mark as skipped
251
+ * `success?`, `failed?`, `running?`, `skipped?` - Status predicates
252
+ * `formatted_duration` - Human-readable duration
253
+ * `formatted_output` - Truncated output text
254
+ * `timeout_seconds` - Get timeout value
255
+ * `timed_out?` - Check if script has timed out
255
256
 
256
257
  ## Rake Tasks
257
258
 
258
- - `rake scripts:create[description]` - Create a new script
259
- - `rake scripts:run` - Run all pending scripts
260
- - `rake scripts:status` - Show status of all scripts
261
- - `rake scripts:rollback[filename]` - Rollback a script
262
- - `rake scripts:cleanup` - Cleanup stale running scripts
259
+ * `rake scripts:create[description]` - Create a new script
260
+ * `rake scripts:run` - Run all pending scripts
261
+ * `rake scripts:status` - Show status of all scripts
262
+ * `rake scripts:rollback[filename]` - Rollback a script
263
+ * `rake scripts:cleanup` - Cleanup stale running scripts
263
264
 
264
265
  ## Development
265
266
 
266
267
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
267
268
 
268
- To install this gem onto your local machine, run `bundle exec rake install`.
269
+ To install this gem onto your local machine, run `bundle exec rake install` .
270
+
271
+ ### Releasing a New Version
272
+
273
+ #### Option 1: GitHub Actions (Recommended)
274
+
275
+ The easiest way to release is using GitHub Actions:
276
+
277
+ 1. Go to the **Actions** tab in GitHub
278
+ 2. Select **Release** workflow
279
+ 3. Click **Run workflow**
280
+ 4. Enter the version number (e.g., `0.1.1`)
281
+ 5. Click **Run workflow**
282
+
283
+ The workflow will:
284
+ * Run all tests across multiple Ruby versions
285
+ * Update version and CHANGELOG
286
+ * Build the gem
287
+ * Create git tag
288
+ * Push to git
289
+ * Push to RubyGems automatically
290
+
291
+ **Required Secrets**: Set `RUBYGEMS_AUTH_TOKEN` in GitHub repository secrets.
292
+
293
+ #### Option 2: Local Release Script
294
+
295
+ To release locally, use the release script:
296
+
297
+ ```bash
298
+ bin/release 0.1.1
299
+ ```
300
+
301
+ The release script will:
302
+ * Run all tests to ensure everything passes
303
+ * Update the version in `lib/script_tracker/version.rb`
304
+ * Update `CHANGELOG.md` with the new version
305
+ * Build the gem
306
+ * Create a git tag
307
+ * Push to git (if remote configured)
308
+ * Push to RubyGems
309
+
310
+ **Note**: The script requires:
311
+ * All tests passing
312
+ * No uncommitted changes
313
+ * RubyGems credentials configured (`gem credentials`)
314
+
315
+ #### Option 3: Rake Task
316
+
317
+ Alternatively, you can use the rake task:
318
+
319
+ ```bash
320
+ bundle exec rake release
321
+ ```
269
322
 
270
323
  ## Contributing
271
324
 
272
- Bug reports and pull requests are welcome on GitHub at https://github.com/blink-global/script_tracker.
325
+ Bug reports and pull requests are welcome on GitHub at https://github.com/a-abdellatif98/script_tracker.
273
326
 
274
327
  ## License
275
328
 
@@ -17,6 +17,6 @@ Next steps:
17
17
  rake scripts:status
18
18
 
19
19
  For more information, visit:
20
- https://github.com/blink-global/script_tracker
20
+ https://github.com/a-abdellatif98/script_tracker
21
21
 
22
22
  ===============================================================================
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ScriptTracker
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: script_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed Abd El-Latif
@@ -98,7 +98,7 @@ description: ScriptTracker provides a migration-like system for managing one-off
98
98
  with execution tracking, transaction support, and built-in logging. Perfect for
99
99
  data migrations, cleanup tasks, and administrative scripts.
100
100
  email:
101
- - ahmed.abdelatif@blink.com
101
+ - ahmed.abdelatife@gmail.com
102
102
  executables: []
103
103
  extensions: []
104
104
  extra_rdoc_files: []
@@ -117,11 +117,11 @@ files:
117
117
  - lib/script_tracker/version.rb
118
118
  - tasks/script_tracker.rake
119
119
  - templates/script_template.rb
120
- homepage: https://github.com/blink-global/script_tracker
120
+ homepage: https://github.com/a-abdellatif98/script_tracker
121
121
  licenses:
122
122
  - MIT
123
123
  metadata:
124
- homepage_uri: https://github.com/blink-global/script_tracker
124
+ homepage_uri: https://github.com/a-abdellatif98/script_tracker
125
125
  source_code_uri: https://github.com/a-abdellatif98/script_tracker
126
126
  changelog_uri: https://github.com/a-abdellatif98/script_tracker/blob/main/CHANGELOG.md
127
127
  post_install_message:
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.4.1
142
+ rubygems_version: 3.4.19
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: A Ruby gem for tracking and managing one-off script executions in Rails applications