eatmysoul 0.0.2 → 0.1.0

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/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
- rubyxxx eatmysoul.rb [config_file]
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
@@ -0,0 +1,4 @@
1
+ # Todo file for eatmysoul
2
+
3
+ * Implement an install mode, which can install eatmysoul on linux server (init scripts and stuffs)
4
+
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
- o = EatMySoul::Settings.new ARGV[0] if ARGV.length >= 1
37
- o = EatMySoul::Settings.new unless ARGV.length >= 1
38
-
39
- Process.daemon if o.daemon == "true" or o.daemon == "yes"
40
- Signal.trap("PIPE") { EatMySoul.connect_loop o }
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
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
23
  s.add_runtime_dependency "eventmachine"
24
+ s.add_runtime_dependency "daemons"
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module Eatmysoul
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
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(path = "#{ENV['HOME']}/.eatmysoul.yml")
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.2
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: &12060440 !ruby/object:Gem::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: *12060440
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