runc 0.1.4 → 0.1.9

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: 5c9b57ada3e10821558c52818fcf3bc544a983f0eab98443ac891c2f276c2671
4
- data.tar.gz: 19667e5aaf62df9ebf084e7f4d39166bc366ca5f7ef62a0ab1704b894578283e
3
+ metadata.gz: a2a910acd2374702b595d19d419065abe659ec54b85350a07844b1d27aed9c9a
4
+ data.tar.gz: bc3a693d3ad223e3cc983b60a6f700454d0e9cc5a34d7bd4de32f0bbae21a33e
5
5
  SHA512:
6
- metadata.gz: e60f24fe36e17606c4e74ed2f7b65d37b71eea978135557671861dc3861b8345b25faac76160b23f3262856ad83b3e2c4a82e3667fc1a4aa3db9ffb8cd057140
7
- data.tar.gz: a31e0597064f8bc9614a02dba9c2312ac22aa7ed6c64a8cf36ed1c415a27198d65afddd2f4dce976b9f5379206973af82a0da2433c0eedd33062e8de350b8a07
6
+ metadata.gz: 57589478fdcec08ed7ee185fde4156296273a04dfebaf760e5409c4d4f69a4d4eaeb6cd950b98f517794b12eab31319609e4e21b80cd44ba70797765ae376415
7
+ data.tar.gz: 39e08a80b0f1883eccd46cad27751d4be170bba6890754c8ad8dac0fcfe227cb0b33c96a3ddbe2d9313c504d0269e930fb5d23c94414853cd9a8d5b4eabca5b5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- runc (0.1.4)
4
+ runc (0.1.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,40 +1,41 @@
1
1
  # Runc
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/runc`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'runc'
3
+ [Runc] (pronounced "runk") is a network communication repl inspired by netcat and curl. In contrast to those tools, runc is simpler and faster to use:
4
+
5
+ ```bash
6
+ $ runc -h
7
+ -B, --no-body discard the response body
8
+ -H, --no-header discard the response header
9
+ -h, --help print this message
10
+ -n, --host host name (default 'localhost')
11
+ -p, --port port (default 8000)
12
+ -v, --version print runc version
13
+
14
+ $ runc -B -p 443 -n sergioro.mx
15
+ header>
16
+ request>
17
+ > host: sergioro.mx
18
+ >
19
+ < HTTP/1.1 200 OK
20
+ < date: Mon, 27 Apr 2020 06:08:17 GMT
21
+ < ...
22
+ <
23
+ header> host: localhost, port: 8000
24
+ request> get /index.html
25
+ > host: localhost
26
+ >
27
+ < HTTP/1.1 200 OK
28
+ < content-type: text/html
29
+ < ...
30
+ <
13
31
  ```
14
32
 
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install runc
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/runc.
36
-
33
+ Features and ProTips:
37
34
 
38
- ## License
35
+ - Runc relies on standard library features and has zero external dependencies.
36
+ - The default request is `GET /`.
37
+ - An empty response/header fallbacks to it's previous value.
38
+ - Case-insensitive HTTP verbs.
39
+ - Runc stands for "run connection"
39
40
 
40
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
+ [runc]: https://rubygems.org/gems/runc
@@ -55,12 +55,21 @@ class Runc
55
55
 
56
56
  def self.help # :nodoc:
57
57
  puts <<~eos
58
- -B, --no-body discard the response body
59
- -H, --no-header discard the response header
60
- -h, --help print this message
61
- -n, --host host name (default 'localhost')
62
- -p, --port port (default 8000)
63
- -v, --version print runc version
58
+ Usage:
59
+ runc [options]
60
+
61
+ Example:
62
+ runc
63
+ header> host: example.com, port: 80
64
+ request> get
65
+
66
+ Options:
67
+ -B, --no-body discard the response body
68
+ -H, --no-header discard the response header
69
+ -h, --help print this message
70
+ -n, --host host name (default 'localhost')
71
+ -p, --port port (default 8000)
72
+ -v, --version print runc version
64
73
  eos
65
74
  exit
66
75
  end
@@ -104,16 +113,20 @@ class Runc
104
113
  def repl # :nodoc:
105
114
  read_protocols
106
115
  loop do
116
+ update_header
117
+
107
118
  req_tmp=ask('request')
108
119
 
109
120
  @req = req_tmp.empty? ? @req : req_tmp
110
121
 
111
- update_header
112
-
113
122
  update_uri
114
123
 
115
124
  request=Net::HTTP.const_get(@req[/^\w+/].capitalize).new(@uri, @header)
116
125
 
126
+ if [Net::HTTP::Post, Net::HTTP::Put, Net::HTTP::Patch].include?(request.class)
127
+ request.body=ask('body')
128
+ end
129
+
117
130
  http=Net::HTTP.new(@uri.host,@uri.port)
118
131
 
119
132
  http.use_ssl = port==443 ? true : false
@@ -1,4 +1,4 @@
1
1
  class Runc
2
2
  # :nodoc
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.9"
4
4
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.email = ["yo@sergioro.com"]
8
8
 
9
9
  spec.summary = %q{Network REPL}
10
- spec.description = %q{Pronounced "runsi" stands for "run connection"}
10
+ spec.description = %q{Pronounced "runk" stands for "run connection"}
11
11
  spec.license = "MIT"
12
12
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergioro
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 13.0.1
69
- description: Pronounced "runsi" stands for "run connection"
69
+ description: Pronounced "runk" stands for "run connection"
70
70
  email:
71
71
  - yo@sergioro.com
72
72
  executables: