influence 0.0.2 → 0.0.4
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/influence +5 -1
- data/bin/influencer +32 -23
- data/influence.gem +1 -1
- data/lib/influence/config.rb +1 -1
- data/lib/influence/server.rb +7 -5
- metadata +1 -1
data/bin/influence
CHANGED
@@ -3,5 +3,9 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'daemons'
|
5
5
|
|
6
|
-
|
6
|
+
if '--log' == ARGV[0]
|
7
|
+
puts File.join(File.dirname(__FILE__), 'influence.log')
|
8
|
+
else
|
9
|
+
Daemons.run(File.join(File.dirname(__FILE__), 'influenced'))
|
10
|
+
end
|
7
11
|
|
data/bin/influencer
CHANGED
@@ -6,32 +6,41 @@ require 'socket'
|
|
6
6
|
require 'json'
|
7
7
|
require 'influence/config'
|
8
8
|
|
9
|
+
module Influence
|
10
|
+
class Client
|
11
|
+
DEFAULT_HOST = 'localhost'
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@port = port
|
13
|
+
def initialize(host = Influence::Client::DEFAULT_HOST, port = Influence::DEFAULT_PORT)
|
14
|
+
@host = host
|
15
|
+
@port = port
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
@data = {
|
18
|
+
:url => 'github.com',
|
19
|
+
:action => :install,
|
20
|
+
:big1 => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
21
|
+
:big2 => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
22
|
+
}
|
21
23
|
|
22
|
-
|
24
|
+
end
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
def connect
|
27
|
+
server = TCPSocket.open(@host, @port)
|
28
|
+
server.puts(@data.to_json)
|
29
|
+
response = server.readline
|
30
|
+
ap response
|
31
|
+
response = JSON.parse(response)
|
32
|
+
ap response
|
33
|
+
rescue Errno::ECONNREFUSED => err
|
34
|
+
puts "Could not connect to #{@host}:#{@port}. Check that the influence server is running with 'influence_server status'."
|
35
|
+
puts err if $DEBUG
|
36
|
+
end
|
37
|
+
end#class
|
38
|
+
end#module
|
39
|
+
|
40
|
+
|
41
|
+
if '-h' == ARGV[0] || '-help' == ARGV[0] || '--help' == ARGV[0]
|
42
|
+
puts "Usage: influencer [host] [port]"
|
43
|
+
else
|
44
|
+
Influence::Client.new(*ARGV).connect
|
35
45
|
end
|
36
46
|
|
37
|
-
Influencer.new.connect
|
data/influence.gem
CHANGED
data/lib/influence/config.rb
CHANGED
data/lib/influence/server.rb
CHANGED
@@ -5,12 +5,14 @@ module Influence
|
|
5
5
|
class Server < GServer
|
6
6
|
Log = Logger.new(File.join(File.dirname(__FILE__), "..", "..", "bin", 'influence.log'), 5, 1024000)
|
7
7
|
|
8
|
-
def initialize(port
|
9
|
-
|
8
|
+
def initialize(port, options = {})
|
9
|
+
@port = port
|
10
|
+
@options = options
|
11
|
+
super(port, options[:host] || Influence::DEFAULT_HOST)
|
10
12
|
end
|
11
|
-
|
12
|
-
def self.launch
|
13
|
-
@server
|
13
|
+
|
14
|
+
def self.launch(options={})
|
15
|
+
@server = new(options[:port] || Influence::DEFAULT_PORT)
|
14
16
|
@server.audit = true
|
15
17
|
@server.start
|
16
18
|
@server.join
|