nacha 0.1.17 → 0.1.19

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: ac015c80a2af7bf4ccb82d5d4f61b6989fc97339d245b63f0738504b80098c34
4
- data.tar.gz: 6e22d6adb5488eb75bce08eba680ff85b94335a287de3ef5dcbf03084c3f04f6
3
+ metadata.gz: f162a763c807b6a18e930ef7f44661d6f8ec82ddac42d3d880eafcfe32b6238b
4
+ data.tar.gz: be6961b0cd3b3894c2b1c039b18b9ac01daeefca64410851abae1c8a0c3bd5b4
5
5
  SHA512:
6
- metadata.gz: a7d60688348901c5182650fd7651c5fc5346eb1b9da3271c6d9a77710646ff74108f2517a6430a8f271930eb592d8a41b52d86e04169cc443da32f54ce6a6e9b
7
- data.tar.gz: 628125365a043294bf71d4523c2db3ecb7ad290b1645f2abd8e0ab35339e14e739fd99d89d80a7853c9c0ae165c6fde3864d0ee95b01995d429a56eab54af8d4
6
+ metadata.gz: 16f05006ba599cfd2dda8661fb5bbe6a6c3531bd12c1638eba0a221bc55f739c91f002429f543d0eec1a873c166edd96cd3469818b6d7f45e2751367680c575a
7
+ data.tar.gz: 03044fe5def2aa9b0103f7b859f58100f74961457df73590d5d303383e7ab060cd98e9330ffb3c1a353e52015430faf244fd71181aaba91225b2ca7abffc460e
@@ -0,0 +1,55 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy YARD Documentation to GitHub Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the master branch
6
+ push:
7
+ branches:
8
+ - master
9
+
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21
+ concurrency:
22
+ group: "pages"
23
+ cancel-in-progress: false
24
+
25
+ jobs:
26
+ # Build job
27
+ build:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - name: Checkout
31
+ uses: actions/checkout@v4
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: '3.2'
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems
37
+ - name: Build YARD Documentation
38
+ run: bundle exec yardoc -o ./doc
39
+ - name: Upload artifact
40
+ uses: actions/upload-pages-artifact@v3
41
+ with:
42
+ # Upload entire doc directory
43
+ path: './doc'
44
+
45
+ # Deployment job
46
+ deploy:
47
+ environment:
48
+ name: github-pages
49
+ url: ${{ steps.deployment.outputs.page_url }}
50
+ runs-on: ubuntu-latest
51
+ needs: build
52
+ steps:
53
+ - name: Deploy to GitHub Pages
54
+ id: deployment
55
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,34 @@
1
+ name: Publish to RubyGems.org
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ name: Build and Publish Gem
11
+ runs-on: ubuntu-latest
12
+ # Specifies that the build-and-publish job requires read permissions for the repository contents and write permissions for package deployments.
13
+ permissions:
14
+ contents: write
15
+ # This is required for trusted publishing
16
+ id-token: write
17
+
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+ with:
22
+ persist-credentials: false
23
+
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ruby
28
+ bundler-cache: true # runs 'bundle install' and caches installed gems
29
+
30
+ - name: Build gem
31
+ run: gem build nacha.gemspec
32
+
33
+ - name: Publish to RubyGems.org
34
+ uses: rubygems/release-gem@v1
data/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.19] - 2025-07-27
11
+
12
+ - Accept stdin for command line parsing.
13
+
14
+ ## [0.1.18] - 2025-07-26
15
+
16
+ - first build automatically pushed from Github Actions
17
+
10
18
  ## [0.1.17] - 2025-07-25
11
19
 
12
20
  - lots of yard documentation for all the Ach record types. Generating
data/README.md CHANGED
@@ -64,6 +64,19 @@ API may change at any time. Pull requests welcomed
64
64
 
65
65
  ```
66
66
  nacha parse ach_file.ach > ach_file.html`
67
+ nacha parse -f html ach_file.ach -o ach_file.html`
68
+ ```
69
+
70
+ ## Parse an ach file into a JSON file
71
+
72
+ ```
73
+ nacha parse -f json ach_file.ach > ach_file.json`
74
+ ```
75
+
76
+ ## Parse an ach file into Markdown
77
+
78
+ ```
79
+ nacha parse -f md ach_file.ach > ach_file.md`
67
80
  ```
68
81
 
69
82
  ## Discussion
data/exe/nacha CHANGED
@@ -19,24 +19,29 @@ module Nacha
19
19
  desc "parse FILE", "Parse an ACH file"
20
20
  option :output_file, aliases: "-o"
21
21
  option :format, aliases: "-f", default: "html",
22
- desc: "Output format (html, json, md, or ach)", enum: %w[html json md ach]
22
+ desc: "Output format (html, json, md, markdown, or ach)",
23
+ enum: %w[html json md markdown ach]
23
24
  option :md_flavor, default: "common_mark", enum: %w[common_mark github]
24
- def parse(file_path)
25
- unless File.exist?(file_path)
25
+ def parse(file_path = nil)
26
+ if file_path.nil? || file_path.empty?
27
+ input_file = $stdin
28
+ elsif File.exist?(file_path)
29
+ input_file = File.open(file_path)
30
+ else
26
31
  puts "Error: File not found at #{file_path}"
27
32
  exit 1
28
33
  end
29
34
 
30
- file = File.open(file_path)
31
- ach_file = Nacha.parse(file)
35
+ raw_records = input_file.read
36
+ ach_file = Nacha.parse(raw_records)
32
37
 
33
38
  if ach_file && ach_file.is_a?(Array) && !ach_file.empty?
34
39
  if options[:output_file]
35
40
  File.open(options[:output_file], "w") do |f|
36
- write_output(ach_file, f, file)
41
+ write_output(ach_file, f, input_file)
37
42
  end
38
43
  else
39
- write_output(ach_file, $stdout, file)
44
+ write_output(ach_file, $stdout, input_file)
40
45
  end
41
46
  else
42
47
  puts "Could not parse the file or the file was empty."
@@ -52,11 +57,10 @@ module Nacha
52
57
  def write_output(ach_records, io, file)
53
58
  formatter_options = {
54
59
  file_name: File.basename(file.path),
55
- file_size: file.size,
60
+ file_size: file.respond_to?(:size) ? file.size : nil,
56
61
  number_of_lines: ach_records.size,
57
- created_at: file.ctime,
58
- modified_at: file.mtime,
59
- checksum: OpenSSL::Digest::SHA256.file(File.expand_path(file.path)).hexdigest,
62
+ created_at: file.respond_to?(:ctime) ? file.ctime : Time.now,
63
+ modified_at: file.respond_to?(:mtime) ? file.mtime : Time.now,
60
64
  preamble: HTML_PREAMBLE_FILE,
61
65
  postamble: HTML_POSTAMBLE_FILE
62
66
  }
@@ -64,7 +68,7 @@ module Nacha
64
68
  case options[:format]
65
69
  when 'ach'
66
70
  output_ach(ach_records, io)
67
- when 'md'
71
+ when 'md', 'markdown'
68
72
  formatter_options[:flavor] = options[:md_flavor].to_sym
69
73
  formatter = Nacha::Formatter::FormatterFactory.get(:markdown, ach_records, formatter_options)
70
74
  io.puts formatter.format
data/lib/nacha/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Nacha
4
4
  module Version
5
- STRING = '0.1.17'
5
+ STRING = '0.1.19'
6
6
  end
7
7
  VERSION = Version::STRING
8
8
  end
data/nacha.gemspec CHANGED
@@ -16,6 +16,11 @@ Gem::Specification.new do |spec|
16
16
  spec.license = 'MIT'
17
17
  spec.required_ruby_version = '>= 3.2.8'
18
18
 
19
+ spec.metadata = {
20
+ 'documentation_uri' => 'https://dwilkins.github.io/nacha/doc',
21
+ 'source_code_uri' => spec.homepage
22
+ }
23
+
19
24
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
25
  f.match(%r{^(test|spec|features)/})
21
26
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nacha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - David H. Wilkins
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-07-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bigdecimal
@@ -257,6 +256,8 @@ extensions: []
257
256
  extra_rdoc_files: []
258
257
  files:
259
258
  - ".github/workflows/ci.yml"
259
+ - ".github/workflows/pages.yml"
260
+ - ".github/workflows/rubygems.yml"
260
261
  - ".gitignore"
261
262
  - ".gitlab-ci.yml"
262
263
  - ".rspec"
@@ -354,8 +355,9 @@ files:
354
355
  homepage: https://github.com/dwilkins/nacha
355
356
  licenses:
356
357
  - MIT
357
- metadata: {}
358
- post_install_message:
358
+ metadata:
359
+ documentation_uri: https://dwilkins.github.io/nacha/doc
360
+ source_code_uri: https://github.com/dwilkins/nacha
359
361
  rdoc_options: []
360
362
  require_paths:
361
363
  - lib
@@ -370,8 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
370
372
  - !ruby/object:Gem::Version
371
373
  version: '0'
372
374
  requirements: []
373
- rubygems_version: 3.4.19
374
- signing_key:
375
+ rubygems_version: 3.6.9
375
376
  specification_version: 4
376
377
  summary: Ruby parser for ACH files.
377
378
  test_files: []