hcutil 0.0.4 → 0.0.5

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: bf3a6882a040189533cd1a350eb8fc306cce1218
4
- data.tar.gz: 8289619d46f7cd79cf2ef67c0d9aa68adb88823a
3
+ metadata.gz: 75708b9ea3e3a9c429f6751f4042e5bb88d5a71d
4
+ data.tar.gz: 25d93fb505e9e4223625703e1df565e82465cbc4
5
5
  SHA512:
6
- metadata.gz: 963143ee74e502eba3e0dc746c4a4a8d0f4373bf3352b5253fd59f160a7921ba210ebfa3e75bc8bc38b86e31cd9a8fa159182456ceff7f9c865c152a859481ce
7
- data.tar.gz: 4be63ce8ec8198671b38a14e563edfcb1540d5442ec8b9685255efce8cd1a771bff201b0acc9c1d8a59ffadc0d649af531a7190107fe32cf071bdc60b4997a39
6
+ metadata.gz: 0a54a3ac1d443ae8da94430cb3bc81aedc84546d921817c9c19532d7c0e8724ecddbbe1e2a0d53ecc93a1268219551ac46a5c5228f09271c3dca88f19d665b0e
7
+ data.tar.gz: 242c3a08d8576e52144a7a5622c9048d0565c6e24b6b8ed24f170efa8d828c54c1fd61b12cac3c9061b08e8f11a8e9f2ea2a2d9a52996ec4f3b917703ac7a251
data/lib/hcutil/cli.rb CHANGED
@@ -44,7 +44,7 @@ module HCUtil
44
44
  end
45
45
  end
46
46
 
47
- desc('paste FILE', 'Paste from file (- for stdin) into HipChat room')
47
+ desc('paste THING', 'Paste from thing (- for stdin, a file if it is a valid filename, or literal string otherwise) into HipChat room')
48
48
  option(:room,
49
49
  :desc => 'HipChat room name or number into which to paste data',
50
50
  :type => :string,
@@ -58,9 +58,9 @@ module HCUtil
58
58
  :desc => 'Summary, optional. If present will create message header',
59
59
  :type => :string,
60
60
  :aliases => '-s')
61
- def paste(file)
61
+ def paste(thing)
62
62
  begin
63
- paster = HCUtil::Paster.new(file, options)
63
+ paster = HCUtil::Paster.new(thing, options)
64
64
  paster.paste()
65
65
  rescue Errors::HCUtilError => e
66
66
  $stderr.puts("[error] #{e.message}")
data/lib/hcutil/paster.rb CHANGED
@@ -5,23 +5,21 @@ require 'hcutil/op_base'
5
5
  module HCUtil
6
6
 
7
7
  class Paster < OpBase
8
- def initialize(file, options = {})
8
+ def initialize(thing, options = {})
9
9
  super(options)
10
- if file == '-' or File.exists?(file)
11
- @file = file
12
- else
13
- raise(Errors::PasterError, "Response file '#{file}' does not exist")
14
- end
10
+ @thing = thing
15
11
  @room = options[:room]
16
12
  @ticket = options[:ticket]
17
13
  @summary = options[:summary]
18
14
  end
19
15
 
20
16
  def paste
21
- if @file == '-'
22
- file_contents = $stdin.read
17
+ if @thing == '-'
18
+ thing_contents = $stdin.read
19
+ elsif File.exists?(@thing)
20
+ thing_contents = File.read(@thing)
23
21
  else
24
- file_contents = File.read(@file)
22
+ thing_contents = @thing
25
23
  end
26
24
 
27
25
  if @ticket
@@ -32,7 +30,7 @@ module HCUtil
32
30
  end
33
31
  message = <<"EOT"
34
32
  #{paste_header}
35
- #{file_contents}
33
+ #{thing_contents}
36
34
  EOT
37
35
  post_data = {
38
36
  :message_format => 'text',
@@ -1,3 +1,3 @@
1
1
  module HCUtil
2
- VERSION = '0.0.4'.freeze
2
+ VERSION = '0.0.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hcutil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Bakken
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
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
13
  - !ruby/object:Gem::Dependency
28
14
  name: thor
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +38,7 @@ dependencies:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '1.7'
55
- description:
41
+ description: " Utility for working with HipChat from the command line "
56
42
  email:
57
43
  - luke@bowbak.org
58
44
  executables:
@@ -72,7 +58,9 @@ files:
72
58
  - lib/hcutil/paster.rb
73
59
  - lib/hcutil/version.rb
74
60
  homepage: http://github.com/lukebakken/hipchat-util
75
- licenses: []
61
+ licenses:
62
+ - Unlicense
63
+ - Public Domain
76
64
  metadata: {}
77
65
  post_install_message:
78
66
  rdoc_options: []