nidobata 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: d0faae6c38228f05766b47dd98978ee1500f959b
4
- data.tar.gz: 017db548a4a75a93eee2dcf057d1bac557f742ef
3
+ metadata.gz: 28923e7136f125f2cc070b8cf3f9f53ee5fa59f3
4
+ data.tar.gz: d06a7763f4f873b47ee713c429037a310efad830
5
5
  SHA512:
6
- metadata.gz: 3ae8cbe8761b191f81ae751930ea0f2955a0ff4a415432baa237fb9ba8f0b693e5889a408a044a74443908eeb02a327d1208acbe8a8d4d480f6eaa528242b8c6
7
- data.tar.gz: 8d4c6e5d183b838cf5f207c96c2b25de704a2818a1fd10e8ed4a03b682254d3047a6d88c86ef277f7e5bcd74c246ca1f0d485f088a51803da5808f7e5354d714
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
+ ![selection_553](https://cloud.githubusercontent.com/assets/43346/21834741/10668980-d7fb-11e6-9852-b587950e3982.png)
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: ⏎ hibariya@lerche:~/s/g/i/nidobata|master⚡*
15
- $ uname -a | nidobata post esm idobata-flood
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/[USERNAME]/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.
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
@@ -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
- http.post('/api/messages', {room_id: room_id, source: message}.to_json, default_headers).value
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
@@ -1,3 +1,3 @@
1
1
  module Nidobata
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
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.1.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.6.8
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.