hector 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/hector +11 -0
- data/bin/hector-daemon +14 -0
- data/bin/hector-identity +34 -0
- data/bin/hector-setup +31 -0
- data/lib/hector/version.rb +1 -1
- metadata +13 -6
data/bin/hector
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
commands = Dir[File.dirname(__FILE__) + "/hector-*"].map { |filename| filename[/-([^\/]*)$/, 1] }.sort
|
4
|
+
command = ARGV[0]
|
5
|
+
|
6
|
+
if commands.include?(command)
|
7
|
+
exec(File.dirname(__FILE__) + "/hector-#{command}", *ARGV[1..-1])
|
8
|
+
else
|
9
|
+
$stderr.puts "usage: hector <#{commands.join(" | ")}> ..."
|
10
|
+
exit 1
|
11
|
+
end
|
data/bin/hector-daemon
ADDED
data/bin/hector-identity
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "hector/boot"
|
4
|
+
Hector.start
|
5
|
+
|
6
|
+
def read_password
|
7
|
+
`stty -echo`
|
8
|
+
$stderr.print "Enter password: "
|
9
|
+
$stdin.gets.chomp
|
10
|
+
ensure
|
11
|
+
$stderr.print "\n"
|
12
|
+
`stty echo`
|
13
|
+
end
|
14
|
+
|
15
|
+
command, username, password = ARGV[0], ARGV[1], ARGV[2]
|
16
|
+
command = nil unless username
|
17
|
+
|
18
|
+
case command
|
19
|
+
when "authenticate"
|
20
|
+
exit Hector::Identity.adapter.authenticate(username, password || read_password) ? 0 : -1
|
21
|
+
|
22
|
+
when "remember"
|
23
|
+
Hector::Identity.adapter.remember(username, password || read_password)
|
24
|
+
|
25
|
+
when "forget"
|
26
|
+
Hector::Identity.adapter.forget(username)
|
27
|
+
|
28
|
+
else
|
29
|
+
$stderr.puts "usage: hector identity authenticate <username> [password]"
|
30
|
+
$stderr.puts " hector identity remember <username> [password]"
|
31
|
+
$stderr.puts " hector identity forget <username>"
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
|
data/bin/hector-setup
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "hector/boot"
|
4
|
+
require "fileutils"
|
5
|
+
|
6
|
+
include FileUtils::Verbose
|
7
|
+
|
8
|
+
def setup(name)
|
9
|
+
path = Pathname.new("#{name.gsub(/\.hect$/, "")}.hect")
|
10
|
+
mkdir_p path
|
11
|
+
|
12
|
+
mkdir_p path.join("config")
|
13
|
+
touch path.join("config/identities.yml")
|
14
|
+
mkdir_p path.join("log")
|
15
|
+
touch path.join("log/hector.log")
|
16
|
+
|
17
|
+
unless File.exist?(path.join("init.rb"))
|
18
|
+
File.open(path.join("init.rb"), "w") do |f|
|
19
|
+
f.puts <<-EOS
|
20
|
+
Hector.server_name = #{"#{name}.irc".inspect}
|
21
|
+
EOS
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if name = ARGV[0]
|
27
|
+
setup name
|
28
|
+
else
|
29
|
+
$stderr.puts "usage: hector setup <name>"
|
30
|
+
exit 1
|
31
|
+
end
|
data/lib/hector/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sam Stephenson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-23 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -53,8 +53,11 @@ dependencies:
|
|
53
53
|
description: A private group chat server for people you trust. Implements a limited subset of the IRC protocol.
|
54
54
|
email:
|
55
55
|
- sstephenson@gmail.com
|
56
|
-
executables:
|
57
|
-
|
56
|
+
executables:
|
57
|
+
- hector
|
58
|
+
- hector-daemon
|
59
|
+
- hector-identity
|
60
|
+
- hector-setup
|
58
61
|
extensions: []
|
59
62
|
|
60
63
|
extra_rdoc_files: []
|
@@ -95,6 +98,10 @@ files:
|
|
95
98
|
- lib/hector/version.rb
|
96
99
|
- lib/hector/yaml_identity_adapter.rb
|
97
100
|
- lib/hector.rb
|
101
|
+
- bin/hector
|
102
|
+
- bin/hector-daemon
|
103
|
+
- bin/hector-identity
|
104
|
+
- bin/hector-setup
|
98
105
|
has_rdoc: true
|
99
106
|
homepage: http://github.com/sstephenson/hector
|
100
107
|
licenses: []
|