spring 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spring/client/binstub.rb +1 -1
- data/lib/spring/client/rails.rb +3 -2
- data/lib/spring/commands/rails.rb +7 -0
- data/lib/spring/version.rb +1 -1
- metadata +3 -26
- data/.gitignore +0 -19
- data/.travis.yml +0 -12
- data/CHANGELOG.md +0 -220
- data/CONTRIBUTING.md +0 -52
- data/Gemfile +0 -4
- data/Rakefile +0 -21
- data/spring.gemspec +0 -23
- data/test/acceptance_test.rb +0 -4
- data/test/apps/.gitignore +0 -3
- data/test/helper.rb +0 -7
- data/test/unit/client/help_test.rb +0 -60
- data/test/unit/client/version_test.rb +0 -14
- data/test/unit/commands_test.rb +0 -59
- data/test/unit/process_title_updater_test.rb +0 -24
- data/test/unit/watcher_test.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2751328582e59ecfbe43458b4aeda4159e8a045d
|
4
|
+
data.tar.gz: 332e184154c8669ac02e60a25956a3ce0777ab7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a50213813827d8ad5c51b1f00cd6d828c1045b43c5a2137f66f274f8ab0e1b53747aa997fa2cdef6963febc7a8328376420153944baa584435ac1f2c761971ea
|
7
|
+
data.tar.gz: e0f7559a8efef0731e42c057637aa81e83e8593d68e630c048795acfde127b650c64f2fa7fe8eae77346a351396c1c871da966ce8671d745fa434c161109b6b6
|
@@ -146,7 +146,7 @@ CODE
|
|
146
146
|
when "--all"
|
147
147
|
@all = true
|
148
148
|
commands = Spring.commands.dup
|
149
|
-
commands.delete_if { |
|
149
|
+
commands.delete_if { |command_name, _| command_name.start_with?("rails_") }
|
150
150
|
commands.values + [self.class.rails_command]
|
151
151
|
when "--remove"
|
152
152
|
@mode = :remove
|
data/lib/spring/client/rails.rb
CHANGED
@@ -3,13 +3,14 @@ require "set"
|
|
3
3
|
module Spring
|
4
4
|
module Client
|
5
5
|
class Rails < Command
|
6
|
-
COMMANDS = Set.new %w(console runner generate destroy)
|
6
|
+
COMMANDS = Set.new %w(console runner generate destroy test)
|
7
7
|
|
8
8
|
ALIASES = {
|
9
9
|
"c" => "console",
|
10
10
|
"r" => "runner",
|
11
11
|
"g" => "generate",
|
12
|
-
"d" => "destroy"
|
12
|
+
"d" => "destroy",
|
13
|
+
"t" => "test"
|
13
14
|
}
|
14
15
|
|
15
16
|
def self.description
|
@@ -83,9 +83,16 @@ module Spring
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
class RailsTest < Rails
|
87
|
+
def command_name
|
88
|
+
"test"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
86
92
|
Spring.register_command "rails_console", RailsConsole.new
|
87
93
|
Spring.register_command "rails_generate", RailsGenerate.new
|
88
94
|
Spring.register_command "rails_destroy", RailsDestroy.new
|
89
95
|
Spring.register_command "rails_runner", RailsRunner.new
|
96
|
+
Spring.register_command "rails_test", RailsTest.new
|
90
97
|
end
|
91
98
|
end
|
data/lib/spring/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Leighton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -46,14 +46,8 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- ".gitignore"
|
50
|
-
- ".travis.yml"
|
51
|
-
- CHANGELOG.md
|
52
|
-
- CONTRIBUTING.md
|
53
|
-
- Gemfile
|
54
49
|
- LICENSE.txt
|
55
50
|
- README.md
|
56
|
-
- Rakefile
|
57
51
|
- bin/spring
|
58
52
|
- lib/spring/application.rb
|
59
53
|
- lib/spring/application/boot.rb
|
@@ -90,15 +84,6 @@ files:
|
|
90
84
|
- lib/spring/watcher.rb
|
91
85
|
- lib/spring/watcher/abstract.rb
|
92
86
|
- lib/spring/watcher/polling.rb
|
93
|
-
- spring.gemspec
|
94
|
-
- test/acceptance_test.rb
|
95
|
-
- test/apps/.gitignore
|
96
|
-
- test/helper.rb
|
97
|
-
- test/unit/client/help_test.rb
|
98
|
-
- test/unit/client/version_test.rb
|
99
|
-
- test/unit/commands_test.rb
|
100
|
-
- test/unit/process_title_updater_test.rb
|
101
|
-
- test/unit/watcher_test.rb
|
102
87
|
homepage: http://github.com/rails/spring
|
103
88
|
licenses:
|
104
89
|
- MIT
|
@@ -123,12 +108,4 @@ rubygems_version: 2.4.5
|
|
123
108
|
signing_key:
|
124
109
|
specification_version: 4
|
125
110
|
summary: Rails application preloader
|
126
|
-
test_files:
|
127
|
-
- test/acceptance_test.rb
|
128
|
-
- test/apps/.gitignore
|
129
|
-
- test/helper.rb
|
130
|
-
- test/unit/client/help_test.rb
|
131
|
-
- test/unit/client/version_test.rb
|
132
|
-
- test/unit/commands_test.rb
|
133
|
-
- test/unit/process_title_updater_test.rb
|
134
|
-
- test/unit/watcher_test.rb
|
111
|
+
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/CHANGELOG.md
DELETED
@@ -1,220 +0,0 @@
|
|
1
|
-
## 1.3.3
|
2
|
-
|
3
|
-
* Fix yet another problem with loading spring which seems to affect
|
4
|
-
some/all rbenv users. Issue #390.
|
5
|
-
|
6
|
-
## 1.3.2
|
7
|
-
|
8
|
-
* Fix another problem with gems bundled from git repositories. This
|
9
|
-
affected chruby and RVM users, and possibly others. See #383.
|
10
|
-
|
11
|
-
## 1.3.1
|
12
|
-
|
13
|
-
* Fix a problem with gems bundled from a git repository, where the
|
14
|
-
`bin/spring` was generated before 1.3.0.
|
15
|
-
|
16
|
-
## 1.3.0
|
17
|
-
|
18
|
-
* Automatically restart spring after new commands are added. This means
|
19
|
-
that you can add spring-commands-rspec to your Gemfile and then
|
20
|
-
immediately start using it, without having to run `spring stop`.
|
21
|
-
(Spring will effectively run `spring stop` for you.)
|
22
|
-
* Make app reloading work in apps which spew out lots of output on
|
23
|
-
startup (previously a buffer would fill up and cause the process to
|
24
|
-
hang). Issue #332.
|
25
|
-
* Make sure running `bin/spring` does not add an empty string to `Gem.path`.
|
26
|
-
Issues #297, #310.
|
27
|
-
* Fixed problem with `$0` including the command line args, which could
|
28
|
-
confuse commands which try to parse `$0`. This caused the
|
29
|
-
spring-commands-rspec to not work properly in some cases. Issue #369.
|
30
|
-
* Add OpenBSD compatibility for `spring status`. Issue #299.
|
31
|
-
* Rails 3.2 no longer officially supported (but it may continue to work)
|
32
|
-
|
33
|
-
## 1.2.0
|
34
|
-
|
35
|
-
* Accept -e and --environment options for `rails console`.
|
36
|
-
* Watch `config/secrets.yml` by default. #289 - @morgoth
|
37
|
-
* Change monkey-patched `Kernel.raise` from public to private (to match default Ruby behavior) #351 - @mattbrictson
|
38
|
-
* Let application_id also respect RUBY_VERSION for the use case of switching between Ruby versions for a given Rails app - @methodmissing
|
39
|
-
* Extract the 'listen' watcher to a separate `spring-watcher-listen`
|
40
|
-
gem. This allows it to be developed/maintained separately.
|
41
|
-
|
42
|
-
## 1.1.3
|
43
|
-
|
44
|
-
* The `rails runner` command no longer passes environment switches to
|
45
|
-
files which it runs. Issue #272.
|
46
|
-
* Various issues solved to do with termination / processes hanging around
|
47
|
-
longer than they should. Issue #290.
|
48
|
-
|
49
|
-
## 1.1.2
|
50
|
-
|
51
|
-
* Detect old binstubs generated with Spring 1.0 and exit with an error.
|
52
|
-
This prevents a situation where you can get stuck in an infinite loop
|
53
|
-
of spring invocations.
|
54
|
-
* Avoid `warning: already initialized constant APP_PATH` when running
|
55
|
-
rails commands that do not use spring (e.g. `bin/rails server` would
|
56
|
-
emit this when you ^C to exit)
|
57
|
-
* Fix `reload!` in rails console
|
58
|
-
* Don't connect/disconnect the database if there are no connections
|
59
|
-
configured. Issue #256.
|
60
|
-
|
61
|
-
## 1.1.1
|
62
|
-
|
63
|
-
* Fix `$0` so that it is no longer prefixed with "spring ", as doing
|
64
|
-
this cause issues with rspec when running just `rspec` with no
|
65
|
-
arguments.
|
66
|
-
* Ensure we're always connected to a tty when preloading the
|
67
|
-
application in the background, in order to avoid loading issues
|
68
|
-
with readline + libedit which affected pry-rails.
|
69
|
-
|
70
|
-
## 1.1.0
|
71
|
-
|
72
|
-
* A `bin/spring` binstub is now generated. This allows us to load spring
|
73
|
-
correctly if you have it installed locally with a `BUNDLE_PATH`, so
|
74
|
-
it's no longer necessary to install spring system-wide. We also
|
75
|
-
activate the correct version from your Gemfile.lock. Note that you
|
76
|
-
still can't have spring in your Gemfile as a git repository or local
|
77
|
-
path; it must be a proper gem.
|
78
|
-
* Various changes to how springified binstubs are implemented. Existing
|
79
|
-
binstubs will continue to work, but it's recommended to run `spring binstub`
|
80
|
-
again to upgrade them to the new format.
|
81
|
-
* `spring binstub --remove` option added for removing spring from
|
82
|
-
binstubs. This won't work unless you have upgraded your binstubs to
|
83
|
-
the new format.
|
84
|
-
* `config/database.yml` is watched
|
85
|
-
* Better application restarts - if you introduce an error, for example
|
86
|
-
by editing `config/application.rb`, spring will now continue to watch
|
87
|
-
your files and will immediately try to restart the application when
|
88
|
-
you edit `config/application.rb` again (hopefully to correct the error).
|
89
|
-
This means that by the time you come to run a command the application
|
90
|
-
may well already be running.
|
91
|
-
* Gemfile changes are now gracefully handled. Previously they would
|
92
|
-
cause spring to simply quit, meaning that you'd incur the full startup
|
93
|
-
penalty on the next run. Now spring doesn't quit, and will try to load
|
94
|
-
up your new bundle in the background.
|
95
|
-
* Fix support for using spring with Rails engines/plugins
|
96
|
-
|
97
|
-
## 1.0.0
|
98
|
-
|
99
|
-
* Enterprise ready secret sauce added
|
100
|
-
|
101
|
-
## 0.9.2
|
102
|
-
|
103
|
-
* Bugfix: environment variables set by bundler (`BUNDLE_GEMFILE`,
|
104
|
-
`RUBYOPT`, etc...) were being removed from the environment.
|
105
|
-
* Ensure we only run the code reloader when files have actually changed.
|
106
|
-
This issue became more prominent with Rails 4, since Rails 4 will now
|
107
|
-
reload routes whenever the code is reloaded (see
|
108
|
-
https://github.com/rails/rails/commit/b9b06daa915fdc4d11e8cfe11a7175e5cd8f104f).
|
109
|
-
* Allow spring to be used in a descendant directory of the application
|
110
|
-
root
|
111
|
-
* Use the system tmpdir for our temporary files. Previously we used
|
112
|
-
`APP_ROOT/tmp/spring`, which caused problems on filesystems which did
|
113
|
-
not support sockets, and also caused problems if `APP_ROOT` was
|
114
|
-
sufficiently deep in the filesystem to exhaust the operating system's
|
115
|
-
socket name limit. Hence we had a `SPRING_TMP_PATH` environment
|
116
|
-
variable for configuration. We now use `/tmp/spring/[md5(APP_ROOT)]`
|
117
|
-
for the socket and `/tmp/spring/[md5(APP_ROOT)].pid` for the pid file.
|
118
|
-
Thanks @Kriechi for the suggestion. Setting `SPRING_TMP_PATH` no longer
|
119
|
-
has any effect.
|
120
|
-
|
121
|
-
## 0.9.1
|
122
|
-
|
123
|
-
* Environment variables which were created during application startup are no
|
124
|
-
longer overwritten.
|
125
|
-
* Support for generating multiple binstubs at once. Use --all to
|
126
|
-
generate all, otherwise you can pass multiple command names to the
|
127
|
-
binstub command.
|
128
|
-
* The `testunit` command has been extracted to the
|
129
|
-
`spring-commands-testunit` gem, because it's not necessary in Rails 4,
|
130
|
-
where you can just run `rake test path/to/test`.
|
131
|
-
* The `~/.spring.rb` config file is loaded before bundler, so it's a good
|
132
|
-
place to require extra commands which you want to use in all projects,
|
133
|
-
without having to add those commands to the Gemfile of each individual
|
134
|
-
project.
|
135
|
-
* Any gems in the bundle with names which start with "spring-commands-"
|
136
|
-
are now autoloaded. This makes it less faffy to add additional
|
137
|
-
commands.
|
138
|
-
|
139
|
-
## 0.9.0
|
140
|
-
|
141
|
-
* Display spring version in the help message
|
142
|
-
* Remove workaround for Rubygems performance issue. This issue is solved
|
143
|
-
with Rubygems 2.1, so we no longer need to generate a "spring" binstub
|
144
|
-
file. We warn users if they are not taking advantage of the Rubygems
|
145
|
-
perf fix (e.g. if they are not on 2.1, or haven't run `gem pristine
|
146
|
-
--all`). To upgrade, delete your `bin/spring` and re-run `spring
|
147
|
-
binstub` for each of your binstubs.
|
148
|
-
* Binstubs now fall back to non-spring execution of a command if the
|
149
|
-
spring gem is not present. This might be useful for production
|
150
|
-
environments.
|
151
|
-
* The ENV will be replaced on each run to match the ENV which exists
|
152
|
-
when the spring command is actually run (rather than the ENV which
|
153
|
-
exists when spring first starts).
|
154
|
-
* Specifying the rails env after the rake command (e.g. `rake
|
155
|
-
RAILS_ENV=test db:migrate`) now works as expected.
|
156
|
-
* Provide an explicit way to set the environment to use when running
|
157
|
-
`rake` on its own.
|
158
|
-
* The `rspec` and `cucumber` commands are no longer shipped by default.
|
159
|
-
They've been moved to the `spring-commands-rspec` and
|
160
|
-
`spring-commands-cucumber` gems.
|
161
|
-
|
162
|
-
## 0.0.11
|
163
|
-
|
164
|
-
* Added the `rails destroy` command.
|
165
|
-
* Global config file in `~/.spring.rb`
|
166
|
-
* Added logging for debugging. Specify a log file with the
|
167
|
-
`SPRING_LOG` environment variable.
|
168
|
-
* Fix hang on "Run `bundle install` to install missing gems"
|
169
|
-
* Added hack to make backtraces generated when running a command
|
170
|
-
quieter (by stripping out all of the lines relating to spring)
|
171
|
-
* Rails 4 is officially supported
|
172
|
-
|
173
|
-
## 0.0.10
|
174
|
-
|
175
|
-
* Added `Spring.watch_method=` configuration option to switch between
|
176
|
-
polling and the `listen` gem. Previously, we used the `listen` gem if
|
177
|
-
it was available, but this makes the option explicit. Set
|
178
|
-
`Spring.watch_method = :listen` to use the listen gem.
|
179
|
-
* Fallback when Process.fork is not available. In such cases, the user
|
180
|
-
will not receive the speedup that Spring provides, but won't receive
|
181
|
-
an error either.
|
182
|
-
* Don't preload `test_helper` or `spec_helper` by default. This was
|
183
|
-
causing people subtle problems (for example see #113) and is perhaps
|
184
|
-
surprising behaviour. It may be desirable but it depends on the
|
185
|
-
application, therefore we suggest it to people in the README but no
|
186
|
-
longer do it by default.
|
187
|
-
* Don't stay connected to database in the application processes. There's
|
188
|
-
no need to keep a connection open.
|
189
|
-
* Avoid using the database in the application processes. Previously,
|
190
|
-
reloading the autoloaded constants would inadvertantly cause a
|
191
|
-
connection to the database, which would then prevent tasks like
|
192
|
-
db:create from running (because at that point the database doesn't
|
193
|
-
exist)
|
194
|
-
* Removed ability to specify list of files for a command to preload. We
|
195
|
-
weren't using this any more internally, and this is easy to do by
|
196
|
-
placing requires in suitable locations in the Rails boot process
|
197
|
-
(which is not explained in the README).
|
198
|
-
* Seed the random number generator on each run.
|
199
|
-
|
200
|
-
## 0.0.9
|
201
|
-
|
202
|
-
* Added `Spring::Commands::Rake.environment_matchers` for matching
|
203
|
-
rake tasks to specific environments.
|
204
|
-
* Kill the spring server when the `Gemfile` or `Gemfile.lock` is
|
205
|
-
changed. This forces a new server to boot up on the next run, which
|
206
|
-
ensures that you get the correct gems (or the correct error message from
|
207
|
-
bundler if you have forgotten to `bundle install`.)
|
208
|
-
* Fixed error when `Spring.watch` is used in `config/spring.rb`
|
209
|
-
|
210
|
-
## 0.0.8
|
211
|
-
|
212
|
-
* Renamed `spring test` to `spring testunit`.
|
213
|
-
* Implemented `spring rails` to replace `spring
|
214
|
-
[console|runner|generate]`.
|
215
|
-
* `config/spring.rb` is only loaded in the server process, so you can
|
216
|
-
require stuff from other gems there without performance implications.
|
217
|
-
* File watcher no longer pays attention to files outside of your
|
218
|
-
application root directory.
|
219
|
-
* You can use the `listen` gem for less CPU intensive file watching. See
|
220
|
-
README.
|
data/CONTRIBUTING.md
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
# Don't use the issue tracker to ask questions
|
2
|
-
|
3
|
-
Please use Stack Overflow or similar. If you subsequently feel that the
|
4
|
-
documentation is inadequate then plase submit a pull request to fix it.
|
5
|
-
|
6
|
-
# Contributing guide
|
7
|
-
|
8
|
-
## Getting set up
|
9
|
-
|
10
|
-
Check out the code and run `bundle install` as usual.
|
11
|
-
|
12
|
-
## Running tests
|
13
|
-
|
14
|
-
Running `rake` will run all tests. There are both unit tests and
|
15
|
-
acceptance tests. You can run them individually with `rake test:unit` or
|
16
|
-
`rake test:acceptance`.
|
17
|
-
|
18
|
-
If one doesn't already exist, the acceptance tests will generate a dummy
|
19
|
-
Rails app in `test/apps/`. On each test run, the dummy app is copied to
|
20
|
-
`test/apps/tmp/` so that any changes won't affect the pre-generated app
|
21
|
-
(this saves us having to regenerate the app on each run).
|
22
|
-
|
23
|
-
If tests are failing and you don't know why, it might be that the
|
24
|
-
pre-generated app has become inconsistent in some way. In that case the
|
25
|
-
best solution is to purge it with `rm -rf test/apps/*` and then run the
|
26
|
-
acceptance tests again, which will generate a new app.
|
27
|
-
|
28
|
-
## Testing different Rails versions
|
29
|
-
|
30
|
-
You can set the `RAILS_VERSION` environment variable:
|
31
|
-
|
32
|
-
```
|
33
|
-
$ RAILS_VERSION="~> 3.2.0" rake test:acceptance
|
34
|
-
```
|
35
|
-
|
36
|
-
The apps in `test/apps` will be named based on the rails version and the
|
37
|
-
spring version.
|
38
|
-
|
39
|
-
## Testing with your app
|
40
|
-
|
41
|
-
You cannot link to a git repo from your Gemfile. Spring doesn't support
|
42
|
-
this due to the way that it gets loaded (bypassing bundler for
|
43
|
-
performance reasons).
|
44
|
-
|
45
|
-
Therefore, to test changes with your app, run `rake install` to properly
|
46
|
-
install the gem on your system.
|
47
|
-
|
48
|
-
## Submitting a pull request
|
49
|
-
|
50
|
-
If your change is a bugfix or feature, please make sure you add to
|
51
|
-
`CHANGELOG.md` under the "Next Release" heading (add the heading if
|
52
|
-
needed).
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
namespace :test do
|
5
|
-
Rake::TestTask.new(:unit) do |t|
|
6
|
-
t.libs << "test"
|
7
|
-
t.test_files = FileList["test/unit/**/*_test.rb"]
|
8
|
-
t.verbose = true
|
9
|
-
end
|
10
|
-
|
11
|
-
Rake::TestTask.new(:acceptance) do |t|
|
12
|
-
t.libs << "test"
|
13
|
-
t.test_files = FileList["test/acceptance_test.rb"]
|
14
|
-
t.verbose = true
|
15
|
-
end
|
16
|
-
|
17
|
-
desc 'run all tests'
|
18
|
-
task all: [:unit, :acceptance]
|
19
|
-
end
|
20
|
-
|
21
|
-
task default: 'test:all'
|
data/spring.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'spring/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "spring"
|
8
|
-
gem.version = Spring::VERSION
|
9
|
-
gem.authors = ["Jon Leighton"]
|
10
|
-
gem.email = ["j@jonathanleighton.com"]
|
11
|
-
gem.description = %q{Rails application preloader}
|
12
|
-
gem.summary = %q{Rails application preloader}
|
13
|
-
gem.homepage = "http://github.com/rails/spring"
|
14
|
-
gem.license = "MIT"
|
15
|
-
|
16
|
-
gem.files = `git ls-files`.split($/)
|
17
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
-
gem.require_paths = ["lib"]
|
20
|
-
|
21
|
-
gem.add_development_dependency 'activesupport', '~> 4.2.0'
|
22
|
-
gem.add_development_dependency 'rake'
|
23
|
-
end
|
data/test/acceptance_test.rb
DELETED
data/test/apps/.gitignore
DELETED
data/test/helper.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
require "spring/client/command"
|
4
|
-
require 'spring/client/help'
|
5
|
-
require 'spring/client'
|
6
|
-
|
7
|
-
class HelpTest < ActiveSupport::TestCase
|
8
|
-
def spring_commands
|
9
|
-
{
|
10
|
-
'command' => Class.new {
|
11
|
-
def self.description
|
12
|
-
'Random Spring Command'
|
13
|
-
end
|
14
|
-
},
|
15
|
-
'rails' => Class.new {
|
16
|
-
def self.description
|
17
|
-
"omg"
|
18
|
-
end
|
19
|
-
}
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
def application_commands
|
24
|
-
{
|
25
|
-
'random' => Class.new {
|
26
|
-
def description
|
27
|
-
'Random Application Command'
|
28
|
-
end
|
29
|
-
}.new,
|
30
|
-
'hidden' => Class.new {
|
31
|
-
def description
|
32
|
-
nil
|
33
|
-
end
|
34
|
-
}.new
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
def setup
|
39
|
-
@help = Spring::Client::Help.new('help', spring_commands, application_commands)
|
40
|
-
end
|
41
|
-
|
42
|
-
test "formatted_help generates expected output" do
|
43
|
-
expected_output = <<-EOF
|
44
|
-
Version: #{Spring::VERSION}
|
45
|
-
|
46
|
-
Usage: spring COMMAND [ARGS]
|
47
|
-
|
48
|
-
Commands for spring itself:
|
49
|
-
|
50
|
-
command Random Spring Command
|
51
|
-
|
52
|
-
Commands for your application:
|
53
|
-
|
54
|
-
rails omg
|
55
|
-
random Random Application Command
|
56
|
-
EOF
|
57
|
-
|
58
|
-
assert_equal expected_output.chomp, @help.formatted_help
|
59
|
-
end
|
60
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'spring/client'
|
3
|
-
|
4
|
-
class VersionTest < ActiveSupport::TestCase
|
5
|
-
test "outputs current version number" do
|
6
|
-
version = Spring::Client::Version.new 'version'
|
7
|
-
|
8
|
-
out, err = capture_io do
|
9
|
-
version.call
|
10
|
-
end
|
11
|
-
|
12
|
-
assert_equal "Spring version #{Spring::VERSION}", out.chomp
|
13
|
-
end
|
14
|
-
end
|
data/test/unit/commands_test.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
require "spring/commands"
|
3
|
-
|
4
|
-
class CommandsTest < ActiveSupport::TestCase
|
5
|
-
test 'console command sets rails environment from command-line option' do
|
6
|
-
command = Spring::Commands::RailsConsole.new
|
7
|
-
assert_equal 'test', command.env(['test'])
|
8
|
-
end
|
9
|
-
|
10
|
-
test 'console command sets rails environment from -e option' do
|
11
|
-
command = Spring::Commands::RailsConsole.new
|
12
|
-
assert_equal 'test', command.env(['-e', 'test'])
|
13
|
-
end
|
14
|
-
|
15
|
-
test 'console command sets rails environment from --environment option' do
|
16
|
-
command = Spring::Commands::RailsConsole.new
|
17
|
-
assert_equal 'test', command.env(['--environment=test'])
|
18
|
-
end
|
19
|
-
|
20
|
-
test 'console command ignores first argument if it is a flag except -e and --environment' do
|
21
|
-
command = Spring::Commands::RailsConsole.new
|
22
|
-
assert_nil command.env(['--sandbox'])
|
23
|
-
end
|
24
|
-
|
25
|
-
test 'Runner#env sets rails environment from command-line option' do
|
26
|
-
command = Spring::Commands::RailsRunner.new
|
27
|
-
assert_equal 'test', command.env(['-e', 'test', 'puts 1+1'])
|
28
|
-
end
|
29
|
-
|
30
|
-
test 'RailsRunner#env sets rails environment from long form of command-line option' do
|
31
|
-
command = Spring::Commands::RailsRunner.new
|
32
|
-
assert_equal 'test', command.env(['--environment=test', 'puts 1+1'])
|
33
|
-
end
|
34
|
-
|
35
|
-
test 'RailsRunner#env ignores insignificant arguments' do
|
36
|
-
command = Spring::Commands::RailsRunner.new
|
37
|
-
assert_nil command.env(['puts 1+1'])
|
38
|
-
end
|
39
|
-
|
40
|
-
test 'RailsRunner#extract_environment removes -e <env>' do
|
41
|
-
command = Spring::Commands::RailsRunner.new
|
42
|
-
args = ['-b', '-a', '-e', 'test', '-r']
|
43
|
-
assert_equal [['-b', '-a', '-r'], 'test'], command.extract_environment(args)
|
44
|
-
end
|
45
|
-
|
46
|
-
test 'RailsRunner#extract_environment removes --environment=<env>' do
|
47
|
-
command = Spring::Commands::RailsRunner.new
|
48
|
-
args = ['-b', '--environment=test', '-a', '-r']
|
49
|
-
assert_equal [['-b', '-a', '-r'], 'test'], command.extract_environment(args)
|
50
|
-
end
|
51
|
-
|
52
|
-
test "rake command has configurable environments" do
|
53
|
-
command = Spring::Commands::Rake.new
|
54
|
-
assert_nil command.env(["foo"])
|
55
|
-
assert_equal "test", command.env(["test"])
|
56
|
-
assert_equal "test", command.env(["test:models"])
|
57
|
-
assert_nil command.env(["test_foo"])
|
58
|
-
end
|
59
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
require "spring/process_title_updater"
|
3
|
-
require "active_support/time"
|
4
|
-
|
5
|
-
class ProcessTitleUpdaterTest < ActiveSupport::TestCase
|
6
|
-
setup do
|
7
|
-
@start = Time.local(2012, 2, 12, 4, 3, 12)
|
8
|
-
@updater = Spring::ProcessTitleUpdater.new(@start) { }
|
9
|
-
end
|
10
|
-
|
11
|
-
test "seconds" do
|
12
|
-
assert_equal "1 sec", @updater.distance_in_words(@start + 1.second)
|
13
|
-
assert_equal "2 secs", @updater.distance_in_words(@start + 2.seconds)
|
14
|
-
end
|
15
|
-
|
16
|
-
test "minutes" do
|
17
|
-
assert_equal "1 min", @updater.distance_in_words(@start + 1.minute + 10.seconds)
|
18
|
-
assert_equal "5 mins", @updater.distance_in_words(@start + 5.minutes + 10.seconds)
|
19
|
-
end
|
20
|
-
|
21
|
-
test "hours" do
|
22
|
-
assert_equal "6 hours", @updater.distance_in_words(@start + 6.hours + 50.minutes)
|
23
|
-
end
|
24
|
-
end
|