nidobata 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/lib/nidobata.rb +10 -2
- data/lib/nidobata/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28923e7136f125f2cc070b8cf3f9f53ee5fa59f3
|
4
|
+
data.tar.gz: d06a7763f4f873b47ee713c429037a310efad830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03961df86ad5a0d39993706797caf4c7f2fff1d4abe07153b7962eec3c1071b4c784a8ede542536dbb70a771d413b6af75b2cb8637c9da59ac0a0cdffb3a6b7e
|
7
|
+
data.tar.gz: a5a1373448d219fb5f2e26318d0ed29323eb2582172bedc820f833dc9183cea1d9427215e41fd4bcb1eb548d52603b2db203bc550ff7919a3b7d4a9b81c7e24d
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
`nidobata` command reads stdin and posts it into idobata.io.
|
4
4
|
|
5
|
+

|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
$ gem install nidobata
|
@@ -11,8 +13,14 @@
|
|
11
13
|
```
|
12
14
|
$ nidobata init
|
13
15
|
Email: hibariya@example.com
|
14
|
-
Password: ⏎
|
15
|
-
$ uname -a | nidobata post
|
16
|
+
Password: ⏎
|
17
|
+
$ uname -a | nidobata post my-org-slug my-room
|
18
|
+
```
|
19
|
+
|
20
|
+
`--pre` option surrounds input with `<pre></pre>`.
|
21
|
+
|
22
|
+
```
|
23
|
+
$ cat README.md | nidobata post my-org-slug my-room --pre
|
16
24
|
```
|
17
25
|
|
18
26
|
## Development
|
@@ -23,7 +31,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
23
31
|
|
24
32
|
## Contributing
|
25
33
|
|
26
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/idobata/nidobata. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
27
35
|
|
28
36
|
|
29
37
|
## License
|
data/lib/nidobata.rb
CHANGED
@@ -22,7 +22,8 @@ module Nidobata
|
|
22
22
|
netrc.save
|
23
23
|
end
|
24
24
|
|
25
|
-
desc 'post ORG_SLUG ROOM_NAME [MESSAGE]', 'Post a message from stdin or 2nd argument.'
|
25
|
+
desc 'post ORG_SLUG ROOM_NAME [MESSAGE] [--pre]', 'Post a message from stdin or 2nd argument.'
|
26
|
+
option :pre, type: :boolean
|
26
27
|
def post(slug, room_name, message = $stdin.read)
|
27
28
|
abort 'Message is required.' unless message
|
28
29
|
ensure_api_token
|
@@ -30,7 +31,14 @@ module Nidobata
|
|
30
31
|
rooms = JSON.parse(http.get("/api/rooms?organization_slug=#{slug}&room_name=#{room_name}", default_headers).tap(&:value).body)
|
31
32
|
room_id = rooms['rooms'][0]['id']
|
32
33
|
|
33
|
-
|
34
|
+
payload =
|
35
|
+
if options[:pre]
|
36
|
+
{room_id: room_id, source: "<pre>\n#{message}</pre>", format: 'html'}
|
37
|
+
else
|
38
|
+
{room_id: room_id, source: message}
|
39
|
+
end
|
40
|
+
|
41
|
+
http.post('/api/messages', payload.to_json, default_headers).value
|
34
42
|
end
|
35
43
|
|
36
44
|
no_commands do
|
data/lib/nidobata/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nidobata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hibariya
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.5.1
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Read stdin and post it into idobata.io.
|