autoreload 1.1.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5d195b06220f6ebf62098971a806660fedf14608
4
- data.tar.gz: 23585273514dc91e35cd8755f6e0ce65bdb5bbdd
2
+ SHA256:
3
+ metadata.gz: 961fdd80bd04b065f9c23fedecdc4cfa75a980a34a2ca6d3bbcccb5304f2f41b
4
+ data.tar.gz: df64807553e910e77977ffb732749bc5d378cda074786c628fa60baf200adf8b
5
5
  SHA512:
6
- metadata.gz: 4e9f3c074a1f8d160d05a24e497bd015432ba1ae9d85c8c02d04c1f5c6ebbcd4fa906f96e2dc07c79e11b4707863432d54b845f7c029bdaed02d9069932c84bc
7
- data.tar.gz: 4b49181378e9e939019d6295cfd20696c78609dc953911b1e6fadc35aaff8de4eb33552fae7b081b947d5f23bf9447cec24bebdf1329f4d329d1885f049af23d
6
+ metadata.gz: a395a345aada7e68646e9604abf9f393d33407241d0666d165d692dba309cf6a6559ce99092f1f89266df1fc90f0394cc088fbf118c3f70be4d2ef3a93e91add
7
+ data.tar.gz: 9659ea3c8e3e5658f977e2b99ab955d7a2a222727ce7cce20bd048c17aac507ef3ad7b35cfb7e88367b4dd68b9ec8eccf5ec0588bb620a0a7554037292c5af9c
data/HISTORY.md CHANGED
@@ -1,74 +1,108 @@
1
- # RELEASE HISTORY
2
-
3
- ## 1.1.0
4
-
5
- This release is simply a maintenance release to bring the build
6
- configuration up to date.
7
-
8
- Changes:
9
-
10
- * Modernize build configuration.
11
- * Use interpolation on error message.
12
-
13
-
14
- ## 1.0.0 (2011-07-16)
15
-
16
- This release overhauls the API. The #autoreload method now
17
- takes a block. All libraries required within this block
18
- will be autoreloaded. The old API will raise an error!!!
19
- This was done to simplify the overaul design of the library
20
- and consequently make it much more efficient, but also to
21
- fix a rather nasty bug that prevented scripts required by
22
- other scripts that were to be autoreloaded from autoreloading
23
- as well.
24
-
25
- The new design rely's solely on $LOADED_FEATURES, rather than
26
- looking up files on the $LOAD_PATH itself. This has an important
27
- consequence for Ruby 1.8 or older. Becuase older version of Ruby
28
- do not put the expanded path in $LOADED_FEATURES, autoreloading
29
- occurs regardless of whether the file has changed or not. On
30
- Ruby 1.9+ however, where the full path is available, the file will
31
- only be reloaded if it has changed, it does this by checking the
32
- mtime of the file.
33
-
34
- Changes:
35
-
36
- * Overhaul API to use block form.
37
- * Remove Lookup module (no longer needed).
38
- * Fix require of require issue.
39
-
40
-
41
- ## 0.3.1 (2011-05-15)
42
-
43
- This release simply fixes licensing issues. Autoreload is licensed
44
- under the GPL v3.
45
-
46
-
47
- ## 0.3.0 (2010-10-14)
48
-
49
- Changes:
50
-
51
- * Fix issue with looking up Roller libraries.
52
- * Switch testing framework to RSpec2.
53
-
54
-
55
- ## 0.2.0 (2010-05-10)
56
-
57
- Changes:
58
-
59
- * Completely reworked API.
60
-
61
-
62
- ## 0.1.0 (2010-05-01)
63
-
64
- Changes:
65
-
66
- * Same as original, but now a RubyWorks project.
67
-
68
-
69
- ## 0.0.1 (2007-07-01)
70
-
71
- Changes:
72
-
73
- * Initial release
74
-
1
+ # RELEASE HISTORY
2
+
3
+ ## 1.3.0 (2026-11-26)
4
+
5
+ A maintenance release, for Ruby 3.1 and up.
6
+
7
+ Changes:
8
+
9
+ * `Reloader#update` is public, to check for changes at once without
10
+ the thread. A reloader notes its files when it is made, so the first
11
+ `update` already reloads what has changed since.
12
+ * The interval can be a fraction of a second. Before, it was rounded
13
+ down, and an interval under one second made the thread spin.
14
+ * The list of watched files in verbose mode goes to standard error,
15
+ as the reload reports do.
16
+ * Drop the code for Ruby 1.8.
17
+ * Tests run on Spectrum.
18
+
19
+ Fixes:
20
+
21
+ * A change made in the same second as the last load was missed, as
22
+ times were compared in whole seconds.
23
+ * A file that failed to reload was tried again at every interval.
24
+
25
+
26
+ ## 1.2.0
27
+
28
+ Add `watch_gems` option to watch all required gems. The default
29
+ is now to only watch `.rb` files in the current working directory.
30
+
31
+ Changes:
32
+
33
+ * Add `:watch_gems` option.
34
+ * Watch current working directory only, as default.
35
+
36
+
37
+ ## 1.1.0
38
+
39
+ This release is simply a maintenance release to bring the build
40
+ configuration up to date.
41
+
42
+ Changes:
43
+
44
+ * Modernize build configuration.
45
+ * Use interpolation on error message.
46
+
47
+
48
+ ## 1.0.0 (2011-07-16)
49
+
50
+ This release overhauls the API. The #autoreload method now
51
+ takes a block. All libraries required within this block
52
+ will be autoreloaded. The old API will raise an error!!!
53
+ This was done to simplify the overaul design of the library
54
+ and consequently make it much more efficient, but also to
55
+ fix a rather nasty bug that prevented scripts required by
56
+ other scripts that were to be autoreloaded from autoreloading
57
+ as well.
58
+
59
+ The new design rely's solely on $LOADED_FEATURES, rather than
60
+ looking up files on the $LOAD_PATH itself. This has an important
61
+ consequence for Ruby 1.8 or older. Becuase older version of Ruby
62
+ do not put the expanded path in $LOADED_FEATURES, autoreloading
63
+ occurs regardless of whether the file has changed or not. On
64
+ Ruby 1.9+ however, where the full path is available, the file will
65
+ only be reloaded if it has changed, it does this by checking the
66
+ mtime of the file.
67
+
68
+ Changes:
69
+
70
+ * Overhaul API to use block form.
71
+ * Remove Lookup module (no longer needed).
72
+ * Fix require of require issue.
73
+
74
+
75
+ ## 0.3.1 (2011-05-15)
76
+
77
+ This release simply fixes licensing issues. Autoreload is licensed
78
+ under the GPL v3.
79
+
80
+
81
+ ## 0.3.0 (2010-10-14)
82
+
83
+ Changes:
84
+
85
+ * Fix issue with looking up Roller libraries.
86
+ * Switch testing framework to RSpec2.
87
+
88
+
89
+ ## 0.2.0 (2010-05-10)
90
+
91
+ Changes:
92
+
93
+ * Completely reworked API.
94
+
95
+
96
+ ## 0.1.0 (2010-05-01)
97
+
98
+ Changes:
99
+
100
+ * Same as original, but now a RubyWorks project.
101
+
102
+
103
+ ## 0.0.1 (2007-07-01)
104
+
105
+ Changes:
106
+
107
+ * Initial release
108
+
data/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # AutoReload
2
2
 
3
- [Homepage](http://rubyworks.github.com/autoreload) |
4
- [Development](http://github.com/rubyworks/autoreload) |
5
- [Mailing List](http://groups.google.com/group/rubyworks-mailinglist)
6
-
7
- [![Build Status](https://secure.travis-ci.org/rubyworks/autoreload.png)](http://travis-ci.org/rubyworks/autoreload)
3
+ [Source Code](https://github.com/rubyworks/autoreload) /
4
+ [Report Issue](https://github.com/rubyworks/autoreload/issues)    
5
+ [![CI](https://github.com/rubyworks/autoreload/actions/workflows/ci.yml/badge.svg)](https://github.com/rubyworks/autoreload/actions/workflows/ci.yml)
8
6
 
9
7
 
10
8
  ## Description
@@ -13,11 +11,9 @@ Autoreload automatically reloads library files after they
13
11
  have been updated. It is especially useful when testing
14
12
  stateless services such as web applications.
15
13
 
16
- IMPORTANT! Version 1.0+ has a new API. It also works best
17
- under Ruby 1.9 or above. Under Ruby 1.8 or older files are
18
- reloaded regardless of whether they actually have changed
19
- since the last load. Whereas in Ruby 1.9+, they only reload
20
- if the mtime on the file is newer than the previous time.
14
+ It needs Ruby 3.1 or newer.
15
+
16
+ $ gem install autoreload
21
17
 
22
18
 
23
19
  ## Synopsis
@@ -49,11 +45,33 @@ Note that autoreload only works with _required_ files. It cannot
49
45
  monitor files that are brought in with `#load`. This is because
50
46
  `$LOADED_FEATURES` is used to track which files are monitored.
51
47
 
48
+ Only `.rb` files under the current working directory are watched. To
49
+ watch everything the block requires, gems included, pass
50
+ `:watch_gems=>true`. With `:verbose=>true` the watched files are listed
51
+ and each reload is reported, to standard error.
52
+
53
+ A changed file is loaded again, on top of what is already defined.
54
+ Nothing is removed first, so a method or constant deleted from the file
55
+ stays until the program restarts.
56
+
57
+
58
+ ## Doing it by hand
59
+
60
+ `autoreload` starts a thread and returns it. To check for changes when
61
+ you choose instead, or to stop the checking, use a reloader directly:
62
+
63
+ reloader = AutoReload::Reloader.new{ require 'foo' }
64
+
65
+ reloader.update # reload whatever has changed, now
66
+
67
+ reloader.start # or check every interval, in a thread
68
+ reloader.stop
69
+
52
70
 
53
71
  ## Acknowledgements
54
72
 
55
- The current version of Autoreload is a derviative of Kouichirou Eto's original
56
- work which can still be found at http://autoreload.rubyforge.org.
73
+ The current version of Autoreload is a derivative of Kouichirou Eto's original
74
+ work.
57
75
 
58
76
 
59
77
  ## License & Copyrights
@@ -1,162 +1,161 @@
1
- require 'thread'
2
-
3
- module AutoReload
4
-
5
- # Reload class does all the heavy lifting
6
- # for AutoReload library.
7
- #
8
- class Reloader
9
-
10
- # Public: Shortcut for Reloader.new(*args).start.
11
- def self.start(*args, &block)
12
- self.new(*args, &block).start
13
- end
14
-
15
- # Public: Default interval is one second.
16
- DEFAULT_INTERVAL = 1
17
-
18
- # New Reloader.
19
- #
20
- # options - The Hash options used to refine the reloader (default: {}):
21
- # :interval - Seconds between updates.
22
- # :verbose - True provides reload warning.
23
- # :reprime - Include $0 in reload list.
24
- #
25
- def initialize(options={}, &block)
26
- @interval = (options[:interval] || DEFAULT_INTERVAL).to_i
27
- @verbose = (options[:verbose])
28
- @reprime = (options[:reprime])
29
-
30
- @status = {}
31
-
32
- features = $".dup
33
- if block
34
- block.call
35
- @files = ($" - features).reverse
36
- else
37
- @files = []
38
- end
39
- end
40
-
41
- # Public: Start the reload thread.
42
- def start
43
- update # prime the path loads
44
- @thread = Thread.new do
45
- loop do
46
- begin
47
- update
48
- rescue Exception
49
- warn "autoreload failed unexpectedly: #{$!}"
50
- end
51
- sleep @interval
52
- end
53
- end
54
- @thread.abort_on_exception = true
55
- @thread
56
- end
57
-
58
- # Public: Kills the autoreload thread.
59
- def stop
60
- @thread.kill if @thread
61
- end
62
-
63
- # Public: References the reload thread.
64
- attr :thread
65
-
66
- # Public: List of files provided to autoreload.
67
- attr :files
68
-
69
- # Public: Status hash, used to track reloads.
70
- attr :status
71
-
72
- # Public: The periodic interval of reload in seconds.
73
- attr :interval
74
-
75
- # Public: Provide warning on reload.
76
- #
77
- # Returns true/false if versboe mode.
78
- def verbose?
79
- @verbose || $VERBOSE
80
- end
81
-
82
- # Public: Put $0 in the reload list?
83
- #
84
- # Returns true/false whether to include $0.
85
- def reprime?
86
- @reprime
87
- end
88
-
89
- private
90
-
91
- # TODO: Why include $0 in #libraries ?
92
-
93
- # The library files to autoreload.
94
- def libraries
95
- if @files.empty?
96
- @reprime ? [$0] + $" : $"
97
- else
98
- @files
99
- end
100
- end
101
-
102
- # Iterate through all selection library files and reload if needed.
103
- def update
104
- libraries.each{ |lib| check(lib) }
105
- end
106
-
107
- # Check status and reload if out-of-date.
108
- #
109
- # We can't check mtime under 1.8 b/c $LOADED_FEATURES does not
110
- # store the full path.
111
- #
112
- # lib - A library file.
113
- #
114
- # Returns Array of [file, mtime].
115
- def check(lib)
116
- if RUBY_VERSION < '1.9'
117
- warn "reload: '#{lib}'" if verbose?
118
- begin
119
- load lib
120
- rescue LoadError
121
- # file has been removed
122
- end
123
- else
124
- file, mtime = @status[lib]
125
- if file
126
- if FileTest.exist?(file)
127
- curtime = File.mtime(file).to_i
128
- if mtime < curtime
129
- warn "reload: '#{file}'" if verbose?
130
- load file
131
- @status[lib] = [file, curtime]
132
- end
133
- else
134
- # file has been removed
135
- end
136
- else
137
- @status[lib] = get_status(lib)
138
- end
139
- end
140
- end
141
-
142
- # Get library file status.
143
- #
144
- # file - The file path from which to get status.
145
- #
146
- # Returns Array of [file, mtime] or [nil, nil] if file not found.
147
- def get_status(file)
148
- if FileTest.exist?(file)
149
- [file, File.mtime(file).to_i]
150
- else
151
- warn "reload fail: library '#{lib}' not found" if verbose?
152
- #raise "The library '#{lib}' is not found."
153
- #$stdout.puts(message("The library '#{lib}' is not found.")) if @verbose
154
- [nil, nil]
155
- end
156
- end
157
-
158
- end
159
-
160
- end
161
-
162
- # Copyright (C) 2010 Rubyworks (BSD-2-Clause)
1
+ module AutoReload
2
+
3
+ # Reload class does all the heavy lifting
4
+ # for AutoReload library.
5
+ #
6
+ class Reloader
7
+
8
+ # Public: Shortcut for Reloader.new(*args).start.
9
+ def self.start(*args, &block)
10
+ self.new(*args, &block).start
11
+ end
12
+
13
+ # Public: Default interval is one second.
14
+ DEFAULT_INTERVAL = 1
15
+
16
+ # New Reloader.
17
+ #
18
+ # options - The Hash options used to refine the reloader (default: {}):
19
+ # :interval - Seconds between updates.
20
+ # :verbose - True provides reload warning.
21
+ # :reprime - Include $0 in reload list.
22
+ #
23
+ def initialize(options={}, &block)
24
+ @interval = (options[:interval] || DEFAULT_INTERVAL).to_f
25
+ @verbose = (options[:verbose])
26
+ @reprime = (options[:reprime])
27
+ @watch_gems = (options[:watch_gems])
28
+
29
+ @status = {}
30
+
31
+ features = $".dup
32
+ if block
33
+ block.call
34
+ @files = ($" - features).select do |f|
35
+ (@watch_gems ? true : f.start_with?(Dir.pwd)) && f.end_with?(".rb")
36
+ end.reverse
37
+
38
+ if @verbose
39
+ warn "watching files:"
40
+ warn "---------------"
41
+ warn @files
42
+ warn "---------------"
43
+ end
44
+ else
45
+ @files = []
46
+ end
47
+
48
+ update # note the files as they are now
49
+ end
50
+
51
+ # Public: Start the reload thread.
52
+ def start
53
+ @thread = Thread.new do
54
+ loop do
55
+ begin
56
+ update
57
+ rescue ScriptError, StandardError
58
+ warn "autoreload failed unexpectedly: #{$!}"
59
+ end
60
+ sleep @interval
61
+ end
62
+ end
63
+ @thread.abort_on_exception = true
64
+ @thread
65
+ end
66
+
67
+ # Public: Kills the autoreload thread.
68
+ def stop
69
+ @thread.kill if @thread
70
+ end
71
+
72
+ # Public: References the reload thread.
73
+ attr :thread
74
+
75
+ # Public: List of files provided to autoreload.
76
+ attr :files
77
+
78
+ # Public: Status hash, used to track reloads.
79
+ attr :status
80
+
81
+ # Public: The periodic interval of reload in seconds.
82
+ attr :interval
83
+
84
+ # Public: Provide warning on reload.
85
+ #
86
+ # Returns true/false if versboe mode.
87
+ def verbose?
88
+ @verbose || $VERBOSE
89
+ end
90
+
91
+ # Public: Put $0 in the reload list?
92
+ #
93
+ # Returns true/false whether to include $0.
94
+ def reprime?
95
+ @reprime
96
+ end
97
+
98
+
99
+
100
+ # The library files to autoreload.
101
+ def libraries
102
+ if @files.empty?
103
+ @reprime ? [$0] + $" : $"
104
+ else
105
+ @files
106
+ end
107
+ end
108
+
109
+ # Check every watched file and reload those that have changed since
110
+ # the reloader was made, or since they were last reloaded.
111
+ def update
112
+ libraries.each{ |lib| check(lib) }
113
+ end
114
+
115
+ private :libraries
116
+
117
+ private
118
+
119
+ # Check status and reload if out-of-date.
120
+ #
121
+ # lib - A library file.
122
+ #
123
+ def check(lib)
124
+ file, mtime = @status[lib]
125
+ if file
126
+ if FileTest.exist?(file)
127
+ curtime = File.mtime(file)
128
+ if mtime < curtime
129
+ warn "reload: '#{file}'" if verbose?
130
+ @status[lib] = [file, curtime]
131
+ load file
132
+ end
133
+ else
134
+ # file has been removed
135
+ end
136
+ else
137
+ @status[lib] = get_status(lib)
138
+ end
139
+ end
140
+
141
+ # Get library file status.
142
+ #
143
+ # file - The file path from which to get status.
144
+ #
145
+ # Returns Array of [file, mtime] or [nil, nil] if file not found.
146
+ def get_status(file)
147
+ if FileTest.exist?(file)
148
+ [file, File.mtime(file)]
149
+ else
150
+ warn "reload fail: library '#{file}' not found" if verbose?
151
+ #raise "The library '#{file}' is not found."
152
+ #$stdout.puts(message("The library '#{file}' is not found.")) if @verbose
153
+ [nil, nil]
154
+ end
155
+ end
156
+
157
+ end
158
+
159
+ end
160
+
161
+ # Copyright (C) 2010 Rubyworks (BSD-2-Clause)
@@ -1,4 +1,4 @@
1
1
  module AutoReload
2
2
  # Public: Current release version.
3
- VERSION = '1.1.0'
3
+ VERSION = '1.3.0'
4
4
  end
metadata CHANGED
@@ -1,95 +1,108 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoreload
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Thomas Sawyer
7
+ - Trans
8
8
  - Kouichirou Eto
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-11-08 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - '>='
17
+ - - ">="
19
18
  - !ruby/object:Gem::Version
20
- version: '0'
19
+ version: '13'
21
20
  type: :development
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
- - - '>='
24
+ - - ">="
26
25
  - !ruby/object:Gem::Version
27
- version: '0'
26
+ version: '13'
28
27
  - !ruby/object:Gem::Dependency
29
- name: minitest
28
+ name: rubytest
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
- - - '>='
31
+ - - ">="
33
32
  - !ruby/object:Gem::Version
34
- version: '0'
33
+ version: 0.11.1
35
34
  type: :development
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
- - - '>='
38
+ - - ">="
40
39
  - !ruby/object:Gem::Version
41
- version: '0'
40
+ version: 0.11.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: spectrum
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: assay
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.5.1
42
69
  description: Autoreload automatically reloads library files when they have been updated.
43
70
  It is especially useful when testing stateless services such as web applications.
44
71
  email:
45
72
  - transfire@gmail.com
46
73
  executables: []
47
74
  extensions: []
48
- extra_rdoc_files:
75
+ extra_rdoc_files: []
76
+ files:
77
+ - HISTORY.md
49
78
  - LICENSE.md
50
79
  - README.md
51
- - HISTORY.md
52
- files:
53
- - .index
54
- - .yardopts
80
+ - lib/autoreload.rb
55
81
  - lib/autoreload/reloader.rb
56
82
  - lib/autoreload/version.rb
57
- - lib/autoreload.rb
58
- - spec/autoreload_spec.rb
59
- - spec/helper.rb
60
- - spec/require_spec.rb
61
- - try/changeme.rb
62
- - try/tryme.rb
63
- - LICENSE.md
64
- - HISTORY.md
65
- - README.md
66
- homepage: http://rubyworks.github.com/autoreload
83
+ homepage: https://github.com/rubyworks/autoreload
67
84
  licenses:
68
85
  - BSD-2-Clause
69
- - RUBY
70
- metadata: {}
71
- post_install_message:
86
+ metadata:
87
+ source_code_uri: https://github.com/rubyworks/autoreload
88
+ bug_tracker_uri: https://github.com/rubyworks/autoreload/issues
89
+ changelog_uri: https://github.com/rubyworks/autoreload/blob/master/HISTORY.md
90
+ documentation_uri: https://rubydoc.info/gems/autoreload
72
91
  rdoc_options: []
73
92
  require_paths:
74
93
  - lib
75
94
  required_ruby_version: !ruby/object:Gem::Requirement
76
95
  requirements:
77
- - - '>='
96
+ - - ">="
78
97
  - !ruby/object:Gem::Version
79
- version: '0'
98
+ version: '3.1'
80
99
  required_rubygems_version: !ruby/object:Gem::Requirement
81
100
  requirements:
82
- - - '>='
101
+ - - ">="
83
102
  - !ruby/object:Gem::Version
84
103
  version: '0'
85
104
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.0.3
88
- signing_key:
105
+ rubygems_version: 3.6.9
89
106
  specification_version: 4
90
107
  summary: Automatically reload library files
91
- test_files:
92
- - spec/autoreload_spec.rb
93
- - spec/helper.rb
94
- - spec/require_spec.rb
95
- has_rdoc:
108
+ test_files: []
data/.index DELETED
@@ -1,53 +0,0 @@
1
- ---
2
- revision: 2013
3
- type: ruby
4
- sources:
5
- - Indexfile
6
- - Gemfile
7
- authors:
8
- - name: Thomas Sawyer
9
- email: transfire@gmail.com
10
- - name: Kouichirou Eto
11
- organizations: []
12
- requirements:
13
- - groups:
14
- - development
15
- version: '>= 0'
16
- name: rake
17
- - groups:
18
- - test
19
- version: '>= 0'
20
- name: minitest
21
- conflicts: []
22
- alternatives: []
23
- resources:
24
- - type: home
25
- uri: http://rubyworks.github.com/autoreload
26
- label: Homepage
27
- - type: code
28
- uri: http://github.com/rubyworks/autoreload
29
- label: Source Code
30
- - type: gems
31
- uri: http://rubygems.org/gems/autoreload
32
- repositories: []
33
- categories: []
34
- copyrights:
35
- - holder: Thomas Sawyer
36
- year: '2010'
37
- license: BSD-2-Clause
38
- - holder: Kouichiro Eto
39
- year: '2003'
40
- license: RUBY
41
- customs: []
42
- paths:
43
- lib:
44
- - lib
45
- version: 1.1.0
46
- name: autoreload
47
- title: AutoReload
48
- summary: Automatically reload library files
49
- description: Autoreload automatically reloads library files when they have been updated.
50
- It is especially useful when testing stateless services such as web applications.
51
- created: '2007-07-01'
52
- webcvs: https://github.com/rubyworks/autoreload/tree/master
53
- date: '2014-11-08'
data/.yardopts DELETED
@@ -1,9 +0,0 @@
1
- --title AutoReload
2
- --readme README.rdoc
3
- --plugin tomdoc
4
- --private
5
- --protected
6
- lib/
7
- -
8
- [A-Z]*.*
9
-
@@ -1,34 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/helper')
2
-
3
- describe "AutoReload" do
4
-
5
- it "should autoreload" do
6
- # create a library
7
- library = Pathname.new('tmp/library.rb')
8
- library.write 'def foo; 1; end'
9
-
10
- # setup the autoreload
11
- autoreload(:interval => 1) do #, :verbose=>true)
12
- require "library"
13
- end
14
-
15
- # check the number
16
- foo.must_equal 1
17
-
18
- # wait is needed for time stamp to not be same with the next file.
19
- sleep 2
20
-
21
- # recreate the file
22
- library.write 'def foo; 2; end'
23
-
24
- # wait again for the autoreload loop to repeat.
25
- sleep 2
26
-
27
- # check the number again
28
- foo.must_equal 2
29
-
30
- # clean up
31
- library.delete
32
- end
33
-
34
- end
data/spec/helper.rb DELETED
@@ -1,29 +0,0 @@
1
- require 'minitest/spec'
2
- require 'minitest/autorun'
3
-
4
- require 'fileutils'
5
- require 'pathname'
6
- require 'autoreload'
7
-
8
- # Some helper stuff....
9
-
10
- # create a tmp directory
11
- FileUtils.mkdir('tmp') unless File.exist?('tmp')
12
-
13
- $LOAD_PATH.unshift 'lib'
14
- $LOAD_PATH.unshift 'tmp'
15
-
16
- class Pathname
17
- def write(str)
18
- self.open('w') {|out|
19
- out.puts str
20
- }
21
- end
22
- end
23
-
24
- module AutoReload
25
- class Reloader
26
- public :warn
27
- end
28
- end
29
-
data/spec/require_spec.rb DELETED
@@ -1,37 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/helper')
2
-
3
- describe "AutoReload" do
4
-
5
- it "should autoreload a require of a require" do
6
- library1 = Pathname.new('tmp/library1.rb')
7
- library2 = Pathname.new('tmp/library2.rb')
8
-
9
- library1.write "require 'library2'"
10
- library2.write "def foo; 1; end"
11
-
12
- # setup the autoreload
13
- autoreload(:interval => 1) do #, :verbose=>true)
14
- require "library1"
15
- end
16
-
17
- # check the number
18
- foo.must_equal 1
19
-
20
- # wait is needed for time stamp to not be same with the next file.
21
- sleep 2
22
-
23
- # recreate the file
24
- library2.write "def foo; 2; end"
25
-
26
- # wait again for the autoreload loop to repeat.
27
- sleep 2
28
-
29
- # check the number again
30
- foo.must_equal 2
31
-
32
- # clean up
33
- library2.delete
34
- library1.delete
35
- end
36
-
37
- end
data/try/changeme.rb DELETED
@@ -1,6 +0,0 @@
1
- # Change this file while `tryme.rb' is running.
2
-
3
- def message
4
- "Change Me!"
5
- end
6
-
data/try/tryme.rb DELETED
@@ -1,18 +0,0 @@
1
- puts "Edit 'changme.rb' while this script is still running."
2
-
3
- __dir__ = File.dirname(__FILE__)
4
-
5
- $LOAD_PATH.unshift(File.join(__dir__, '../lib'))
6
-
7
- library = './' + __dir__ + '/changeme.rb'
8
-
9
- require 'autoreload'
10
-
11
- autoreload(:interval=>1, :verbose=>true) do
12
- require library
13
- end
14
-
15
- loop {
16
- puts message
17
- sleep 1
18
- }