eatmysoul 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/TODO.rdoc +4 -0
- data/bin/eatmysoul +6 -6
- data/eatmysoul.gemspec +1 -0
- data/lib/eatmysoul/version.rb +1 -1
- data/lib/eatmysoul.rb +22 -14
- metadata +15 -3
data/README.rdoc
CHANGED
@@ -24,7 +24,7 @@ client, but i was wanting to implement one for some times, so i did.
|
|
24
24
|
|
25
25
|
== Usage
|
26
26
|
|
27
|
-
|
27
|
+
eatmysoul [run|start|stop] -- [--config-file=/path] [--login=login_x] [--location==loc]
|
28
28
|
|
29
29
|
* Run it once (e.g. ruby1.8 eatmysoul.rb), and it will produce a template configuration file (defaults to '~/.eatmysoul.yml')
|
30
30
|
* Edit this file. (especially the login and password)
|
data/TODO.rdoc
ADDED
data/bin/eatmysoul
CHANGED
@@ -31,12 +31,12 @@
|
|
31
31
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
32
|
# POSSIBILITY OF SUCH DAMAGE.
|
33
33
|
|
34
|
+
require 'daemons'
|
34
35
|
require 'eatmysoul'
|
35
36
|
|
36
|
-
|
37
|
-
o = EatMySoul::Settings.new
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
EatMySoul.connect_loop(o)
|
37
|
+
Daemons.run_proc ('eatmysoul') do
|
38
|
+
o = EatMySoul::Settings.new
|
39
|
+
Signal.trap("PIPE") { EatMySoul.connect_loop o }
|
40
|
+
EatMySoul.connect_loop(o)
|
41
|
+
end
|
42
42
|
|
data/eatmysoul.gemspec
CHANGED
data/lib/eatmysoul/version.rb
CHANGED
data/lib/eatmysoul.rb
CHANGED
@@ -43,25 +43,33 @@ module EatMySoul
|
|
43
43
|
|
44
44
|
class Settings
|
45
45
|
# edit the next line to change the default path
|
46
|
-
def initialize(
|
47
|
-
path = "/etc/eatmysoul.yml" if `id` =~ /root/
|
48
|
-
@options = {
|
49
|
-
:server => "ns-server.epita.fr",
|
50
|
-
:port => 4242,
|
51
|
-
:daemon => false,
|
52
|
-
:login => "login_x",
|
53
|
-
:passwd => "pwd_socks",
|
54
|
-
:logfile => "STDOUT",
|
55
|
-
:loglevel => "WARN",
|
56
|
-
:location => "somewhere",
|
57
|
-
:status => "chatless client"
|
58
|
-
}
|
59
|
-
|
46
|
+
def initialize()
|
60
47
|
begin
|
48
|
+
@options = {
|
49
|
+
:server => "ns-server.epita.fr",
|
50
|
+
:port => 4242,
|
51
|
+
:login => "login_x",
|
52
|
+
:passwd => "pwd_socks",
|
53
|
+
:logfile => "STDOUT",
|
54
|
+
:loglevel => "WARN",
|
55
|
+
:location => "somewhere",
|
56
|
+
:status => "chatless client"
|
57
|
+
}
|
58
|
+
|
59
|
+
parser = Trollop::Parser.new
|
60
|
+
parser.opt(:config_file, "Configuration file path",
|
61
|
+
:default => (if `id` =~ /root/ then "/etc/eatmysoul.yml"
|
62
|
+
else "#{ENV['HOME']}/.eatmysoul.yml" end))
|
63
|
+
@options.each { |k,v| parser.opt(k, k.to_s, :type => :string) }
|
64
|
+
cli_opts = parser.parse.delete_if { |k,v| not v or k =~ /_given/ }
|
65
|
+
puts cli_opts
|
66
|
+
path = cli_opts.delete :config_file
|
67
|
+
|
61
68
|
if File.exists? path
|
62
69
|
yaml = YAML::load_file(path)
|
63
70
|
@options.merge! yaml
|
64
71
|
end
|
72
|
+
@options.merge! cli_opts
|
65
73
|
|
66
74
|
save path
|
67
75
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eatmysoul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
16
|
-
requirement: &
|
16
|
+
requirement: &21474680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21474680
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: daemons
|
27
|
+
requirement: &21474260 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *21474260
|
25
36
|
description: A simple netsoul (epitech's internal network protocol) client, mainly
|
26
37
|
targeting servers
|
27
38
|
email:
|
@@ -36,6 +47,7 @@ files:
|
|
36
47
|
- Gemfile.lock
|
37
48
|
- README.rdoc
|
38
49
|
- Rakefile
|
50
|
+
- TODO.rdoc
|
39
51
|
- bin/eatmysoul
|
40
52
|
- eatmysoul.gemspec
|
41
53
|
- lib/eatmysoul.rb
|