hubeye 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +150 -35
- data/README.md.html +212 -0
- data/VERSION.rb +2 -2
- data/bin/hubeye +20 -1
- data/lib/config/parser.rb +60 -0
- data/lib/environment.rb +1 -1
- data/lib/helpers/time.rb +5 -0
- data/lib/log/logger.rb +3 -2
- data/lib/server/hubeye_server.rb +187 -37
- data/test/config_parser.rb +114 -0
- data/test/environment.rb +18 -0
- data/test/notification.rb +0 -2
- data/test/runner.rb +15 -0
- metadata +11 -10
- data/Rakefile +0 -34
- data/lib/timehelper/timehelper.rb +0 -3
- data/test/test.rb +0 -4
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
#Hubeye
|
2
|
+
<br />
|
3
|
+
Keep track of repositories on Github, get notified when they change and<br />
|
4
|
+
(optionally) run local system commands when new commits come in to Github.<br />
|
5
|
+
<br />
|
2
6
|
|
3
|
-
Hubeye is composed of a client and server. Once the server is run
|
4
|
-
you can connect to it via the client. Once connected, you'll be
|
5
|
-
prompted by a '>'. Type the name of a Github repository.
|
7
|
+
Hubeye is composed of a client and server. Once the server is run,<br />
|
8
|
+
you can connect to it via the client. Once connected, you'll be<br />
|
9
|
+
prompted by a '>'. Type the name of a Github repository.
|
6
10
|
|
7
11
|
Example: (what the user enters is preceded by the prompt)
|
8
12
|
|
@@ -12,63 +16,174 @@ Example: (what the user enters is preceded by the prompt)
|
|
12
16
|
parent ea63fe317fe58dff1c95
|
13
17
|
log tracking info for repos on client quit => luke-gru
|
14
18
|
|
15
|
-
What you see is the latest commit reference, tree reference and parent
|
16
|
-
commit reference on Github for that repository. Note that the user did
|
17
|
-
not type a username. This is because the user defined a username in his
|
18
|
-
~/.hubeyerc file.
|
19
|
+
What you see is the latest commit reference, tree reference and parent<br />
|
20
|
+
commit reference on Github for that repository. Note that the user did<br />
|
21
|
+
not type a username. This is because the user defined a username in his<br />
|
22
|
+
~/.hubeye/hubeyerc file.
|
19
23
|
|
20
|
-
|
24
|
+
##Starting Hubeye
|
21
25
|
|
22
|
-
|
26
|
+
To start the server:
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
>hubeye -s
|
29
|
+
or just
|
30
|
+
|
31
|
+
>hubeye
|
32
|
+
|
33
|
+
This starts the server as a daemonized process. To run the server in<br />
|
34
|
+
your terminal (on <b>t</b>op):
|
35
|
+
|
36
|
+
>hubeye -st
|
37
|
+
|
38
|
+
Hubeye runs on port 2000 be default. Change the port like this:
|
39
|
+
|
40
|
+
>hubeye -sp 9001
|
41
|
+
|
42
|
+
To connect with the client:
|
43
|
+
|
44
|
+
>hubeye -c
|
45
|
+
|
46
|
+
For more options:
|
47
|
+
|
48
|
+
>hubeye -h
|
49
|
+
|
50
|
+
|
51
|
+
###~/.hubeye/hubeyerc
|
52
|
+
|
53
|
+
username: luke-gru
|
54
|
+
|
55
|
+
This allows the user to type a repository name only, and to receive<br />
|
56
|
+
information regarding that <i>username</i>'s repository. The username<br />
|
57
|
+
should be a valid Github username.
|
27
58
|
|
28
59
|
###Keeping track of repositories
|
29
60
|
|
30
|
-
Hubeye doesn't actually track any repositories unless you disconnect
|
61
|
+
Hubeye doesn't actually track any repositories unless you disconnect<br />
|
31
62
|
from the server and leave the server running. This can be done by:
|
32
63
|
|
33
64
|
>quit
|
34
65
|
Bye!
|
35
66
|
|
36
|
-
If Hubeye has any repos to watch, it will watch Github for changes
|
37
|
-
It can keep track of as many repos as you want; just keep typing
|
38
|
-
them in. If Hubeye finds a change
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
67
|
+
If Hubeye has any repos to watch (track), it will watch Github for changes.<br />
|
68
|
+
It can keep track of as many repos as you want; just keep typing<br />
|
69
|
+
them in. If Hubeye finds a change to a repo, it will notify you of the<br />
|
70
|
+
changes using your Desktop notification system (libnotify, growl). It will<br />
|
71
|
+
also log the changes to your $HOME/.hubeye/log file. If the server is run<br />
|
72
|
+
in a terminal (-t option), the changes will also be logged to the terminal.<br
|
73
|
+
/>
|
43
74
|
|
44
|
-
|
75
|
+
To track your own repository, start the client in the root directory<br />
|
76
|
+
of your local git repo:
|
77
|
+
|
78
|
+
>.
|
79
|
+
|
80
|
+
This only works if a <i>username</i> is added to the hubeyerc, and if the<br />
|
81
|
+
Github repository name is the same as the local root directory name.<br />
|
82
|
+
ie: '.' put in '/home/luke/code/hubeye' would track https://www.github.com/
|
83
|
+
luke-gru/hubeye<br />
|
84
|
+
if <i>username</i> was set to luke-gru.<br />
|
45
85
|
|
46
|
-
|
47
|
-
add another user's repo like this:
|
86
|
+
You can add another user's repo like this:
|
48
87
|
|
49
88
|
>rails/rails
|
50
89
|
|
51
|
-
This adds https://github.com/rails/rails to the watch list
|
90
|
+
This adds https://github.com/rails/rails to the watch list.<br />
|
91
|
+
Hubeye does not remove a repo from the watch list unless explicitly<br />
|
92
|
+
told to do so:
|
93
|
+
|
94
|
+
>rm luke-gru/hubeye
|
95
|
+
|
96
|
+
To see a list of all repos (with recent commit messages) in the watch (track) list:
|
97
|
+
|
98
|
+
>tracking
|
99
|
+
|
100
|
+
###Desktop Notification
|
101
|
+
<i>On Linux: install libnotify-bin. On Mac: install growl (if not already installed).<br />
|
102
|
+
The autotest gem is needed for Desktop notification to work in both
|
103
|
+
cases.</i><br />
|
104
|
+
|
105
|
+
###Shutting down and persistence between sessions
|
52
106
|
|
53
|
-
###Shutting down
|
54
|
-
|
55
107
|
>shutdown
|
56
108
|
|
57
|
-
Next time you start up the server, the watch list
|
58
|
-
In order to have a default watch list:
|
109
|
+
Next time you start up the server, the watch list will be empty<br />
|
110
|
+
(and so will the log file). In order to have a default watch list:
|
111
|
+
|
112
|
+
<i>~/.hubeye/hubeyerc</i>
|
113
|
+
|
114
|
+
track: rails/rails, dchelimsky/rspec
|
115
|
+
|
116
|
+
These will be watched automatically when starting up the server.<br />
|
117
|
+
|
118
|
+
A way to interactively save all currently tracked repositories:
|
119
|
+
|
120
|
+
>save repos as my_work_repos
|
121
|
+
|
122
|
+
And then load any time (even after a shutdown; next session, next week, etc...)
|
123
|
+
|
124
|
+
>load repos my_work_repos
|
125
|
+
|
126
|
+
###Working with hooks
|
127
|
+
|
128
|
+
>hook add rails/rails dir: /path/to/local/rails cmd: git pull origin master
|
129
|
+
|
130
|
+
When <b>https://www.github.com/rails/rails</b> changes, a process will start,
|
131
|
+
<br />
|
132
|
+
change to the selected directory and execute the command. The <i>(dir: /my/dir)
|
133
|
+
<br />
|
134
|
+
</i> part is optional, and when ignored won't change directories. In this
|
135
|
+
case,
|
136
|
+
<br />
|
137
|
+
the directory will be where the hubeye server was originally
|
138
|
+
started from.<br />
|
59
139
|
|
60
|
-
|
140
|
+
To see all currently loaded hooks:
|
61
141
|
|
62
|
-
|
142
|
+
>hook list
|
63
143
|
|
64
|
-
|
144
|
+
To save all hooks for next sessions (after a server shutdown)
|
145
|
+
|
146
|
+
>save hooks as weekend_projects_hooks
|
147
|
+
|
148
|
+
Then, next weekend:
|
149
|
+
|
150
|
+
>load hooks weekend_projects_hooks
|
151
|
+
|
152
|
+
These hooks, of course, will only really do anything if the repositories they
|
153
|
+
<br />
|
154
|
+
are hooked to are currently being watched. This is not done automatically.
|
65
155
|
|
66
156
|
###All ~/.hubeyerc configurations
|
67
157
|
|
68
|
-
|
69
|
-
|
158
|
+
When the server is started, the options are set here.
|
159
|
+
|
160
|
+
username: luke-gru
|
161
|
+
track: username/reponame, username2/reponame2, myreponame
|
70
162
|
oncearound = 90
|
163
|
+
load hooks: myhook1, myworkhooks
|
164
|
+
load repos: workprojects, funprojects
|
165
|
+
desktop notification: on/off
|
166
|
+
|
167
|
+
<i>username</i>: username used for Github URLS when the full path is not
|
168
|
+
given<br />
|
169
|
+
inside of the client.<br />
|
170
|
+
|
171
|
+
<i>track</i>: default repositories to watch for changes upon server start<br />
|
172
|
+
|
173
|
+
<i>oncearound</i>: number of seconds before completing a check of every repo in<br />
|
174
|
+
the watch list for changes<br />
|
175
|
+
|
176
|
+
<i>load hooks</i>: load hooks on server start. To see how to save hooks in the
|
177
|
+
<br />
|
178
|
+
client, see the <i>Working with hooks</i> section<br />
|
179
|
+
|
180
|
+
<i>load repos</i>: load repos on server start. To see how to save repos in the
|
181
|
+
<br />
|
182
|
+
client, see the <i>Shutting down and persistence between sessions</i> section.
|
183
|
+
<br />
|
71
184
|
|
72
|
-
|
73
|
-
|
185
|
+
<i>desktop notification</i>: whether to notify of repo changes using libnotify
|
186
|
+
<br />
|
187
|
+
or growl. This is set to <i>on</i> by default. However, if no notification<br />
|
188
|
+
system is found, it is ignored.
|
74
189
|
|
data/README.md.html
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
<h1>Hubeye</h1>
|
2
|
+
|
3
|
+
<p><br />
|
4
|
+
Keep track of repositories on Github, get notified when they change and<br />
|
5
|
+
(optionally) run local system commands when new commits come in to Github.<br />
|
6
|
+
<br /></p>
|
7
|
+
|
8
|
+
<p>Hubeye is composed of a client and server. Once the server is run,<br />
|
9
|
+
you can connect to it via the client. Once connected, you'll be<br />
|
10
|
+
prompted by a '>'. Type the name of a Github repository.</p>
|
11
|
+
|
12
|
+
<p>Example: (what the user enters is preceded by the prompt)</p>
|
13
|
+
|
14
|
+
<pre><code>>hubeye
|
15
|
+
commit 77b82b54044c16751228
|
16
|
+
tree 8ce18af1461b5c741003
|
17
|
+
parent ea63fe317fe58dff1c95
|
18
|
+
log tracking info for repos on client quit => luke-gru
|
19
|
+
</code></pre>
|
20
|
+
|
21
|
+
<p>What you see is the latest commit reference, tree reference and parent<br />
|
22
|
+
commit reference on Github for that repository. Note that the user did<br />
|
23
|
+
not type a username. This is because the user defined a username in his<br />
|
24
|
+
~/.hubeye/hubeyerc file.</p>
|
25
|
+
|
26
|
+
<h2>Starting Hubeye</h2>
|
27
|
+
|
28
|
+
<p>To start the server:</p>
|
29
|
+
|
30
|
+
<pre><code>>hubeye -s
|
31
|
+
</code></pre>
|
32
|
+
|
33
|
+
<p>or just</p>
|
34
|
+
|
35
|
+
<pre><code>>hubeye
|
36
|
+
</code></pre>
|
37
|
+
|
38
|
+
<p>This starts the server as a daemonized process. To run the server in<br />
|
39
|
+
your terminal (on <b>t</b>op):</p>
|
40
|
+
|
41
|
+
<pre><code>>hubeye -st
|
42
|
+
</code></pre>
|
43
|
+
|
44
|
+
<p>Hubeye runs on port 2000 be default. Change the port like this:</p>
|
45
|
+
|
46
|
+
<pre><code>>hubeye -sp 9001
|
47
|
+
</code></pre>
|
48
|
+
|
49
|
+
<p>To connect with the client:</p>
|
50
|
+
|
51
|
+
<pre><code>>hubeye -c
|
52
|
+
</code></pre>
|
53
|
+
|
54
|
+
<p>For more options:</p>
|
55
|
+
|
56
|
+
<pre><code>>hubeye -h
|
57
|
+
</code></pre>
|
58
|
+
|
59
|
+
<h3>~/.hubeye/hubeyerc</h3>
|
60
|
+
|
61
|
+
<pre><code>username: luke-gru
|
62
|
+
</code></pre>
|
63
|
+
|
64
|
+
<p>This allows the user to type a repository name only, and to receive<br />
|
65
|
+
information regarding that <i>username</i>'s repository. The username<br />
|
66
|
+
should be a valid Github username.</p>
|
67
|
+
|
68
|
+
<h3>Keeping track of repositories</h3>
|
69
|
+
|
70
|
+
<p>Hubeye doesn't actually track any repositories unless you disconnect<br />
|
71
|
+
from the server and leave the server running. This can be done by:</p>
|
72
|
+
|
73
|
+
<pre><code>>quit
|
74
|
+
Bye!
|
75
|
+
</code></pre>
|
76
|
+
|
77
|
+
<p>If Hubeye has any repos to watch (track), it will watch Github for changes.<br />
|
78
|
+
It can keep track of as many repos as you want; just keep typing<br />
|
79
|
+
them in. If Hubeye finds a change to a repo, it will notify you of the<br />
|
80
|
+
changes using your Desktop notification system (libnotify, growl). It will<br />
|
81
|
+
also log the changes to your $HOME/.hubeye/log file. If the server is run<br />
|
82
|
+
in a terminal (-t option), the changes will also be logged to the terminal.<br
|
83
|
+
/></p>
|
84
|
+
|
85
|
+
<p>To track your own repository, start the client in the root directory<br />
|
86
|
+
of your local git repo:</p>
|
87
|
+
|
88
|
+
<pre><code>>.
|
89
|
+
</code></pre>
|
90
|
+
|
91
|
+
<p>This only works if a <i>username</i> is added to the hubeyerc, and if the<br />
|
92
|
+
Github repository name is the same as the local root directory name.<br />
|
93
|
+
ie: '.' put in '/home/luke/code/hubeye' would track https://www.github.com/
|
94
|
+
luke-gru/hubeye<br />
|
95
|
+
if <i>username</i> was set to luke-gru.<br /></p>
|
96
|
+
|
97
|
+
<p>You can add another user's repo like this:</p>
|
98
|
+
|
99
|
+
<pre><code>>rails/rails
|
100
|
+
</code></pre>
|
101
|
+
|
102
|
+
<p>This adds https://github.com/rails/rails to the watch list.<br />
|
103
|
+
Hubeye does not remove a repo from the watch list unless explicitly<br />
|
104
|
+
told to do so:</p>
|
105
|
+
|
106
|
+
<pre><code>>rm luke-gru/hubeye
|
107
|
+
</code></pre>
|
108
|
+
|
109
|
+
<p>To see a list of all repos (with recent commit messages) in the watch (track) list:</p>
|
110
|
+
|
111
|
+
<pre><code>>tracking
|
112
|
+
</code></pre>
|
113
|
+
|
114
|
+
<h3>Desktop Notification</h3>
|
115
|
+
|
116
|
+
<p><i>On Linux: install libnotify-bin. On Mac: install growl (if not already installed).<br />
|
117
|
+
The autotest gem is needed for Desktop notification to work in both
|
118
|
+
cases.</i><br /></p>
|
119
|
+
|
120
|
+
<h3>Shutting down and persistence between sessions</h3>
|
121
|
+
|
122
|
+
<pre><code>>shutdown
|
123
|
+
</code></pre>
|
124
|
+
|
125
|
+
<p>Next time you start up the server, the watch list will be empty<br />
|
126
|
+
(and so will the log file). In order to have a default watch list:</p>
|
127
|
+
|
128
|
+
<p><i>~/.hubeye/hubeyerc</i></p>
|
129
|
+
|
130
|
+
<pre><code>track: rails/rails, dchelimsky/rspec
|
131
|
+
</code></pre>
|
132
|
+
|
133
|
+
<p>These will be watched automatically when starting up the server.<br /></p>
|
134
|
+
|
135
|
+
<p>A way to interactively save all currently tracked repositories:</p>
|
136
|
+
|
137
|
+
<pre><code>>save repos as my_work_repos
|
138
|
+
</code></pre>
|
139
|
+
|
140
|
+
<p>And then load any time (even after a shutdown; next session, next week, etc...)</p>
|
141
|
+
|
142
|
+
<pre><code>>load repos my_work_repos
|
143
|
+
</code></pre>
|
144
|
+
|
145
|
+
<h3>Working with hooks</h3>
|
146
|
+
|
147
|
+
<pre><code>>hook add rails/rails dir: /path/to/local/rails cmd: git pull origin master
|
148
|
+
</code></pre>
|
149
|
+
|
150
|
+
<p>When <b>https://www.github.com/rails/rails</b> changes, a process will start,
|
151
|
+
<br />
|
152
|
+
change to the selected directory and execute the command. The <i>(dir: /my/dir)
|
153
|
+
<br />
|
154
|
+
</i> part is optional, and when ignored won't change directories. In this
|
155
|
+
case,
|
156
|
+
<br />
|
157
|
+
the directory will be where the hubeye server was originally
|
158
|
+
started from.<br /></p>
|
159
|
+
|
160
|
+
<p>To see all currently loaded hooks:</p>
|
161
|
+
|
162
|
+
<pre><code>>hook list
|
163
|
+
</code></pre>
|
164
|
+
|
165
|
+
<p>To save all hooks for next sessions (after a server shutdown)</p>
|
166
|
+
|
167
|
+
<pre><code>>save hooks as weekend_projects_hooks
|
168
|
+
</code></pre>
|
169
|
+
|
170
|
+
<p>Then, next weekend:</p>
|
171
|
+
|
172
|
+
<pre><code>>load hooks weekend_projects_hooks
|
173
|
+
</code></pre>
|
174
|
+
|
175
|
+
<p>These hooks, of course, will only really do anything if the repositories they
|
176
|
+
<br />
|
177
|
+
are hooked to are currently being watched. This is not done automatically.</p>
|
178
|
+
|
179
|
+
<h3>All ~/.hubeyerc configurations</h3>
|
180
|
+
|
181
|
+
<p>When the server is started, the options are set here.</p>
|
182
|
+
|
183
|
+
<pre><code>username: luke-gru
|
184
|
+
track: username/reponame, username2/reponame2, myreponame
|
185
|
+
oncearound = 90
|
186
|
+
load hooks: myhook1, myworkhooks
|
187
|
+
load repos: workprojects, funprojects
|
188
|
+
desktop notification: on/off
|
189
|
+
</code></pre>
|
190
|
+
|
191
|
+
<p><i>username</i>: username used for Github URLS when the full path is not
|
192
|
+
given<br />
|
193
|
+
inside of the client.<br /></p>
|
194
|
+
|
195
|
+
<p><i>track</i>: default repositories to watch for changes upon server start<br /></p>
|
196
|
+
|
197
|
+
<p><i>oncearound</i>: number of seconds before completing a check of every repo in<br />
|
198
|
+
the watch list for changes<br /></p>
|
199
|
+
|
200
|
+
<p><i>load hooks</i>: load hooks on server start. To see how to save hooks in the
|
201
|
+
<br />
|
202
|
+
client, see the <i>Working with hooks</i> section<br /></p>
|
203
|
+
|
204
|
+
<p><i>load repos</i>: load repos on server start. To see how to save repos in the
|
205
|
+
<br />
|
206
|
+
client, see the <i>Shutting down and persistence between sessions</i> section.
|
207
|
+
<br /></p>
|
208
|
+
|
209
|
+
<p><i>desktop notification</i>: whether to notify of repo changes using libnotify
|
210
|
+
<br />
|
211
|
+
or growl. This is set to <i>on</i> by default. However, if no notification<br />
|
212
|
+
system is found, it is ignored.</p>
|
data/VERSION.rb
CHANGED
data/bin/hubeye
CHANGED
@@ -16,11 +16,30 @@ unless RUBY_VERSION >= '1.9'
|
|
16
16
|
require 'rubygems'
|
17
17
|
retry
|
18
18
|
else
|
19
|
-
|
19
|
+
raise "The daemons gem is needed to run hubeye as a daemon " +
|
20
20
|
"on Ruby < 1.9"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
unless File.exists? ENV['HOME'] + '/.hubeye'
|
25
|
+
require 'rake'
|
26
|
+
require 'stringio'
|
27
|
+
|
28
|
+
def capture_stdout
|
29
|
+
s = StringIO.new
|
30
|
+
oldstdout = $stdout
|
31
|
+
$stdout = s
|
32
|
+
yield
|
33
|
+
s.string
|
34
|
+
ensure
|
35
|
+
$stdout = oldstdout
|
36
|
+
end
|
37
|
+
|
38
|
+
require File.join(File.expand_path(File.dirname(__FILE__) + "/.."), 'tasks/install')
|
39
|
+
results = capture_stdout { Rake.application['install'].invoke }
|
40
|
+
|
41
|
+
end
|
42
|
+
|
24
43
|
class Options
|
25
44
|
def self.parse(args)
|
26
45
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class Hubeye
|
2
|
+
module Config
|
3
|
+
class Parser
|
4
|
+
|
5
|
+
class ConfigParseError < StandardError; end
|
6
|
+
attr_reader :username, :load_repos, :oncearound, :load_hooks, :notification_wanted,
|
7
|
+
:default_track
|
8
|
+
|
9
|
+
def initialize(config_file, options={})
|
10
|
+
opts = {:test => false}.merge options
|
11
|
+
if opts[:test] then klass = StringIO else klass = File end
|
12
|
+
|
13
|
+
# not a pretty line, but take options array from element 1,
|
14
|
+
# stringify it, get rid of commas separating the repos and
|
15
|
+
# split them back into an array on the spaces
|
16
|
+
get_comma_separated_values = Proc.new do
|
17
|
+
options[1..-1].join('').gsub(',', '').split(' ')
|
18
|
+
end
|
19
|
+
|
20
|
+
klass.open(config_file) do |f|
|
21
|
+
while line = f.gets
|
22
|
+
line.strip!
|
23
|
+
next if line.empty?
|
24
|
+
options = line.split(':')
|
25
|
+
options.each {|o| o.strip! }
|
26
|
+
case options[0]
|
27
|
+
when "username"
|
28
|
+
@username = options[1]
|
29
|
+
when "track"
|
30
|
+
@default_track = get_comma_separated_values.call
|
31
|
+
when "load repos"
|
32
|
+
@load_repos = get_comma_separated_values.call
|
33
|
+
when "oncearound"
|
34
|
+
@oncearound = options[1].to_i
|
35
|
+
if @oncearound.zero?
|
36
|
+
raise ConfigParseError.new "oncearound in hubeyerc is " +
|
37
|
+
"#{options[1]} but must be a number that is greater than 0"
|
38
|
+
end
|
39
|
+
when "load hooks"
|
40
|
+
@load_hooks = get_comma_separated_values.call
|
41
|
+
when "desktop notification"
|
42
|
+
on_off = options[1]
|
43
|
+
@notification_wanted = case on_off
|
44
|
+
when "off"
|
45
|
+
false
|
46
|
+
when "on"
|
47
|
+
true
|
48
|
+
else
|
49
|
+
raise ConfigParseError.new "desktop notification in hubeyerc is " +
|
50
|
+
"'#{on_off}' and is expected to be either on or off"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
yield self
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/environment.rb
CHANGED
data/lib/helpers/time.rb
ADDED
data/lib/log/logger.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
class Logger
|
2
|
+
LOG_DIR = ENV['HOME'] + "/.hubeye/log"
|
2
3
|
|
3
4
|
def self.log(msg)
|
4
|
-
File.open(
|
5
|
+
File.open(LOG_DIR, "a") do |f|
|
5
6
|
f.puts(msg)
|
6
7
|
end
|
7
8
|
end
|
8
9
|
|
9
10
|
def self.relog(msg)
|
10
11
|
#wipe the file and start anew
|
11
|
-
File.open(
|
12
|
+
File.open(LOG_DIR, "w") do |f|
|
12
13
|
f.puts(msg)
|
13
14
|
end
|
14
15
|
end
|
data/lib/server/hubeye_server.rb
CHANGED
@@ -16,21 +16,57 @@ module Server
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# hubeye
|
19
|
-
require "
|
19
|
+
require "config/parser"
|
20
20
|
require "log/logger"
|
21
|
-
require "
|
21
|
+
require "notification/notification"
|
22
22
|
require "hooks/git_hooks"
|
23
23
|
require "hooks/executer"
|
24
|
+
require "helpers/time"
|
25
|
+
include Helpers::Time
|
24
26
|
|
25
|
-
|
27
|
+
CONFIG_FILE = ENV['HOME'] + "/.hubeye/hubeyerc"
|
28
|
+
CONFIG = {}
|
29
|
+
# find Desktop notification system
|
30
|
+
|
31
|
+
# CONFIG options: defined in ~/.hubeye/hubeyerc
|
32
|
+
#
|
33
|
+
# Option overview:
|
34
|
+
#
|
35
|
+
# CONFIG[:oncearound]: 30 (seconds) is the default amount of time for looking
|
26
36
|
# for changes in every single repository. If tracking lots of repos,
|
27
37
|
# it might be a good idea to increase the value, or hubeye will cry
|
28
38
|
# due to overwork, fatigue and general anhedonia.
|
29
|
-
|
30
|
-
#
|
31
|
-
|
32
|
-
#
|
33
|
-
|
39
|
+
#
|
40
|
+
# hubeyerc format: oncearound: 1000
|
41
|
+
#
|
42
|
+
# CONFIG[:username] is the username used when not specified:
|
43
|
+
# when set to 'hansolo'
|
44
|
+
# >rails
|
45
|
+
# would track https://www.github.com/hansolo/rails
|
46
|
+
# but a full URI path won't use CONFIG[:username]
|
47
|
+
# >rails/rails
|
48
|
+
# would track https://www.github.com/rails/rails
|
49
|
+
#
|
50
|
+
# hubeyerc format: username: hansolo
|
51
|
+
::Hubeye::Config::Parser.new(CONFIG_FILE) do |c|
|
52
|
+
CONFIG[:username] = c.username || ''
|
53
|
+
CONFIG[:oncearound] = c.oncearound || 60
|
54
|
+
CONFIG[:load_repos] = c.load_repos || []
|
55
|
+
CONFIG[:load_hooks] = c.load_hooks || []
|
56
|
+
CONFIG[:default_track] = c.default_track || []
|
57
|
+
# returns true or false if defined in hubeyerc
|
58
|
+
CONFIG[:notification_wanted] = case c.notification_wanted
|
59
|
+
when false
|
60
|
+
false
|
61
|
+
when true
|
62
|
+
true
|
63
|
+
when nil
|
64
|
+
# default is true if not defined in hubeyerc
|
65
|
+
true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
CONFIG[:desktop_notification] = (CONFIG[:notification_wanted] ? Notification::Finder.find_notify : nil)
|
34
70
|
|
35
71
|
class InputError < StandardError; end
|
36
72
|
|
@@ -39,13 +75,13 @@ module Server
|
|
39
75
|
setup_env(options)
|
40
76
|
loop do
|
41
77
|
catch(:next) do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
78
|
+
not_connected() unless @remote_connection
|
79
|
+
get_input(@socket)
|
80
|
+
puts @input if @debug
|
81
|
+
parse_input()
|
82
|
+
get_github_doc("/#{@username}/#{@repo_name}")
|
83
|
+
parse_doc()
|
84
|
+
@username = CONFIG[:username]
|
49
85
|
end
|
50
86
|
end
|
51
87
|
end
|
@@ -59,14 +95,49 @@ module Server
|
|
59
95
|
def setup_env(options={})
|
60
96
|
@daemonized = options[:daemon]
|
61
97
|
@sockets = [@server] # An array of sockets we'll monitor
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
98
|
+
if CONFIG[:default_track].empty?
|
99
|
+
@ary_commits_repos = []
|
100
|
+
@hubeye_tracker = []
|
101
|
+
else
|
102
|
+
# default tracking arrays (hubeyerc configurations)
|
103
|
+
@hubeye_tracker = CONFIG[:default_track]
|
104
|
+
@ary_commits_repos = insert_default_tracking_messages
|
105
|
+
end
|
106
|
+
|
107
|
+
if CONFIG[:load_hooks].empty?
|
108
|
+
# do nothing (the hooks hash is only assigned when needed)
|
109
|
+
else
|
110
|
+
hooks_ary = CONFIG[:load_hooks].dup
|
111
|
+
load_hooks_or_repos :internal_input => hooks_ary,
|
112
|
+
:internal_input_hooks => true
|
113
|
+
end
|
114
|
+
|
115
|
+
if CONFIG[:load_repos].empty?
|
116
|
+
# do nothing
|
117
|
+
else
|
118
|
+
repos_ary = CONFIG[:load_repos].dup
|
119
|
+
load_hooks_or_repos :internal_input => repos_ary,
|
120
|
+
:internal_input_repos => true
|
121
|
+
end
|
122
|
+
# @username changes if input includes a '/' when removing and adding
|
123
|
+
# tracked repos.
|
124
|
+
@username = CONFIG[:username]
|
67
125
|
@remote_connection = false
|
68
126
|
end
|
69
127
|
|
128
|
+
def insert_default_tracking_messages
|
129
|
+
track_default = CONFIG[:default_track].dup
|
130
|
+
track_default.each do |repo|
|
131
|
+
commit_msg = get_commit_msg(repo)
|
132
|
+
# next unless commit_msg is non-false
|
133
|
+
commit_msg ? nil : next
|
134
|
+
ary_index = track_default.index(repo)
|
135
|
+
track_default.insert(ary_index + 1, commit_msg)
|
136
|
+
end
|
137
|
+
track_default
|
138
|
+
end
|
139
|
+
private :insert_default_tracking_messages
|
140
|
+
|
70
141
|
|
71
142
|
def not_connected
|
72
143
|
# if no client is connected, but the commits array contains repos
|
@@ -82,7 +153,7 @@ module Server
|
|
82
153
|
doc.xpath('//div[@class = "message"]/pre').each do |node|
|
83
154
|
commit_msg = node.text
|
84
155
|
if @ary_commits_repos.include?(commit_msg)
|
85
|
-
|
156
|
+
CONFIG[:oncearound].times do
|
86
157
|
sleep 1
|
87
158
|
@remote_connection = client_ready(@sockets) ? true : false
|
88
159
|
break if @remote_connection
|
@@ -101,7 +172,7 @@ module Server
|
|
101
172
|
# if they have a Desktop notification
|
102
173
|
# library installed
|
103
174
|
change_msg = "Repo #{repo} has changed\nNew commit: #{commit_msg} => #{committer}"
|
104
|
-
case
|
175
|
+
case CONFIG[:desktop_notification]
|
105
176
|
when "libnotify"
|
106
177
|
Autotest::GnomeNotify.notify("Hubeye", change_msg)
|
107
178
|
Logger.log_change(repo, commit_msg, committer)
|
@@ -168,17 +239,17 @@ module Server
|
|
168
239
|
end
|
169
240
|
|
170
241
|
if !@daemonized
|
171
|
-
puts "Client connected at #{
|
242
|
+
puts "Client connected at #{NOW}"
|
172
243
|
end
|
173
244
|
|
174
245
|
@socket.flush
|
175
246
|
# And log the fact that the client connected
|
176
247
|
if @still_logging == true
|
177
248
|
# if the client quit, do not wipe the log file
|
178
|
-
Logger.log "Accepted connection from #{@socket.peeraddr[2]} (#{
|
249
|
+
Logger.log "Accepted connection from #{@socket.peeraddr[2]} (#{NOW})"
|
179
250
|
else
|
180
251
|
# wipe the log file and start anew
|
181
|
-
Logger.relog "Accepted connection from #{@socket.peeraddr[2]} (#{
|
252
|
+
Logger.relog "Accepted connection from #{@socket.peeraddr[2]} (#{NOW})"
|
182
253
|
end
|
183
254
|
Logger.log "local: #{@socket.addr}"
|
184
255
|
Logger.log "peer : #{@socket.peeraddr}"
|
@@ -207,7 +278,7 @@ module Server
|
|
207
278
|
elsif parse_shutdown()
|
208
279
|
elsif save_hooks_or_repos()
|
209
280
|
elsif load_hooks_or_repos()
|
210
|
-
|
281
|
+
# parse_hook must be before parse_fullpath_add for the moment
|
211
282
|
elsif parse_hook()
|
212
283
|
elsif hook_list()
|
213
284
|
elsif tracking_list()
|
@@ -249,7 +320,7 @@ module Server
|
|
249
320
|
if @input == "shutdown"
|
250
321
|
# local
|
251
322
|
Logger.log "Closing connection to #{@socket.peeraddr[2]}"
|
252
|
-
Logger.log "Shutting down... (#{
|
323
|
+
Logger.log "Shutting down... (#{NOW})"
|
253
324
|
Logger.log ""
|
254
325
|
Logger.log ""
|
255
326
|
# peer
|
@@ -287,7 +358,7 @@ module Server
|
|
287
358
|
@input.gsub!(/diiv/, '/')
|
288
359
|
# make match-$globals parse input
|
289
360
|
@input =~ /add ([^\/]+\/\w+) (dir: (\S*) )?cmd: (.*)\Z/
|
290
|
-
|
361
|
+
@hook_cmds ||= {}
|
291
362
|
if $1 != nil && $4 != nil
|
292
363
|
if @hook_cmds[$1]
|
293
364
|
@hook_cmds[$1] << $4
|
@@ -308,7 +379,7 @@ module Server
|
|
308
379
|
def save_hooks_or_repos
|
309
380
|
if @input =~ %r{\A\s*save hook(s?) as (.+)\Z}
|
310
381
|
if !@hook_cmds.nil? && !@hook_cmds.empty?
|
311
|
-
File.open("#{ENV['HOME']}/
|
382
|
+
File.open("#{ENV['HOME']}/.hubeye/hooks/#{$2}.yml", "w") do |f_out|
|
312
383
|
::YAML.dump(@hook_cmds, f_out)
|
313
384
|
end
|
314
385
|
@socket.puts("Saved hook#{$1} as #{$2}")
|
@@ -318,7 +389,7 @@ module Server
|
|
318
389
|
throw(:next)
|
319
390
|
elsif @input =~ %r{\A\s*save repo(s?) as (.+)\Z}
|
320
391
|
if !@hubeye_tracker.empty?
|
321
|
-
File.open("#{ENV['HOME']}/
|
392
|
+
File.open("#{ENV['HOME']}/.hubeye/repos/#{$2}.yml", "w") do |f_out|
|
322
393
|
::YAML.dump(@hubeye_tracker, f_out)
|
323
394
|
end
|
324
395
|
@socket.puts("Saved repo#{$1} as #{$2}")
|
@@ -332,9 +403,27 @@ module Server
|
|
332
403
|
end
|
333
404
|
|
334
405
|
|
335
|
-
|
406
|
+
# options are internal input: can be true or falselike.
|
407
|
+
# When falselike (nil is default), it outputs to the client socket.
|
408
|
+
# When truelike (such as when used internally), it outputs nothing.
|
409
|
+
def load_hooks_or_repos(options={})
|
410
|
+
opts = {:internal_input => nil, :internal_input_hooks => nil,
|
411
|
+
:internal_input_repos => nil}.merge options
|
412
|
+
if opts[:internal_input].nil?
|
413
|
+
load_hooks_repos_from_terminal_input
|
414
|
+
elsif opts[:internal_input]
|
415
|
+
input = opts[:internal_input]
|
416
|
+
if opts[:internal_input_hooks]
|
417
|
+
load_hooks_from_internal_input(input)
|
418
|
+
elsif opts[:internal_input_repos]
|
419
|
+
load_repos_from_internal_input(input)
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
def load_hooks_repos_from_terminal_input
|
336
425
|
if @input =~ %r{\A\s*load hook(s?) (.+)\Z}
|
337
|
-
hookfile = "#{ENV['HOME']}/
|
426
|
+
hookfile = "#{ENV['HOME']}/.hubeye/hooks/#{$2}.yml"
|
338
427
|
|
339
428
|
# establish non block-local scope
|
340
429
|
newhooks = nil
|
@@ -351,7 +440,7 @@ module Server
|
|
351
440
|
end
|
352
441
|
throw(:next)
|
353
442
|
elsif @input =~ %r{\A\s*load repo(s)? (.+)\Z}
|
354
|
-
if File.exists? repo_file = "#{ENV['HOME']}/
|
443
|
+
if File.exists? repo_file = "#{ENV['HOME']}/.hubeye/repos/#{$2}.yml"
|
355
444
|
newrepos = nil
|
356
445
|
File.open(repo_file) do |f|
|
357
446
|
newrepos = ::YAML.load(f)
|
@@ -386,6 +475,66 @@ module Server
|
|
386
475
|
return
|
387
476
|
end
|
388
477
|
|
478
|
+
def load_hooks_from_internal_input(input)
|
479
|
+
if input.respond_to? :to_a
|
480
|
+
input = input.to_a
|
481
|
+
input.each do |hook|
|
482
|
+
hookfile = "#{ENV['HOME']}/.hubeye/hooks/#{hook}.yml"
|
483
|
+
newhook = nil
|
484
|
+
if File.exists?(hookfile)
|
485
|
+
File.open(hookfile) do |f|
|
486
|
+
newhook = ::YAML.load(f)
|
487
|
+
end
|
488
|
+
@hook_cmds ||= {}
|
489
|
+
@hook_cmds = newhook.merge(@hook_cmds)
|
490
|
+
else
|
491
|
+
# do nothing because of no extra processing after this, newhook
|
492
|
+
# can stay nil if the hook file doesn't exist
|
493
|
+
end
|
494
|
+
end
|
495
|
+
else
|
496
|
+
raise ArgumentError.new "#{input} must be array-like"
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
500
|
+
def load_repos_from_internal_input(input)
|
501
|
+
if input.respond_to? :to_a
|
502
|
+
input = input.to_a
|
503
|
+
newrepos = []
|
504
|
+
input.each do |repo|
|
505
|
+
repofile = "#{ENV['HOME']}/.hubeye/repos/#{repo}.yml"
|
506
|
+
newrepo = nil
|
507
|
+
if File.exists?(repofile)
|
508
|
+
File.open(repofile) do |f|
|
509
|
+
newrepo = ::YAML.load(f)
|
510
|
+
end
|
511
|
+
# empty repo file, go to next repo file in the array
|
512
|
+
if !newrepo
|
513
|
+
next
|
514
|
+
else
|
515
|
+
# append the newrepo array to the newrepos array
|
516
|
+
newrepos << newrepo
|
517
|
+
end
|
518
|
+
else
|
519
|
+
# file doesn't exist, next repo file
|
520
|
+
next
|
521
|
+
end
|
522
|
+
end # end of input#each
|
523
|
+
# flatten the newrepos array because it contains arrays
|
524
|
+
newrepos.flatten!
|
525
|
+
newrepos.each do |repo|
|
526
|
+
commit_msg = get_commit_msg(repo)
|
527
|
+
commit_msg ? nil : next
|
528
|
+
@ary_commits_repos << repo << commit_msg
|
529
|
+
@hubeye_tracker << repo
|
530
|
+
end
|
531
|
+
@ary_commits_repos.uniq!
|
532
|
+
@hubeye_tracker.uniq!
|
533
|
+
else
|
534
|
+
raise ArgumentError.new "#{input} must be array-like"
|
535
|
+
end
|
536
|
+
end
|
537
|
+
|
389
538
|
|
390
539
|
# helper method to get commit message for a
|
391
540
|
# single repo
|
@@ -416,6 +565,7 @@ module Server
|
|
416
565
|
def hook_list
|
417
566
|
if @input =~ %r{hook list}
|
418
567
|
unless @hook_cmds.nil? || @hook_cmds.empty?
|
568
|
+
format_string = ""
|
419
569
|
@hook_cmds.each do |repo, ary|
|
420
570
|
remote = repo
|
421
571
|
if ary.first.include? '/'
|
@@ -425,11 +575,11 @@ module Server
|
|
425
575
|
cmds = ary
|
426
576
|
local = "N/A"
|
427
577
|
end
|
428
|
-
format_string
|
578
|
+
format_string += <<-EOS
|
429
579
|
remote: #{remote}
|
430
580
|
dir : #{local}
|
431
581
|
cmds: #{cmds.each {|cmd| print cmd + ' ' }} \n
|
432
|
-
|
582
|
+
EOS
|
433
583
|
end
|
434
584
|
@socket.puts(format_string)
|
435
585
|
@socketspoke = true
|
@@ -571,11 +721,11 @@ remote: #{remote}
|
|
571
721
|
@info = parse_info()
|
572
722
|
@msg = "#{@commit_msg} => #{@committer}".gsub(/\(author\)/, '')
|
573
723
|
# log the fact that the user added a repo to be tracked
|
574
|
-
Logger.log("Added to tracker: #{@ary_commits_repos[-2]} (#{
|
724
|
+
Logger.log("Added to tracker: #{@ary_commits_repos[-2]} (#{NOW})")
|
575
725
|
# show the user, via the client, the info and commit msg for the commit
|
576
726
|
@socket.puts("#{@info}\n#{@msg}")
|
577
727
|
|
578
|
-
|
728
|
+
# new commit to tracked repo
|
579
729
|
elsif !@ary_commits_repos.include?(@commit_msg)
|
580
730
|
begin
|
581
731
|
index_of_msg = @ary_commits_repos.index(@username + "/" + @repo_name) + 1
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# Hubeye::Config::Parser.new uses StringIO.open() when option {:test => true} is set
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
class ConfigParserTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def get_config_settings(config_file)
|
7
|
+
Hubeye::Config::Parser.new(config_file, :test => true) do |c|
|
8
|
+
@username = c.username
|
9
|
+
@default_track = c.default_track
|
10
|
+
@hooks = c.load_hooks
|
11
|
+
@repos = c.load_repos
|
12
|
+
@oncearound = c.oncearound
|
13
|
+
@notification_wanted = c.notification_wanted
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_proper_username_parse
|
18
|
+
text = 'username: luke-gru'
|
19
|
+
get_config_settings(text)
|
20
|
+
assert_nil @default_track
|
21
|
+
assert_nil @oncearound
|
22
|
+
assert_nil @hooks
|
23
|
+
assert_nil @notification_wanted
|
24
|
+
assert_nil @repos
|
25
|
+
|
26
|
+
assert_equal 'luke-gru', @username
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_proper_default_track_parse
|
30
|
+
text = 'track: rails/rails, jimweirich/rake, sinatra/sinatra'
|
31
|
+
get_config_settings(text)
|
32
|
+
assert_nil @username
|
33
|
+
assert_nil @oncearound
|
34
|
+
assert_nil @hooks
|
35
|
+
assert_nil @notification_wanted
|
36
|
+
assert_nil @repos
|
37
|
+
|
38
|
+
assert_equal 3, @default_track.length
|
39
|
+
assert_equal ['rails/rails', 'jimweirich/rake', 'sinatra/sinatra'], @default_track
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_oncearound_error
|
43
|
+
text = 'oncearound: fooey'
|
44
|
+
assert_raises(Hubeye::Config::Parser::ConfigParseError) { get_config_settings(text) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_proper_oncearound_parse
|
48
|
+
text = 'oncearound: 80'
|
49
|
+
get_config_settings(text)
|
50
|
+
assert_nil @username
|
51
|
+
assert_nil @default_track
|
52
|
+
assert_nil @hooks
|
53
|
+
assert_nil @notification_wanted
|
54
|
+
assert_nil @repos
|
55
|
+
|
56
|
+
assert_equal 80, @oncearound
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_proper_default_hook_parse
|
60
|
+
text = 'load hooks: myhook1, myhook2, captain_hook'
|
61
|
+
get_config_settings(text)
|
62
|
+
assert_nil @username
|
63
|
+
assert_nil @oncearound
|
64
|
+
assert_nil @default_track
|
65
|
+
assert_nil @notification_wanted
|
66
|
+
assert_nil @repos
|
67
|
+
|
68
|
+
assert_equal ['myhook1', 'myhook2', 'captain_hook'], @hooks
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_proper_default_repos_parse
|
72
|
+
text = 'load repos: myforks, myprojects, mywork'
|
73
|
+
get_config_settings(text)
|
74
|
+
assert_nil @username
|
75
|
+
assert_nil @oncearound
|
76
|
+
assert_nil @default_track
|
77
|
+
assert_nil @notification_wanted
|
78
|
+
assert_nil @hooks
|
79
|
+
|
80
|
+
assert_equal ['myforks', 'myprojects', 'mywork'], @repos
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_notification_off_parse
|
84
|
+
text = 'desktop notification: off'
|
85
|
+
get_config_settings(text)
|
86
|
+
assert_nil @username
|
87
|
+
assert_nil @oncearound
|
88
|
+
assert_nil @default_track
|
89
|
+
assert_nil @hooks
|
90
|
+
assert_nil @repos
|
91
|
+
|
92
|
+
assert_equal false, @notification_wanted
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_notification_on_parse
|
96
|
+
text = 'desktop notification: on'
|
97
|
+
get_config_settings(text)
|
98
|
+
assert_nil @username
|
99
|
+
assert_nil @oncearound
|
100
|
+
assert_nil @default_track
|
101
|
+
assert_nil @hooks
|
102
|
+
assert_nil @repos
|
103
|
+
|
104
|
+
assert_equal true, @notification_wanted
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_notification_error
|
109
|
+
text = 'desktop notification: fooey'
|
110
|
+
assert_raises(Hubeye::Config::Parser::ConfigParseError) { get_config_settings(text) }
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
data/test/environment.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
class EnvironmentTests < Test::Unit::TestCase
|
2
|
+
|
3
|
+
include ::Environment
|
4
|
+
|
5
|
+
def test_proper_rootdir
|
6
|
+
assert_equal File.expand_path(File.dirname(__FILE__) + '/..'), ROOTDIR
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_proper_libdir
|
10
|
+
assert_equal File.join(File.expand_path(File.dirname(__FILE__) + '/..'), 'lib'), LIBDIR
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_proper_bindir
|
14
|
+
assert_equal File.join(File.expand_path(File.dirname(__FILE__) + '/..'), 'bin'), BINDIR
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
data/test/notification.rb
CHANGED
data/test/runner.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# environment file
|
4
|
+
require File.join(File.dirname(__FILE__), "/../lib/environment")
|
5
|
+
|
6
|
+
# test/unit
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
# test files
|
10
|
+
require_relative 'environment'
|
11
|
+
require File.join(File.dirname(__FILE__), "/../lib/notification/notification")
|
12
|
+
require_relative "notification"
|
13
|
+
require Environment::LIBDIR + '/config/parser'
|
14
|
+
require_relative "config_parser"
|
15
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubeye
|
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,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-09-04 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: nokogiri
|
17
|
-
requirement: &
|
16
|
+
requirement: &74408990 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
@@ -22,7 +21,7 @@ dependencies:
|
|
22
21
|
version: '0'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *74408990
|
26
25
|
description: Github repository commit watcher -- keep your eye on new commits from
|
27
26
|
multiple repos through an interactive CLI
|
28
27
|
email: luke.gru@gmail.com
|
@@ -31,24 +30,26 @@ executables:
|
|
31
30
|
extensions: []
|
32
31
|
extra_rdoc_files: []
|
33
32
|
files:
|
33
|
+
- lib/config/parser.rb
|
34
34
|
- lib/client/hubeye_client.rb
|
35
35
|
- lib/notification/growl.rb
|
36
36
|
- lib/notification/gnomenotify.rb
|
37
37
|
- lib/notification/notification.rb
|
38
|
-
- lib/timehelper/timehelper.rb
|
39
38
|
- lib/server/hubeye_server.rb
|
40
39
|
- lib/hooks/executer.rb
|
41
40
|
- lib/hooks/git_hooks.rb
|
42
41
|
- lib/log/logger.rb
|
43
42
|
- lib/environment.rb
|
43
|
+
- lib/helpers/time.rb
|
44
44
|
- bin/hubeye
|
45
|
-
-
|
45
|
+
- README.md.html
|
46
46
|
- README.md
|
47
47
|
- VERSION.rb
|
48
48
|
- LICENSE
|
49
|
-
- test/
|
49
|
+
- test/config_parser.rb
|
50
|
+
- test/runner.rb
|
51
|
+
- test/environment.rb
|
50
52
|
- test/notification.rb
|
51
|
-
has_rdoc: true
|
52
53
|
homepage:
|
53
54
|
licenses:
|
54
55
|
- MIT
|
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
version: '0'
|
71
72
|
requirements: []
|
72
73
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.8.10
|
74
75
|
signing_key:
|
75
76
|
specification_version: 3
|
76
77
|
summary: Github repository commit watcher -- keep your eye on new commits from multiple
|
data/Rakefile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
task :install => :chmod do
|
2
|
-
puts "Done"
|
3
|
-
end
|
4
|
-
|
5
|
-
task :chmod => :makelog do
|
6
|
-
binfile = File.join(File.dirname(__FILE__), "/bin/hubeye")
|
7
|
-
chmod 0777, binfile unless File.executable?(binfile)
|
8
|
-
end
|
9
|
-
|
10
|
-
task :makelog => :config_file do
|
11
|
-
hublog_dir = ENV['HOME'] + "/hublog"
|
12
|
-
mkdir(hublog_dir) unless File.exists?(hublog_dir)
|
13
|
-
|
14
|
-
hooks_dir = hublog_dir + "/hooks"
|
15
|
-
mkdir(hooks_dir) unless File.exists?(hooks_dir)
|
16
|
-
|
17
|
-
repos_dir = hublog_dir + "/repos"
|
18
|
-
mkdir(repos_dir) unless File.exists?(repos_dir)
|
19
|
-
|
20
|
-
hublog_file = File.join(ENV['HOME'], "/hublog/hublog")
|
21
|
-
touch hublog_file unless File.exists?(hublog_file)
|
22
|
-
end
|
23
|
-
|
24
|
-
task :config_file do
|
25
|
-
config_file = File.join(ENV['HOME'], ".hubeyerc")
|
26
|
-
touch config_file unless File.exists? config_file
|
27
|
-
end
|
28
|
-
|
29
|
-
task :config_file => :message
|
30
|
-
|
31
|
-
task :message do
|
32
|
-
puts "Installing Hubeye..."
|
33
|
-
end
|
34
|
-
|
data/test/test.rb
DELETED