autoreload 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +42 -0
- data/COPYING.rdoc +20 -0
- data/GPL3.txt +674 -0
- data/HISTORY.rdoc +23 -0
- data/README.rdoc +11 -6
- data/lib/autoreload.rb +1 -4
- data/lib/autoreload/lookup.rb +2 -1
- data/lib/autoreload/reloader.rb +85 -86
- data/lib/autoreload/version.rb +3 -0
- data/spec/autoreload_spec.rb +55 -0
- metadata +50 -19
- data/HISTORY +0 -14
- data/LICENSE +0 -55
- data/PROFILE +0 -20
- data/VERSION +0 -5
- data/test/test_autoreload.rb +0 -59
- data/test/test_helper.rb +0 -2
data/HISTORY
DELETED
data/LICENSE
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
Copyright (c) 2003-2007 Kouichirou Eto
|
2
|
-
|
3
|
-
You can redistribute it and/or modify it under either the terms of the GPL
|
4
|
-
version 2 (see the file GPL), or the conditions below:
|
5
|
-
|
6
|
-
1. You may make and give away verbatim copies of the source form of the
|
7
|
-
software without restriction, provided that you duplicate all of the
|
8
|
-
original copyright notices and associated disclaimers.
|
9
|
-
|
10
|
-
2. You may modify your copy of the software in any way, provided that
|
11
|
-
you do at least ONE of the following:
|
12
|
-
|
13
|
-
a) place your modifications in the Public Domain or otherwise
|
14
|
-
make them Freely Available, such as by posting said
|
15
|
-
modifications to Usenet or an equivalent medium, or by allowing
|
16
|
-
the author to include your modifications in the software.
|
17
|
-
|
18
|
-
b) use the modified software only within your corporation or
|
19
|
-
organization.
|
20
|
-
|
21
|
-
c) give non-standard binaries non-standard names, with
|
22
|
-
instructions on where to get the original software distribution.
|
23
|
-
|
24
|
-
d) make other distribution arrangements with the author.
|
25
|
-
|
26
|
-
3. You may distribute the software in object code or binary form,
|
27
|
-
provided that you do at least ONE of the following:
|
28
|
-
|
29
|
-
a) distribute the binaries and library files of the software,
|
30
|
-
together with instructions (in the manual page or equivalent)
|
31
|
-
on where to get the original distribution.
|
32
|
-
|
33
|
-
b) accompany the distribution with the machine-readable source of
|
34
|
-
the software.
|
35
|
-
|
36
|
-
c) give non-standard binaries non-standard names, with
|
37
|
-
instructions on where to get the original software distribution.
|
38
|
-
|
39
|
-
d) make other distribution arrangements with the author.
|
40
|
-
|
41
|
-
4. You may modify and include the part of the software into any other
|
42
|
-
software (possibly commercial). But some files in the distribution
|
43
|
-
are not written by the author, so that they are not under these terms.
|
44
|
-
|
45
|
-
5. The scripts and library files supplied as input to or produced as
|
46
|
-
output from the software do not automatically fall under the
|
47
|
-
copyright of the software, but belong to whomever generated them,
|
48
|
-
and may be sold commercially, and may be aggregated with this
|
49
|
-
software.
|
50
|
-
|
51
|
-
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
52
|
-
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
53
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
54
|
-
PURPOSE.
|
55
|
-
|
data/PROFILE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title : Autoreload
|
3
|
-
summary: Automatically reload library files
|
4
|
-
license: MIT
|
5
|
-
contact: rubyworks-mailinglist@googlegroups.com
|
6
|
-
suite : rubyworks
|
7
|
-
created: 2007-07-01
|
8
|
-
|
9
|
-
authors:
|
10
|
-
- Kouichirou Eto
|
11
|
-
- Thomas Sawyer
|
12
|
-
|
13
|
-
description:
|
14
|
-
Autoreload automatically reloads library files when they have been
|
15
|
-
updated. It is especailly useful when testing stateless services
|
16
|
-
such as web applications.
|
17
|
-
|
18
|
-
resources:
|
19
|
-
homepage : http://rubyworks.github.com/autoreload
|
20
|
-
repository: http://github.com/rubyworks/autoreload
|
data/VERSION
DELETED
data/test/test_autoreload.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
# ruby -Ilib test/test_autoreload.rb
|
5
|
-
|
6
|
-
class Pathname
|
7
|
-
def write(str)
|
8
|
-
self.open('wb') {|out|
|
9
|
-
out.print str
|
10
|
-
}
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
module AutoReload
|
15
|
-
class Reloader
|
16
|
-
public :warn
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class TestAutoReload < Test::Unit::TestCase
|
21
|
-
|
22
|
-
def test_autoreload
|
23
|
-
# create a library
|
24
|
-
dir = Pathname.new(__FILE__).dirname
|
25
|
-
library = dir + 'tmp_library.rb'
|
26
|
-
library.write 'def foo; 1; end'
|
27
|
-
|
28
|
-
autoreload(library, :interval => 1) #, :verbose=>true)
|
29
|
-
|
30
|
-
# require it
|
31
|
-
require library
|
32
|
-
|
33
|
-
assert_equal(1, foo)
|
34
|
-
|
35
|
-
sleep 2 # wait is needed for time stamp to not be same with the next file.
|
36
|
-
|
37
|
-
# recreate the file
|
38
|
-
library.write 'def foo; 2; end'
|
39
|
-
|
40
|
-
sleep 2 # wait again for the autoreload loop to repeat.
|
41
|
-
|
42
|
-
# check the number again.
|
43
|
-
assert_equal(2, foo)
|
44
|
-
|
45
|
-
# clean up
|
46
|
-
library.unlink
|
47
|
-
assert_equal(false, library.exist?)
|
48
|
-
end
|
49
|
-
|
50
|
-
## ruby -w -Ilib test/test_autoreload.rb -n test_all
|
51
|
-
#def test_all
|
52
|
-
# rel = AutoReload::Reloader.new
|
53
|
-
#
|
54
|
-
# # test_warn
|
55
|
-
# str = ''
|
56
|
-
# rel.warn("a", str)
|
57
|
-
# assert_equal "a\n", str
|
58
|
-
#end
|
59
|
-
end
|
data/test/test_helper.rb
DELETED