textbringer-http_client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/textbringer/http_client.rb +4 -0
- data/lib/textbringer/http_client/commands.rb +37 -0
- data/lib/textbringer/http_client/version.rb +7 -0
- data/lib/textbringer_plugin.rb +3 -0
- data/textbringer-http_client.gemspec +28 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4ecd4b9b6e298ba0b55261636966e33f542028661f8d024013c34e43cbd0ef5a
|
4
|
+
data.tar.gz: 4dd010a11bef5f80e5f4746b37116d2fd626c5462d47fae59d8b94d2f7aef609
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7db02a3d5462c53a99c8faa0e33d2f297f404f92610b3890a882954182180c79d3458269e04fb1f55fc63c28ab456682b327349e7c0329ae98a748f3d413923d
|
7
|
+
data.tar.gz: 488d387e0d881f0a8ce0723b3a4def85ab52d4e356e3cb01f26444fc4b7376193269d472ca1e34c252a129654c97c7a2bd0955a2d8d6ba9ed8582580d0c0cc19
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Shugo Maeda
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# textbringer-ghost_text
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/textbringer-ghost_text.svg)](https://badge.fury.io/rb/textbringer-ghost_text)
|
4
|
+
|
5
|
+
[GhostText](https://github.com/GhostText/GhostText) plugin for [Textbringer](https://github.com/shugo/textbringer).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
$ gem install textbringer-ghost_text
|
10
|
+
|
11
|
+
## Configuration
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
# The host of the GhostText server.
|
15
|
+
CONFIG[:ghost_text_host] = "127.0.0.1"
|
16
|
+
# The port of the GhostText server.
|
17
|
+
CONFIG[:ghost_text_port] = 4001
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Type `M-x ghost_text_start` to start the server.
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
27
|
+
|
28
|
+
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).
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/shugo/textbringer-ghost_text.
|
33
|
+
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "textbringer/ghost_text"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "uri"
|
4
|
+
require "net/http"
|
5
|
+
|
6
|
+
define_command(:send_http_request,
|
7
|
+
doc: "Send an HTTP request") do
|
8
|
+
s = Buffer.current.to_s
|
9
|
+
m = %r'(?:(?<method>GET|HEAD|POST|PUT|DELETE|OPTIONS|TRACE|PATCH|PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK) *)?(?<uri>https?://\S*)\n(?<header>([^\n]*?:[^\n]*\n)+)?(\n(?<body>.+))?'m.match(s)
|
10
|
+
if m.nil?
|
11
|
+
raise "No request found"
|
12
|
+
end
|
13
|
+
uri = URI.parse(m[:uri])
|
14
|
+
background do
|
15
|
+
Net::HTTP.start(uri.host, uri.port,
|
16
|
+
use_ssl: uri.scheme == "https") do |http|
|
17
|
+
header = m[:header]&.scan(/(.*): *(.*)\n/)&.to_h
|
18
|
+
req = Net::HTTP.const_get(m[:method].capitalize).new(uri, header)
|
19
|
+
res = http.request(req, m[:body])
|
20
|
+
foreground do
|
21
|
+
buffer = Buffer.find_or_new("*response*", undo_limit: 0,
|
22
|
+
read_only: true)
|
23
|
+
buffer.read_only_edit do
|
24
|
+
buffer.clear
|
25
|
+
buffer.insert("HTTP/#{res.http_version} #{res.code} #{res.message}\n")
|
26
|
+
res.each_header do |name, val|
|
27
|
+
buffer.insert("#{name.capitalize}: #{val}\n")
|
28
|
+
end
|
29
|
+
buffer.insert("\n")
|
30
|
+
buffer.insert(res.body)
|
31
|
+
end
|
32
|
+
buffer.beginning_of_buffer
|
33
|
+
switch_to_buffer(buffer)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'textbringer/http_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "textbringer-http_client"
|
8
|
+
spec.version = Textbringer::HttpClient::VERSION
|
9
|
+
spec.authors = ["Shugo Maeda"]
|
10
|
+
spec.email = ["shugo@ruby-lang.org"]
|
11
|
+
|
12
|
+
spec.summary = "HTTP client plugin for Textbringer."
|
13
|
+
spec.description = "HTTP client plugin for Textbringer."
|
14
|
+
spec.homepage = "https://github.com/shugo/textbringer-http_client"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "textbringer"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: textbringer-http_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shugo Maeda
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: textbringer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: HTTP client plugin for Textbringer.
|
56
|
+
email:
|
57
|
+
- shugo@ruby-lang.org
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- bin/console
|
68
|
+
- bin/setup
|
69
|
+
- lib/textbringer/http_client.rb
|
70
|
+
- lib/textbringer/http_client/commands.rb
|
71
|
+
- lib/textbringer/http_client/version.rb
|
72
|
+
- lib/textbringer_plugin.rb
|
73
|
+
- textbringer-http_client.gemspec
|
74
|
+
homepage: https://github.com/shugo/textbringer-http_client
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubygems_version: 3.1.0.pre1
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: HTTP client plugin for Textbringer.
|
97
|
+
test_files: []
|