yobi-http 0.4.1 → 0.6.0

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/exe/yobi +17 -1
  4. data/lib/yobi.rb +1 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 445677da2c43e5f1e160b463c4e188b9a48a6536dc89b6c54ae8456327e2a302
4
- data.tar.gz: 6f2d45e33717d7aec6cc54fc0372bd206018ced1cc73d4d81535acb1d6f5b027
3
+ metadata.gz: 8300927c161636f736c477436c29cc441b79847df717a899a465fd0f129cec13
4
+ data.tar.gz: d6d693cabeea337129547854608fa394a23b870d89f4f60e3d975960a7bcf1cb
5
5
  SHA512:
6
- metadata.gz: efe2e6ed336f584d35c776b89db1cf30ee585f4af398bafd3dbb873a92bc96865c2c3be68af9557d0c748110962ad96f222fda4a122952d3180cc9ab46697cbb
7
- data.tar.gz: a05e99fa52716827a7e44f42630dd5c5460aa80829bd08f3e6fed5e795ce966b2afdbbbbaa82b84670ed99e8502189a44337a03489321189e6039bc00f085588
6
+ metadata.gz: df1eda58dbc36deb0719785872684adc9fbfa43f033e3ded3ff737792e4bf763a3dd98ab0452db1da4f96ce3fdf4450f73d865e13a061b67eef907c4510d2700
7
+ data.tar.gz: 16d5746464e6619d3dee0725b04b0c0cfd723860f2bd952ba0500f4bc1c238e262aaf521f75d2f92310ef0440bdeadc10ee1f704fc1581f00c06780acd99d054
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0]
4
+
5
+ - Add output to file feature
6
+
7
+ ## [0.4.2]
8
+
9
+ - Fix prevent request connection in offline mode
10
+
3
11
  ## [0.4.1]
4
12
 
5
13
  - Fix Time requirement
data/exe/yobi CHANGED
@@ -60,6 +60,10 @@ parser = OptionParser.new do |opts|
60
60
  @options[:offline] = true
61
61
  end
62
62
 
63
+ opts.on("-o", "--output FILE", "Write output to a file instead of STDOUT") do |file|
64
+ @options[:output] = file
65
+ end
66
+
63
67
  opts.on("-v", "--verbose", "Print detailed request and response information") do
64
68
  @options[:verbose] = true
65
69
  end
@@ -107,6 +111,12 @@ end
107
111
 
108
112
  pp [method, url, data, headers, @options, ARGV] if ENV["YOBI_DEBUG"]
109
113
 
114
+ if @options[:offline]
115
+ Net::HTTP.class_eval do
116
+ def connect; end
117
+ end
118
+ end
119
+
110
120
  Net::HTTP.start(URI(url).host, URI(url).port, use_ssl: URI(url).scheme == "https") do |http|
111
121
  options = @options
112
122
  request_class = Net::HTTP.const_get(method.capitalize)
@@ -162,5 +172,11 @@ Net::HTTP.start(URI(url).host, URI(url).port, use_ssl: URI(url).scheme == "https
162
172
  end
163
173
 
164
174
  view = Yobi.view(:output)
165
- puts TTY::Markdown.parse(ERB.new(view).result(binding), color: :always)
175
+
176
+ if options[:output]
177
+ file = File.expand_path(options[:output], Dir.pwd)
178
+ File.write(file, ERB.new(view).result(binding), mode: "w")
179
+ else
180
+ puts TTY::Markdown.parse(ERB.new(view).result(binding), color: :always)
181
+ end
166
182
  end
data/lib/yobi.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
4
-
5
3
  require "yobi/http"
6
4
 
7
5
  # Yobi Http CLI client namespace
@@ -10,7 +8,7 @@ module Yobi
10
8
  class Error < StandardError; end
11
9
 
12
10
  # Yobi gem version
13
- VERSION = "0.4.1"
11
+ VERSION = "0.6.0"
14
12
 
15
13
 
16
14
  def self.name
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yobi-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Vinciguerra
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-02-13 00:00:00.000000000 Z
10
+ date: 2026-02-16 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: tty-markdown