rerun 0.7.0.pre5 → 0.7.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.
- data/README.md +59 -25
- data/bin/rerun +1 -2
- data/lib/rerun/glob.rb +4 -1
- data/lib/rerun/runner.rb +0 -8
- data/rerun.gemspec +3 -5
- metadata +11 -9
    
        data/README.md
    CHANGED
    
    | @@ -6,18 +6,19 @@ Rerun launches your program, then watches the filesystem. If a relevant file | |
| 6 6 | 
             
            changes, then it restarts your program.
         | 
| 7 7 |  | 
| 8 8 | 
             
            Rerun works for both long-running processes (e.g. apps) and short-running ones
         | 
| 9 | 
            -
            (e.g. tests).  | 
| 10 | 
            -
             | 
| 9 | 
            +
            (e.g. tests). It's basically a no-frills command-line alternative to Guard,
         | 
| 10 | 
            +
            Shotgun, Autotest, etc. that doesn't require config files and works on any
         | 
| 11 | 
            +
            command, not just Ruby programs.
         | 
| 11 12 |  | 
| 12 | 
            -
            Rerun's advantage is its simple design. Since it uses  | 
| 13 | 
            -
            and  | 
| 14 | 
            -
            like it was when you ran it from the command line the first time.
         | 
| 13 | 
            +
            Rerun's advantage is its simple design. Since it uses `exec` and the standard
         | 
| 14 | 
            +
            Unix `SIGINT` and `SIGKILL` signals, you're sure the restarted app is really
         | 
| 15 | 
            +
            acting just like it was when you ran it from the command line the first time.
         | 
| 15 16 |  | 
| 16 | 
            -
            By default only  | 
| 17 | 
            +
            By default only `*.{rb,js,css,scss,sass,erb,html,haml,ru}` files are watched.
         | 
| 17 18 | 
             
            Use the `--pattern` option if you want to change this.
         | 
| 18 19 |  | 
| 19 | 
            -
             | 
| 20 | 
            -
            facilities for monitoring the filesystem, so CPU use is very light.
         | 
| 20 | 
            +
            As of version 0.7.0, we use the Listen gem, which tries to use your OS's
         | 
| 21 | 
            +
            built-in facilities for monitoring the filesystem, so CPU use is very light.
         | 
| 21 22 |  | 
| 22 23 | 
             
            Rerun does not work on Windows. Sorry, but you can't do much relaunching
         | 
| 23 24 | 
             
            without "fork".
         | 
| @@ -26,9 +27,11 @@ without "fork". | |
| 26 27 |  | 
| 27 28 | 
             
                    gem install rerun
         | 
| 28 29 |  | 
| 29 | 
            -
            "sudo" may be required on older systems.
         | 
| 30 | 
            +
            ("sudo" may be required on older systems, but try it without sudo first.)
         | 
| 30 31 |  | 
| 31 | 
            -
            If you are using RVM you might want to put this in your global gemset so it's | 
| 32 | 
            +
            If you are using RVM you might want to put this in your global gemset so it's
         | 
| 33 | 
            +
            available to all your apps. (There really should be a better way to distinguish
         | 
| 34 | 
            +
            gems-as-libraries from gems-as-tools.)
         | 
| 32 35 |  | 
| 33 36 | 
             
                    rvm @global do gem install rerun
         | 
| 34 37 |  | 
| @@ -36,8 +39,7 @@ If you are using RVM you might want to put this in your global gemset so it's av | |
| 36 39 |  | 
| 37 40 | 
             
                    rerun [options] [--] cmd
         | 
| 38 41 |  | 
| 39 | 
            -
            For example, if you're running a Sinatra app whose main file is
         | 
| 40 | 
            -
            app.rb:
         | 
| 42 | 
            +
            For example, if you're running a Sinatra app whose main file is `app.rb`:
         | 
| 41 43 |  | 
| 42 44 | 
             
                    rerun ruby app.rb
         | 
| 43 45 |  | 
| @@ -69,7 +71,24 @@ or | |
| 69 71 |  | 
| 70 72 | 
             
                    rerun -cx rspec
         | 
| 71 73 |  | 
| 72 | 
            -
             | 
| 74 | 
            +
            And if you're using [Spork](https://github.com/sporkrb/spork) with Rails, you
         | 
| 75 | 
            +
            need to [restart your spork server](https://github.com/sporkrb/spork/issues/201)
         | 
| 76 | 
            +
            whenever certain Rails environment files change, so why not put this in your
         | 
| 77 | 
            +
            Rakefile...
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                desc "run spork (via rerun)"
         | 
| 80 | 
            +
                task :spork do
         | 
| 81 | 
            +
                  sh "rerun --pattern '{Gemfile,Gemfile.lock,spec/spec_helper.rb,.rspec,spec/factories/**,config/environment.rb,config/environments/test.rb,config/initializers/*.rb,lib/**/*.rb}' -- spork"
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            and start using `rake spork` to launch your spork server?
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            (If you're using Guard instead of Rerun, check out
         | 
| 87 | 
            +
            [guard-spork](https://github.com/guard/guard-spork)
         | 
| 88 | 
            +
            for a similar solution.)
         | 
| 89 | 
            +
             | 
| 90 | 
            +
            How about regenerating your HTML files after every change to your
         | 
| 91 | 
            +
            [Erector](http://erector.rubyforge.org) widgets?
         | 
| 73 92 |  | 
| 74 93 | 
             
                    rerun -x erector --to-html my_site.rb
         | 
| 75 94 |  | 
| @@ -83,7 +102,8 @@ Procfile processes locally and restart them all when necessary. | |
| 83 102 | 
             
            `--dir` directory to watch (default = ".")
         | 
| 84 103 |  | 
| 85 104 | 
             
            `--pattern` glob to match inside directory. This uses the Ruby Dir glob style -- see <http://www.ruby-doc.org/core/classes/Dir.html#M002322> for details.
         | 
| 86 | 
            -
            By default it watches  | 
| 105 | 
            +
            By default it watches files ending in: `rb,js,css,scss,sass,erb,html,haml,ru`.
         | 
| 106 | 
            +
            It also ignores directories named `.rbx .bundle .git .svn log tmp vendor` and files named `.DS_Store`.
         | 
| 87 107 |  | 
| 88 108 | 
             
            `--clear` (or -c) clear the screen before each run
         | 
| 89 109 |  | 
| @@ -96,7 +116,8 @@ Also --version and --help, naturally. | |
| 96 116 | 
             
            If you have `growlnotify` available on the `PATH`, it sends notifications to
         | 
| 97 117 | 
             
            growl in addition to the console.
         | 
| 98 118 |  | 
| 99 | 
            -
            Download [growlnotify here](http://growl.info/downloads.php#generaldownloads) | 
| 119 | 
            +
            Download [growlnotify here](http://growl.info/downloads.php#generaldownloads)
         | 
| 120 | 
            +
            now that Growl has moved to the App Store.
         | 
| 100 121 |  | 
| 101 122 | 
             
            # On-The-Fly Commands
         | 
| 102 123 |  | 
| @@ -110,15 +131,21 @@ While the app is (re)running, you can make things happen by pressing keys: | |
| 110 131 |  | 
| 111 132 | 
             
            * Cooldown (so if a dozen files appear in a burst, say from 'git pull', it only restarts once)
         | 
| 112 133 | 
             
            * If the last element of the command is a `.ru` file and there's no other command then use `rackup`
         | 
| 113 | 
            -
            *  | 
| 134 | 
            +
            * Exclude files beginning with a dot, unless the pattern explicitly says to include them
         | 
| 135 | 
            +
            * Allow multiple sets of directories and patterns
         | 
| 136 | 
            +
            * --exclude pattern
         | 
| 114 137 | 
             
            * ".rerun" file to specify options per project or in $HOME.
         | 
| 115 138 | 
             
            * Test on Linux.
         | 
| 116 | 
            -
            * Merge with Kicker or Watchr or Guard -- maybe by using it as a library and writing a Rerun recipe
         | 
| 117 139 | 
             
            * On OS X, use a C library using growl's developer API <http://growl.info/developer/>
         | 
| 140 | 
            +
            * Use growl's AppleScript or SDK instead of relying on growlnotify
         | 
| 118 141 | 
             
            * "Failed" icon
         | 
| 119 142 | 
             
            * Get Rails icon working
         | 
| 120 143 | 
             
            * Figure out an algorithm so "-x" is not needed (if possible)
         | 
| 121 | 
            -
            *  | 
| 144 | 
            +
            * Specify (or deduce) port to listen for to determine success of a web server launch
         | 
| 145 | 
            +
            * Make sure to pass through quoted options correctly to target process [bug]
         | 
| 146 | 
            +
            * Make it work on Windows, like Guard now does. See
         | 
| 147 | 
            +
              * https://github.com/guard/guard/issues/59
         | 
| 148 | 
            +
              * https://github.com/guard/guard/issues/27
         | 
| 122 149 |  | 
| 123 150 | 
             
            # Other projects that do similar things
         | 
| 124 151 |  | 
| @@ -129,6 +156,7 @@ While the app is (re)running, you can make things happen by pressing keys: | |
| 129 156 | 
             
            * Kicker: <http://github.com/alloy/kicker/>
         | 
| 130 157 | 
             
            * Watchr: <https://github.com/mynyml/watchr>
         | 
| 131 158 | 
             
            * Guard: <http://github.com/guard/guard>
         | 
| 159 | 
            +
            * Autotest: <https://github.com/grosser/autotest>
         | 
| 132 160 |  | 
| 133 161 | 
             
            # Why would I use this instead of Shotgun?
         | 
| 134 162 |  | 
| @@ -145,10 +173,10 @@ does it much less frequently. And once it's running it behaves more | |
| 145 173 | 
             
            normally and consistently with your production app.
         | 
| 146 174 |  | 
| 147 175 | 
             
            Also, Shotgun reloads the app on every request, even if it doesn't
         | 
| 148 | 
            -
            need to. This is fine if you're loading a single file, but  | 
| 149 | 
            -
            pages all load other files (CSS, JS, media)  | 
| 150 | 
            -
             | 
| 151 | 
            -
            server so this  | 
| 176 | 
            +
            need to. This is fine if you're loading a single file, but if your web
         | 
| 177 | 
            +
            pages all load other files (CSS, JS, media) then that adds up quickly.
         | 
| 178 | 
            +
            (I can only assume that the developers of shotgun are using caching or a
         | 
| 179 | 
            +
            front web server so this isn't a pain point for them.)
         | 
| 152 180 |  | 
| 153 181 | 
             
            And hey, does Shotgun reload your Worker processes if you're using Foreman and
         | 
| 154 182 | 
             
            a Procfile? I'm pretty sure it doesn't.
         | 
| @@ -161,7 +189,7 @@ Rack::Reloader is certifiably beautiful code, and is a very elegant use | |
| 161 189 | 
             
            of Rack's middleware architecture. But because it relies on the
         | 
| 162 190 | 
             
            LOADED_FEATURES variable, it only reloads .rb files that were 'require'd,
         | 
| 163 191 | 
             
            not 'load'ed. That leaves out (non-Erector) template files, and also,
         | 
| 164 | 
            -
            the way I was doing it, sub-actions (see
         | 
| 192 | 
            +
            at least the way I was doing it, sub-actions (see
         | 
| 165 193 | 
             
            [this thread](http://groups.google.com/group/sinatrarb/browse_thread/thread/7329727a9296e96a#
         | 
| 166 194 | 
             
            )).
         | 
| 167 195 |  | 
| @@ -169,6 +197,12 @@ Rack::Reloader also doesn't reload configuration changes or redo other | |
| 169 197 | 
             
            things that happen during app startup. Rerun takes the attitude that if
         | 
| 170 198 | 
             
            you want to restart an app, you should just restart the whole app. You know?
         | 
| 171 199 |  | 
| 200 | 
            +
            # Why would I use this instead of Guard?
         | 
| 201 | 
            +
             | 
| 202 | 
            +
            Guard is very powerful but requires some up-front configuration.
         | 
| 203 | 
            +
            Rerun is meant as a no-frills command-line alternative requiring no knowledge
         | 
| 204 | 
            +
            of Ruby nor config file syntax.
         | 
| 205 | 
            +
             | 
| 172 206 | 
             
            # Why did you write this?
         | 
| 173 207 |  | 
| 174 208 | 
             
            I've been using [Sinatra](http://sinatrarb.com) and loving it. In order
         | 
| @@ -182,7 +216,7 @@ Rerun together out of code from Rspactor, FileSystemWatcher, and Shotgun | |
| 182 216 |  | 
| 183 217 | 
             
            # Credits
         | 
| 184 218 |  | 
| 185 | 
            -
            Rerun: Alex Chaffee, <mailto:alex@stinky.com>, <http://github.com/alexch/>
         | 
| 219 | 
            +
            Rerun: [Alex Chaffee](http://alexchaffee.com), <mailto:alex@stinky.com>, <http://github.com/alexch/>
         | 
| 186 220 |  | 
| 187 221 | 
             
            Based upon and/or inspired by:
         | 
| 188 222 |  | 
| @@ -201,7 +235,7 @@ Based upon and/or inspired by: | |
| 201 235 | 
             
            # Version History
         | 
| 202 236 |  | 
| 203 237 | 
             
            * v0.7.0
         | 
| 204 | 
            -
              * uses Listen gem
         | 
| 238 | 
            +
              * uses Listen gem (which uses rb-fsevent for lightweight filesystem snooping)
         | 
| 205 239 |  | 
| 206 240 | 
             
            # License
         | 
| 207 241 |  | 
    
        data/bin/rerun
    CHANGED
    
    | @@ -8,13 +8,12 @@ $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir) | |
| 8 8 | 
             
            load "#{libdir}/../rerun.gemspec" # defines "$spec" variable, which we read the version from
         | 
| 9 9 |  | 
| 10 10 | 
             
            require 'rerun'
         | 
| 11 | 
            -
             | 
| 12 11 | 
             
            require 'optparse'
         | 
| 13 12 |  | 
| 14 13 | 
             
            options = {}
         | 
| 15 14 |  | 
| 16 15 | 
             
            opts = OptionParser.new("", 24, '  ') { |opts|
         | 
| 17 | 
            -
              opts.banner = "Usage: rerun cmd"
         | 
| 16 | 
            +
              opts.banner = "Usage: rerun [options] [--] cmd"
         | 
| 18 17 |  | 
| 19 18 | 
             
              opts.separator ""
         | 
| 20 19 | 
             
              opts.separator "Launches an app, and restarts it when the filesystem changes."
         | 
    
        data/lib/rerun/glob.rb
    CHANGED
    
    | @@ -5,6 +5,8 @@ | |
| 5 5 | 
             
            module Rerun
         | 
| 6 6 | 
             
              class Glob
         | 
| 7 7 | 
             
                NO_LEADING_DOT = '(?=[^\.])'   # todo
         | 
| 8 | 
            +
                START_OF_FILENAME = '(\A|\/)'  # beginning of string or a slash
         | 
| 9 | 
            +
                END_OF_STRING = '\z'
         | 
| 8 10 |  | 
| 9 11 | 
             
                def initialize glob_string
         | 
| 10 12 | 
             
                  @glob_string = glob_string
         | 
| @@ -17,7 +19,7 @@ module Rerun | |
| 17 19 |  | 
| 18 20 | 
             
                  curlies = 0;
         | 
| 19 21 | 
             
                  escaping = false;
         | 
| 20 | 
            -
                  chars.map do |char|
         | 
| 22 | 
            +
                  string = chars.map do |char|
         | 
| 21 23 | 
             
                    if escaping
         | 
| 22 24 | 
             
                      escaping = false
         | 
| 23 25 | 
             
                      char
         | 
| @@ -58,6 +60,7 @@ module Rerun | |
| 58 60 | 
             
                      end
         | 
| 59 61 | 
             
                    end
         | 
| 60 62 | 
             
                  end.join
         | 
| 63 | 
            +
                  START_OF_FILENAME + string + END_OF_STRING
         | 
| 61 64 | 
             
                end
         | 
| 62 65 |  | 
| 63 66 | 
             
                def to_regexp
         | 
    
        data/lib/rerun/runner.rb
    CHANGED
    
    | @@ -31,14 +31,6 @@ module Rerun | |
| 31 31 | 
             
                        when 'x', 'q'
         | 
| 32 32 | 
             
                          die
         | 
| 33 33 | 
             
                          break  # the break will stop this thread, in case the 'die' doesn't
         | 
| 34 | 
            -
                        when 't'
         | 
| 35 | 
            -
                          puts
         | 
| 36 | 
            -
                          puts "#{Thread.list.size} threads:"
         | 
| 37 | 
            -
                          Thread.list.each do |t|
         | 
| 38 | 
            -
                            puts "#{t.object_id}\tstatus: #{t.status}"
         | 
| 39 | 
            -
                            puts "\t" + t.backtrace[0..5].join("\n\t")
         | 
| 40 | 
            -
                            puts
         | 
| 41 | 
            -
                          end
         | 
| 42 34 | 
             
                        else
         | 
| 43 35 | 
             
                          puts "\n#{c.inspect} pressed inside rerun"
         | 
| 44 36 | 
             
                          puts [["c", "clear screen"],
         | 
    
        data/rerun.gemspec
    CHANGED
    
    | @@ -3,10 +3,10 @@ $spec = Gem::Specification.new do |s| | |
| 3 3 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 4 4 |  | 
| 5 5 | 
             
              s.name = 'rerun'
         | 
| 6 | 
            -
              s.version = '0.7.0 | 
| 6 | 
            +
              s.version = '0.7.0'
         | 
| 7 7 |  | 
| 8 | 
            -
              s.description = "Restarts your app when a file changes"
         | 
| 9 | 
            -
              s.summary     = "Launches an app, and restarts it whenever the filesystem changes."
         | 
| 8 | 
            +
              s.description = "Restarts your app when a file changes. A no-frills, command-line alternative to Guard, Shotgun, Autotest, etc."
         | 
| 9 | 
            +
              s.summary     = "Launches an app, and restarts it whenever the filesystem changes. A no-frills, command-line alternative to Guard, Shotgun, Autotest, etc."
         | 
| 10 10 |  | 
| 11 11 | 
             
              s.authors = ["Alex Chaffee"]
         | 
| 12 12 | 
             
              s.email = "alex@stinky.com"
         | 
| @@ -31,6 +31,4 @@ $spec = Gem::Specification.new do |s| | |
| 31 31 |  | 
| 32 32 | 
             
              s.homepage = "http://github.com/alexch/rerun/"
         | 
| 33 33 | 
             
              s.require_paths = %w[lib]
         | 
| 34 | 
            -
              s.rubyforge_project = 'pivotalrb'
         | 
| 35 | 
            -
              s.rubygems_version = '1.1.1'
         | 
| 36 34 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rerun
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7.0 | 
| 5 | 
            -
              prerelease:  | 
| 4 | 
            +
              version: 0.7.0
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| 8 8 | 
             
            - Alex Chaffee
         | 
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012-07- | 
| 12 | 
            +
            date: 2012-07-05 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: listen
         | 
| @@ -27,7 +27,8 @@ dependencies: | |
| 27 27 | 
             
                - - ! '>='
         | 
| 28 28 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 29 | 
             
                    version: '0'
         | 
| 30 | 
            -
            description: Restarts your app when a file changes
         | 
| 30 | 
            +
            description: Restarts your app when a file changes. A no-frills, command-line alternative
         | 
| 31 | 
            +
              to Guard, Shotgun, Autotest, etc.
         | 
| 31 32 | 
             
            email: alex@stinky.com
         | 
| 32 33 | 
             
            executables:
         | 
| 33 34 | 
             
            - rerun
         | 
| @@ -61,17 +62,18 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 61 62 | 
             
                  version: '0'
         | 
| 62 63 | 
             
                  segments:
         | 
| 63 64 | 
             
                  - 0
         | 
| 64 | 
            -
                  hash: - | 
| 65 | 
            +
                  hash: -3814571131804990059
         | 
| 65 66 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 66 67 | 
             
              none: false
         | 
| 67 68 | 
             
              requirements:
         | 
| 68 | 
            -
              - - ! ' | 
| 69 | 
            +
              - - ! '>='
         | 
| 69 70 | 
             
                - !ruby/object:Gem::Version
         | 
| 70 | 
            -
                  version:  | 
| 71 | 
            +
                  version: '0'
         | 
| 71 72 | 
             
            requirements: []
         | 
| 72 | 
            -
            rubyforge_project:  | 
| 73 | 
            +
            rubyforge_project: 
         | 
| 73 74 | 
             
            rubygems_version: 1.8.24
         | 
| 74 75 | 
             
            signing_key: 
         | 
| 75 76 | 
             
            specification_version: 2
         | 
| 76 | 
            -
            summary: Launches an app, and restarts it whenever the filesystem changes.
         | 
| 77 | 
            +
            summary: Launches an app, and restarts it whenever the filesystem changes. A no-frills,
         | 
| 78 | 
            +
              command-line alternative to Guard, Shotgun, Autotest, etc.
         | 
| 77 79 | 
             
            test_files: []
         |