hobostove 0.0.1 → 0.0.2
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.
- data/bin/hobostove +6 -0
- data/lib/hobostove.rb +16 -3
- metadata +22 -5
data/bin/hobostove
ADDED
data/lib/hobostove.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'tinder'
|
4
4
|
require 'active_support/core_ext'
|
5
5
|
require 'ncurses'
|
6
|
+
require 'notify'
|
7
|
+
require 'etc'
|
6
8
|
|
7
9
|
class Configuration
|
8
10
|
class << self
|
@@ -11,7 +13,12 @@ class Configuration
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def config
|
14
|
-
@config ||= YAML.load(File.open(
|
16
|
+
@config ||= YAML.load(File.open(config_file))
|
17
|
+
end
|
18
|
+
|
19
|
+
def config_file
|
20
|
+
user = Etc.getlogin
|
21
|
+
config_file = File.join(Dir.home(user), ".hobostove.yml")
|
15
22
|
end
|
16
23
|
end
|
17
24
|
end
|
@@ -42,7 +49,7 @@ class Panel < Struct.new(:height, :width, :starty, :startx, :options)
|
|
42
49
|
|
43
50
|
Ncurses.werase(@win)
|
44
51
|
|
45
|
-
@strings.each_with_index do |string, i|
|
52
|
+
@strings.last(height - 2).each_with_index do |string, i|
|
46
53
|
@win.mvaddstr(i + 1, 2, string)
|
47
54
|
end
|
48
55
|
|
@@ -76,6 +83,7 @@ class Hobostove
|
|
76
83
|
def connect
|
77
84
|
@current_message = ""
|
78
85
|
@running = true
|
86
|
+
@users = []
|
79
87
|
|
80
88
|
start_ncurses
|
81
89
|
|
@@ -96,6 +104,8 @@ class Hobostove
|
|
96
104
|
speak
|
97
105
|
when 127 # backspace
|
98
106
|
@current_message = @current_message.first(@current_message.size - 1)
|
107
|
+
when 9 # tab
|
108
|
+
@current_message = "#{@users.find { |user| user =~ /^#@current_message/ }}: "
|
99
109
|
else
|
100
110
|
@current_message << ch.chr
|
101
111
|
end
|
@@ -119,7 +129,9 @@ class Hobostove
|
|
119
129
|
Thread.new do
|
120
130
|
room.listen do |message|
|
121
131
|
if message[:type] = "TextMessage"
|
122
|
-
|
132
|
+
message = "#{message.user.name}: #{message[:body]}"
|
133
|
+
@messages_panel << message
|
134
|
+
Notify.notify Configuration.room, message
|
123
135
|
end
|
124
136
|
end
|
125
137
|
end
|
@@ -165,6 +177,7 @@ class Hobostove
|
|
165
177
|
|
166
178
|
def load_users
|
167
179
|
room.users.each do |user|
|
180
|
+
@users << user["name"]
|
168
181
|
@users_panel << user["name"]
|
169
182
|
end
|
170
183
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobostove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tinder
|
@@ -59,14 +59,32 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: notify
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: Command line client for campfire
|
63
79
|
email:
|
64
80
|
- eric@oestrich.org
|
65
|
-
executables:
|
81
|
+
executables:
|
82
|
+
- hobostove
|
66
83
|
extensions: []
|
67
84
|
extra_rdoc_files: []
|
68
85
|
files:
|
69
86
|
- lib/hobostove.rb
|
87
|
+
- bin/hobostove
|
70
88
|
homepage: http://github.com/oestrich/hobostove
|
71
89
|
licenses: []
|
72
90
|
post_install_message:
|
@@ -87,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
105
|
version: 1.3.6
|
88
106
|
requirements: []
|
89
107
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.8.
|
108
|
+
rubygems_version: 1.8.24
|
91
109
|
signing_key:
|
92
110
|
specification_version: 3
|
93
111
|
summary: Command line client for campfire
|
94
112
|
test_files: []
|
95
|
-
has_rdoc:
|