autoreload 1.2.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: 25dbd16a1c6902601c7a9faa515f4a22629df674
4
- data.tar.gz: db877dea42c263c0483f2366ae5fbb3169804393
2
+ SHA256:
3
+ metadata.gz: 961fdd80bd04b065f9c23fedecdc4cfa75a980a34a2ca6d3bbcccb5304f2f41b
4
+ data.tar.gz: df64807553e910e77977ffb732749bc5d378cda074786c628fa60baf200adf8b
5
5
  SHA512:
6
- metadata.gz: 4580e1c18ce5cb1d2d9bde376149a7b4b6f593e29809fe624d0022124d947488e6e12aa3d26b8c320de1673f7ba7fa0840538be5996890e6e2339b3d7c29b254
7
- data.tar.gz: 7e7eeae32193686048662031d44013954aa10fb36d54d833ecfcaccc03995f98978808caea314bb57235eb8262b5bcde1f5660c4775733ae6d2b5a7af68ad197
6
+ metadata.gz: a395a345aada7e68646e9604abf9f393d33407241d0666d165d692dba309cf6a6559ce99092f1f89266df1fc90f0394cc088fbf118c3f70be4d2ef3a93e91add
7
+ data.tar.gz: 9659ea3c8e3e5658f977e2b99ab955d7a2a222727ce7cce20bd048c17aac507ef3ad7b35cfb7e88367b4dd68b9ec8eccf5ec0588bb620a0a7554037292c5af9c
data/HISTORY.md CHANGED
@@ -1,85 +1,108 @@
1
- # RELEASE HISTORY
2
-
3
- ## 1.2.0
4
-
5
- Add `watch_gems` option to watch all required gems. The default
6
- is now to only watch `.rb` files in the current working directory.
7
-
8
- Changes:
9
-
10
- * Add `:watch_gems` option.
11
- * Watch current working directory only, as default.
12
-
13
-
14
- ## 1.1.0
15
-
16
- This release is simply a maintenance release to bring the build
17
- configuration up to date.
18
-
19
- Changes:
20
-
21
- * Modernize build configuration.
22
- * Use interpolation on error message.
23
-
24
-
25
- ## 1.0.0 (2011-07-16)
26
-
27
- This release overhauls the API. The #autoreload method now
28
- takes a block. All libraries required within this block
29
- will be autoreloaded. The old API will raise an error!!!
30
- This was done to simplify the overaul design of the library
31
- and consequently make it much more efficient, but also to
32
- fix a rather nasty bug that prevented scripts required by
33
- other scripts that were to be autoreloaded from autoreloading
34
- as well.
35
-
36
- The new design rely's solely on $LOADED_FEATURES, rather than
37
- looking up files on the $LOAD_PATH itself. This has an important
38
- consequence for Ruby 1.8 or older. Becuase older version of Ruby
39
- do not put the expanded path in $LOADED_FEATURES, autoreloading
40
- occurs regardless of whether the file has changed or not. On
41
- Ruby 1.9+ however, where the full path is available, the file will
42
- only be reloaded if it has changed, it does this by checking the
43
- mtime of the file.
44
-
45
- Changes:
46
-
47
- * Overhaul API to use block form.
48
- * Remove Lookup module (no longer needed).
49
- * Fix require of require issue.
50
-
51
-
52
- ## 0.3.1 (2011-05-15)
53
-
54
- This release simply fixes licensing issues. Autoreload is licensed
55
- under the GPL v3.
56
-
57
-
58
- ## 0.3.0 (2010-10-14)
59
-
60
- Changes:
61
-
62
- * Fix issue with looking up Roller libraries.
63
- * Switch testing framework to RSpec2.
64
-
65
-
66
- ## 0.2.0 (2010-05-10)
67
-
68
- Changes:
69
-
70
- * Completely reworked API.
71
-
72
-
73
- ## 0.1.0 (2010-05-01)
74
-
75
- Changes:
76
-
77
- * Same as original, but now a RubyWorks project.
78
-
79
-
80
- ## 0.0.1 (2007-07-01)
81
-
82
- Changes:
83
-
84
- * Initial release
85
-
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,172 +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
- @watch_gems = (options[:watch_gems])
30
-
31
- @status = {}
32
-
33
- features = $".dup
34
- if block
35
- block.call
36
- @files = ($" - features).select do |f|
37
- (@watch_gems ? true : f.start_with?(Dir.pwd)) && f.end_with?(".rb")
38
- end.reverse
39
-
40
- if @verbose
41
- puts "watching files:"
42
- puts "---------------"
43
- puts @files
44
- puts "---------------"
45
- end
46
- else
47
- @files = []
48
- end
49
- end
50
-
51
- # Public: Start the reload thread.
52
- def start
53
- update # prime the path loads
54
- @thread = Thread.new do
55
- loop do
56
- begin
57
- update
58
- rescue Exception
59
- warn "autoreload failed unexpectedly: #{$!}"
60
- end
61
- sleep @interval
62
- end
63
- end
64
- @thread.abort_on_exception = true
65
- @thread
66
- end
67
-
68
- # Public: Kills the autoreload thread.
69
- def stop
70
- @thread.kill if @thread
71
- end
72
-
73
- # Public: References the reload thread.
74
- attr :thread
75
-
76
- # Public: List of files provided to autoreload.
77
- attr :files
78
-
79
- # Public: Status hash, used to track reloads.
80
- attr :status
81
-
82
- # Public: The periodic interval of reload in seconds.
83
- attr :interval
84
-
85
- # Public: Provide warning on reload.
86
- #
87
- # Returns true/false if versboe mode.
88
- def verbose?
89
- @verbose || $VERBOSE
90
- end
91
-
92
- # Public: Put $0 in the reload list?
93
- #
94
- # Returns true/false whether to include $0.
95
- def reprime?
96
- @reprime
97
- end
98
-
99
- private
100
-
101
- # TODO: Why include $0 in #libraries ?
102
-
103
- # The library files to autoreload.
104
- def libraries
105
- if @files.empty?
106
- @reprime ? [$0] + $" : $"
107
- else
108
- @files
109
- end
110
- end
111
-
112
- # Iterate through all selection library files and reload if needed.
113
- def update
114
- libraries.each{ |lib| check(lib) }
115
- end
116
-
117
- # Check status and reload if out-of-date.
118
- #
119
- # We can't check mtime under 1.8 b/c $LOADED_FEATURES does not
120
- # store the full path.
121
- #
122
- # lib - A library file.
123
- #
124
- # Returns Array of [file, mtime].
125
- def check(lib)
126
- if RUBY_VERSION < '1.9'
127
- warn "reload: '#{lib}'" if verbose?
128
- begin
129
- load lib
130
- rescue LoadError
131
- # file has been removed
132
- end
133
- else
134
- file, mtime = @status[lib]
135
- if file
136
- if FileTest.exist?(file)
137
- curtime = File.mtime(file).to_i
138
- if mtime < curtime
139
- warn "reload: '#{file}'" if verbose?
140
- load file
141
- @status[lib] = [file, curtime]
142
- end
143
- else
144
- # file has been removed
145
- end
146
- else
147
- @status[lib] = get_status(lib)
148
- end
149
- end
150
- end
151
-
152
- # Get library file status.
153
- #
154
- # file - The file path from which to get status.
155
- #
156
- # Returns Array of [file, mtime] or [nil, nil] if file not found.
157
- def get_status(file)
158
- if FileTest.exist?(file)
159
- [file, File.mtime(file).to_i]
160
- else
161
- warn "reload fail: library '#{file}' not found" if verbose?
162
- #raise "The library '#{file}' is not found."
163
- #$stdout.puts(message("The library '#{file}' is not found.")) if @verbose
164
- [nil, nil]
165
- end
166
- end
167
-
168
- end
169
-
170
- end
171
-
172
- # 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.2.0'
3
+ VERSION = '1.3.0'
4
4
  end
metadata CHANGED
@@ -1,137 +1,108 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoreload
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.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: 2015-05-07 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
42
41
  - !ruby/object:Gem::Dependency
43
- name: psych
42
+ name: spectrum
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
- - - '>='
45
+ - - ">="
47
46
  - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :runtime
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: rubysl
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: '2.0'
63
- type: :runtime
47
+ version: '0.2'
48
+ type: :development
64
49
  prerelease: false
65
50
  version_requirements: !ruby/object:Gem::Requirement
66
51
  requirements:
67
- - - ~>
52
+ - - ">="
68
53
  - !ruby/object:Gem::Version
69
- version: '2.0'
54
+ version: '0.2'
70
55
  - !ruby/object:Gem::Dependency
71
- name: minitest
56
+ name: assay
72
57
  requirement: !ruby/object:Gem::Requirement
73
58
  requirements:
74
- - - '>='
59
+ - - ">="
75
60
  - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :runtime
61
+ version: 0.5.1
62
+ type: :development
78
63
  prerelease: false
79
64
  version_requirements: !ruby/object:Gem::Requirement
80
65
  requirements:
81
- - - '>='
66
+ - - ">="
82
67
  - !ruby/object:Gem::Version
83
- version: '0'
68
+ version: 0.5.1
84
69
  description: Autoreload automatically reloads library files when they have been updated.
85
70
  It is especially useful when testing stateless services such as web applications.
86
71
  email:
87
72
  - transfire@gmail.com
88
73
  executables: []
89
74
  extensions: []
90
- extra_rdoc_files:
75
+ extra_rdoc_files: []
76
+ files:
77
+ - HISTORY.md
91
78
  - LICENSE.md
92
79
  - README.md
93
- - HISTORY.md
94
- files:
95
- - .index
96
- - .yardopts
80
+ - lib/autoreload.rb
97
81
  - lib/autoreload/reloader.rb
98
82
  - lib/autoreload/version.rb
99
- - lib/autoreload.rb
100
- - spec/autoreload_spec.rb
101
- - spec/helper.rb
102
- - spec/require_spec.rb
103
- - try/changeme.rb
104
- - try/tryme.rb
105
- - LICENSE.md
106
- - HISTORY.md
107
- - README.md
108
- homepage: http://rubyworks.github.com/autoreload
83
+ homepage: https://github.com/rubyworks/autoreload
109
84
  licenses:
110
85
  - BSD-2-Clause
111
- - RUBY
112
- metadata: {}
113
- 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
114
91
  rdoc_options: []
115
92
  require_paths:
116
93
  - lib
117
94
  required_ruby_version: !ruby/object:Gem::Requirement
118
95
  requirements:
119
- - - '>='
96
+ - - ">="
120
97
  - !ruby/object:Gem::Version
121
- version: '0'
98
+ version: '3.1'
122
99
  required_rubygems_version: !ruby/object:Gem::Requirement
123
100
  requirements:
124
- - - '>='
101
+ - - ">="
125
102
  - !ruby/object:Gem::Version
126
103
  version: '0'
127
104
  requirements: []
128
- rubyforge_project:
129
- rubygems_version: 2.0.3
130
- signing_key:
105
+ rubygems_version: 3.6.9
131
106
  specification_version: 4
132
107
  summary: Automatically reload library files
133
- test_files:
134
- - spec/autoreload_spec.rb
135
- - spec/helper.rb
136
- - spec/require_spec.rb
137
- has_rdoc:
108
+ test_files: []
data/.index DELETED
@@ -1,68 +0,0 @@
1
- ---
2
- revision: 2013
3
- type: ruby
4
- sources:
5
- - Index.rb
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
- - engines:
22
- - name: rbx
23
- version: 0+
24
- version: '>= 0'
25
- name: psych
26
- - engines:
27
- - name: rbx
28
- version: 0+
29
- version: ~> 2.0
30
- name: rubysl
31
- - engines:
32
- - name: rbx
33
- version: 0+
34
- version: '>= 0'
35
- name: minitest
36
- conflicts: []
37
- alternatives: []
38
- resources:
39
- - type: home
40
- uri: http://rubyworks.github.com/autoreload
41
- label: Homepage
42
- - type: code
43
- uri: http://github.com/rubyworks/autoreload
44
- label: Source Code
45
- - type: gems
46
- uri: http://rubygems.org/gems/autoreload
47
- repositories: []
48
- categories: []
49
- copyrights:
50
- - holder: Thomas Sawyer
51
- year: '2010'
52
- license: BSD-2-Clause
53
- - holder: Kouichiro Eto
54
- year: '2003'
55
- license: RUBY
56
- customs: []
57
- paths:
58
- lib:
59
- - lib
60
- version: 1.2.0
61
- name: autoreload
62
- title: AutoReload
63
- summary: Automatically reload library files
64
- description: Autoreload automatically reloads library files when they have been updated.
65
- It is especially useful when testing stateless services such as web applications.
66
- created: '2007-07-01'
67
- webcvs: https://github.com/rubyworks/autoreload/tree/master
68
- date: '2015-05-07'
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
- }