spring 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +29 -0
  5. data/Rakefile +10 -0
  6. data/bin/spring +5 -0
  7. data/lib/spring.rb +98 -0
  8. data/lib/spring/application.rb +109 -0
  9. data/lib/spring/application_manager.rb +79 -0
  10. data/lib/spring/application_watcher.rb +40 -0
  11. data/lib/spring/commands.rb +97 -0
  12. data/lib/spring/env.rb +30 -0
  13. data/lib/spring/server.rb +59 -0
  14. data/lib/spring/sid.rb +19 -0
  15. data/lib/spring/version.rb +3 -0
  16. data/spring.gemspec +21 -0
  17. data/test/acceptance/app_test.rb +198 -0
  18. data/test/apps/rails-3-2/.gitignore +15 -0
  19. data/test/apps/rails-3-2/Gemfile +5 -0
  20. data/test/apps/rails-3-2/README.rdoc +261 -0
  21. data/test/apps/rails-3-2/Rakefile +7 -0
  22. data/test/apps/rails-3-2/app/assets/images/rails.png +0 -0
  23. data/test/apps/rails-3-2/app/assets/javascripts/application.js +15 -0
  24. data/test/apps/rails-3-2/app/assets/javascripts/posts.js.coffee +3 -0
  25. data/test/apps/rails-3-2/app/assets/stylesheets/application.css +13 -0
  26. data/test/apps/rails-3-2/app/assets/stylesheets/posts.css.scss +3 -0
  27. data/test/apps/rails-3-2/app/assets/stylesheets/scaffolds.css.scss +69 -0
  28. data/test/apps/rails-3-2/app/controllers/application_controller.rb +3 -0
  29. data/test/apps/rails-3-2/app/controllers/posts_controller.rb +83 -0
  30. data/test/apps/rails-3-2/app/helpers/application_helper.rb +2 -0
  31. data/test/apps/rails-3-2/app/helpers/posts_helper.rb +2 -0
  32. data/test/apps/rails-3-2/app/mailers/.gitkeep +0 -0
  33. data/test/apps/rails-3-2/app/models/.gitkeep +0 -0
  34. data/test/apps/rails-3-2/app/models/post.rb +3 -0
  35. data/test/apps/rails-3-2/app/views/layouts/application.html.erb +14 -0
  36. data/test/apps/rails-3-2/app/views/posts/_form.html.erb +21 -0
  37. data/test/apps/rails-3-2/app/views/posts/edit.html.erb +6 -0
  38. data/test/apps/rails-3-2/app/views/posts/index.html.erb +23 -0
  39. data/test/apps/rails-3-2/app/views/posts/new.html.erb +5 -0
  40. data/test/apps/rails-3-2/app/views/posts/show.html.erb +10 -0
  41. data/test/apps/rails-3-2/config.ru +4 -0
  42. data/test/apps/rails-3-2/config/application.rb +62 -0
  43. data/test/apps/rails-3-2/config/boot.rb +6 -0
  44. data/test/apps/rails-3-2/config/database.yml +25 -0
  45. data/test/apps/rails-3-2/config/environment.rb +5 -0
  46. data/test/apps/rails-3-2/config/environments/development.rb +37 -0
  47. data/test/apps/rails-3-2/config/environments/production.rb +67 -0
  48. data/test/apps/rails-3-2/config/environments/test.rb +37 -0
  49. data/test/apps/rails-3-2/config/initializers/backtrace_silencers.rb +7 -0
  50. data/test/apps/rails-3-2/config/initializers/inflections.rb +15 -0
  51. data/test/apps/rails-3-2/config/initializers/mime_types.rb +5 -0
  52. data/test/apps/rails-3-2/config/initializers/secret_token.rb +7 -0
  53. data/test/apps/rails-3-2/config/initializers/session_store.rb +8 -0
  54. data/test/apps/rails-3-2/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/apps/rails-3-2/config/locales/en.yml +5 -0
  56. data/test/apps/rails-3-2/config/routes.rb +60 -0
  57. data/test/apps/rails-3-2/db/migrate/20121109171227_create_posts.rb +9 -0
  58. data/test/apps/rails-3-2/db/schema.rb +22 -0
  59. data/test/apps/rails-3-2/db/seeds.rb +7 -0
  60. data/test/apps/rails-3-2/lib/assets/.gitkeep +0 -0
  61. data/test/apps/rails-3-2/lib/tasks/.gitkeep +0 -0
  62. data/test/apps/rails-3-2/log/.gitkeep +0 -0
  63. data/test/apps/rails-3-2/public/404.html +26 -0
  64. data/test/apps/rails-3-2/public/422.html +26 -0
  65. data/test/apps/rails-3-2/public/500.html +25 -0
  66. data/test/apps/rails-3-2/public/favicon.ico +0 -0
  67. data/test/apps/rails-3-2/public/index.html +241 -0
  68. data/test/apps/rails-3-2/public/robots.txt +5 -0
  69. data/test/apps/rails-3-2/script/rails +6 -0
  70. data/test/apps/rails-3-2/test/fixtures/.gitkeep +0 -0
  71. data/test/apps/rails-3-2/test/fixtures/posts.yml +7 -0
  72. data/test/apps/rails-3-2/test/functional/.gitkeep +0 -0
  73. data/test/apps/rails-3-2/test/functional/posts_controller_test.rb +49 -0
  74. data/test/apps/rails-3-2/test/integration/.gitkeep +0 -0
  75. data/test/apps/rails-3-2/test/performance/browsing_test.rb +12 -0
  76. data/test/apps/rails-3-2/test/test_helper.rb +13 -0
  77. data/test/apps/rails-3-2/test/unit/.gitkeep +0 -0
  78. data/test/apps/rails-3-2/test/unit/helpers/posts_helper_test.rb +4 -0
  79. data/test/apps/rails-3-2/test/unit/post_test.rb +7 -0
  80. data/test/apps/rails-3-2/vendor/assets/javascripts/.gitkeep +0 -0
  81. data/test/apps/rails-3-2/vendor/assets/stylesheets/.gitkeep +0 -0
  82. data/test/apps/rails-3-2/vendor/plugins/.gitkeep +0 -0
  83. data/test/helper.rb +8 -0
  84. data/test/unit/application_watcher_test.rb +54 -0
  85. metadata +215 -0
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ title: MyString
5
+
6
+ two:
7
+ title: MyString
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class PostsControllerTest < ActionController::TestCase
4
+ setup do
5
+ @post = posts(:one)
6
+ end
7
+
8
+ test "should get index" do
9
+ get :index
10
+ assert_response :success
11
+ assert_not_nil assigns(:posts)
12
+ end
13
+
14
+ test "should get new" do
15
+ get :new
16
+ assert_response :success
17
+ end
18
+
19
+ test "should create post" do
20
+ assert_difference('Post.count') do
21
+ post :create, post: { title: @post.title }
22
+ end
23
+
24
+ assert_redirected_to post_path(assigns(:post))
25
+ end
26
+
27
+ test "should show post" do
28
+ get :show, id: @post
29
+ assert_response :success
30
+ end
31
+
32
+ test "should get edit" do
33
+ get :edit, id: @post
34
+ assert_response :success
35
+ end
36
+
37
+ test "should update post" do
38
+ put :update, id: @post, post: { title: @post.title }
39
+ assert_redirected_to post_path(assigns(:post))
40
+ end
41
+
42
+ test "should destroy post" do
43
+ assert_difference('Post.count', -1) do
44
+ delete :destroy, id: @post
45
+ end
46
+
47
+ assert_redirected_to posts_path
48
+ end
49
+ end
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+ require 'rails/performance_test_help'
3
+
4
+ class BrowsingTest < ActionDispatch::PerformanceTest
5
+ # Refer to the documentation for all available options
6
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
7
+ # :output => 'tmp/performance', :formats => [:flat] }
8
+
9
+ def test_homepage
10
+ get '/'
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
+ #
8
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
+ # -- they do not yet inherit this setting
10
+ fixtures :all
11
+
12
+ # Add more helper methods to be used by all tests here...
13
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class PostsHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
2
+
3
+ require "bundler/setup"
4
+ require "spring"
5
+ require "active_support/test_case"
6
+ require "minitest/autorun"
7
+
8
+ TEST_ROOT = File.expand_path('..', __FILE__)
@@ -0,0 +1,54 @@
1
+ require "helper"
2
+ require "fileutils"
3
+ require "spring/application_watcher"
4
+
5
+ class ApplicationWatcherTest < Test::Unit::TestCase
6
+ def setup
7
+ @dir = "/tmp/spring"
8
+ FileUtils.mkdir(@dir)
9
+ end
10
+
11
+ def teardown
12
+ FileUtils.rm_r(@dir)
13
+ end
14
+
15
+ def touch(file)
16
+ sleep 0.01
17
+ File.write(file, "omg")
18
+ end
19
+
20
+ def test_file_mtime
21
+ file = "#{@dir}/omg"
22
+ touch file
23
+
24
+ watcher = Spring::ApplicationWatcher.new
25
+ watcher.add_files [file]
26
+
27
+ assert !watcher.stale?
28
+
29
+ touch file
30
+ assert watcher.stale?
31
+ end
32
+
33
+ def test_glob
34
+ FileUtils.mkdir("#{@dir}/1")
35
+ FileUtils.mkdir("#{@dir}/2")
36
+
37
+ watcher = Spring::ApplicationWatcher.new
38
+ watcher.add_globs ["#{@dir}/1/*.rb", "#{@dir}/2/*"]
39
+
40
+ assert !watcher.stale?
41
+
42
+ touch "#{@dir}/1/foo"
43
+ assert !watcher.stale?
44
+
45
+ touch "#{@dir}/1/foo.rb"
46
+ assert watcher.stale?
47
+
48
+ watcher.reset
49
+ assert !watcher.stale?
50
+
51
+ touch "#{@dir}/2/foo"
52
+ assert watcher.stale?
53
+ end
54
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spring
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jon Leighton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Rails application preloader
31
+ email:
32
+ - j@jonathanleighton.com
33
+ executables:
34
+ - spring
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - Gemfile
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - bin/spring
44
+ - lib/spring.rb
45
+ - lib/spring/application.rb
46
+ - lib/spring/application_manager.rb
47
+ - lib/spring/application_watcher.rb
48
+ - lib/spring/commands.rb
49
+ - lib/spring/env.rb
50
+ - lib/spring/server.rb
51
+ - lib/spring/sid.rb
52
+ - lib/spring/version.rb
53
+ - spring.gemspec
54
+ - test/acceptance/app_test.rb
55
+ - test/apps/rails-3-2/.gitignore
56
+ - test/apps/rails-3-2/Gemfile
57
+ - test/apps/rails-3-2/README.rdoc
58
+ - test/apps/rails-3-2/Rakefile
59
+ - test/apps/rails-3-2/app/assets/images/rails.png
60
+ - test/apps/rails-3-2/app/assets/javascripts/application.js
61
+ - test/apps/rails-3-2/app/assets/javascripts/posts.js.coffee
62
+ - test/apps/rails-3-2/app/assets/stylesheets/application.css
63
+ - test/apps/rails-3-2/app/assets/stylesheets/posts.css.scss
64
+ - test/apps/rails-3-2/app/assets/stylesheets/scaffolds.css.scss
65
+ - test/apps/rails-3-2/app/controllers/application_controller.rb
66
+ - test/apps/rails-3-2/app/controllers/posts_controller.rb
67
+ - test/apps/rails-3-2/app/helpers/application_helper.rb
68
+ - test/apps/rails-3-2/app/helpers/posts_helper.rb
69
+ - test/apps/rails-3-2/app/mailers/.gitkeep
70
+ - test/apps/rails-3-2/app/models/.gitkeep
71
+ - test/apps/rails-3-2/app/models/post.rb
72
+ - test/apps/rails-3-2/app/views/layouts/application.html.erb
73
+ - test/apps/rails-3-2/app/views/posts/_form.html.erb
74
+ - test/apps/rails-3-2/app/views/posts/edit.html.erb
75
+ - test/apps/rails-3-2/app/views/posts/index.html.erb
76
+ - test/apps/rails-3-2/app/views/posts/new.html.erb
77
+ - test/apps/rails-3-2/app/views/posts/show.html.erb
78
+ - test/apps/rails-3-2/config.ru
79
+ - test/apps/rails-3-2/config/application.rb
80
+ - test/apps/rails-3-2/config/boot.rb
81
+ - test/apps/rails-3-2/config/database.yml
82
+ - test/apps/rails-3-2/config/environment.rb
83
+ - test/apps/rails-3-2/config/environments/development.rb
84
+ - test/apps/rails-3-2/config/environments/production.rb
85
+ - test/apps/rails-3-2/config/environments/test.rb
86
+ - test/apps/rails-3-2/config/initializers/backtrace_silencers.rb
87
+ - test/apps/rails-3-2/config/initializers/inflections.rb
88
+ - test/apps/rails-3-2/config/initializers/mime_types.rb
89
+ - test/apps/rails-3-2/config/initializers/secret_token.rb
90
+ - test/apps/rails-3-2/config/initializers/session_store.rb
91
+ - test/apps/rails-3-2/config/initializers/wrap_parameters.rb
92
+ - test/apps/rails-3-2/config/locales/en.yml
93
+ - test/apps/rails-3-2/config/routes.rb
94
+ - test/apps/rails-3-2/db/migrate/20121109171227_create_posts.rb
95
+ - test/apps/rails-3-2/db/schema.rb
96
+ - test/apps/rails-3-2/db/seeds.rb
97
+ - test/apps/rails-3-2/lib/assets/.gitkeep
98
+ - test/apps/rails-3-2/lib/tasks/.gitkeep
99
+ - test/apps/rails-3-2/log/.gitkeep
100
+ - test/apps/rails-3-2/public/404.html
101
+ - test/apps/rails-3-2/public/422.html
102
+ - test/apps/rails-3-2/public/500.html
103
+ - test/apps/rails-3-2/public/favicon.ico
104
+ - test/apps/rails-3-2/public/index.html
105
+ - test/apps/rails-3-2/public/robots.txt
106
+ - test/apps/rails-3-2/script/rails
107
+ - test/apps/rails-3-2/test/fixtures/.gitkeep
108
+ - test/apps/rails-3-2/test/fixtures/posts.yml
109
+ - test/apps/rails-3-2/test/functional/.gitkeep
110
+ - test/apps/rails-3-2/test/functional/posts_controller_test.rb
111
+ - test/apps/rails-3-2/test/integration/.gitkeep
112
+ - test/apps/rails-3-2/test/performance/browsing_test.rb
113
+ - test/apps/rails-3-2/test/test_helper.rb
114
+ - test/apps/rails-3-2/test/unit/.gitkeep
115
+ - test/apps/rails-3-2/test/unit/helpers/posts_helper_test.rb
116
+ - test/apps/rails-3-2/test/unit/post_test.rb
117
+ - test/apps/rails-3-2/vendor/assets/javascripts/.gitkeep
118
+ - test/apps/rails-3-2/vendor/assets/stylesheets/.gitkeep
119
+ - test/apps/rails-3-2/vendor/plugins/.gitkeep
120
+ - test/helper.rb
121
+ - test/unit/application_watcher_test.rb
122
+ homepage: http://github.com/jonleighton/spring
123
+ licenses: []
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 1.8.24
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: Rails application preloader
146
+ test_files:
147
+ - test/acceptance/app_test.rb
148
+ - test/apps/rails-3-2/.gitignore
149
+ - test/apps/rails-3-2/Gemfile
150
+ - test/apps/rails-3-2/README.rdoc
151
+ - test/apps/rails-3-2/Rakefile
152
+ - test/apps/rails-3-2/app/assets/images/rails.png
153
+ - test/apps/rails-3-2/app/assets/javascripts/application.js
154
+ - test/apps/rails-3-2/app/assets/javascripts/posts.js.coffee
155
+ - test/apps/rails-3-2/app/assets/stylesheets/application.css
156
+ - test/apps/rails-3-2/app/assets/stylesheets/posts.css.scss
157
+ - test/apps/rails-3-2/app/assets/stylesheets/scaffolds.css.scss
158
+ - test/apps/rails-3-2/app/controllers/application_controller.rb
159
+ - test/apps/rails-3-2/app/controllers/posts_controller.rb
160
+ - test/apps/rails-3-2/app/helpers/application_helper.rb
161
+ - test/apps/rails-3-2/app/helpers/posts_helper.rb
162
+ - test/apps/rails-3-2/app/mailers/.gitkeep
163
+ - test/apps/rails-3-2/app/models/.gitkeep
164
+ - test/apps/rails-3-2/app/models/post.rb
165
+ - test/apps/rails-3-2/app/views/layouts/application.html.erb
166
+ - test/apps/rails-3-2/app/views/posts/_form.html.erb
167
+ - test/apps/rails-3-2/app/views/posts/edit.html.erb
168
+ - test/apps/rails-3-2/app/views/posts/index.html.erb
169
+ - test/apps/rails-3-2/app/views/posts/new.html.erb
170
+ - test/apps/rails-3-2/app/views/posts/show.html.erb
171
+ - test/apps/rails-3-2/config.ru
172
+ - test/apps/rails-3-2/config/application.rb
173
+ - test/apps/rails-3-2/config/boot.rb
174
+ - test/apps/rails-3-2/config/database.yml
175
+ - test/apps/rails-3-2/config/environment.rb
176
+ - test/apps/rails-3-2/config/environments/development.rb
177
+ - test/apps/rails-3-2/config/environments/production.rb
178
+ - test/apps/rails-3-2/config/environments/test.rb
179
+ - test/apps/rails-3-2/config/initializers/backtrace_silencers.rb
180
+ - test/apps/rails-3-2/config/initializers/inflections.rb
181
+ - test/apps/rails-3-2/config/initializers/mime_types.rb
182
+ - test/apps/rails-3-2/config/initializers/secret_token.rb
183
+ - test/apps/rails-3-2/config/initializers/session_store.rb
184
+ - test/apps/rails-3-2/config/initializers/wrap_parameters.rb
185
+ - test/apps/rails-3-2/config/locales/en.yml
186
+ - test/apps/rails-3-2/config/routes.rb
187
+ - test/apps/rails-3-2/db/migrate/20121109171227_create_posts.rb
188
+ - test/apps/rails-3-2/db/schema.rb
189
+ - test/apps/rails-3-2/db/seeds.rb
190
+ - test/apps/rails-3-2/lib/assets/.gitkeep
191
+ - test/apps/rails-3-2/lib/tasks/.gitkeep
192
+ - test/apps/rails-3-2/log/.gitkeep
193
+ - test/apps/rails-3-2/public/404.html
194
+ - test/apps/rails-3-2/public/422.html
195
+ - test/apps/rails-3-2/public/500.html
196
+ - test/apps/rails-3-2/public/favicon.ico
197
+ - test/apps/rails-3-2/public/index.html
198
+ - test/apps/rails-3-2/public/robots.txt
199
+ - test/apps/rails-3-2/script/rails
200
+ - test/apps/rails-3-2/test/fixtures/.gitkeep
201
+ - test/apps/rails-3-2/test/fixtures/posts.yml
202
+ - test/apps/rails-3-2/test/functional/.gitkeep
203
+ - test/apps/rails-3-2/test/functional/posts_controller_test.rb
204
+ - test/apps/rails-3-2/test/integration/.gitkeep
205
+ - test/apps/rails-3-2/test/performance/browsing_test.rb
206
+ - test/apps/rails-3-2/test/test_helper.rb
207
+ - test/apps/rails-3-2/test/unit/.gitkeep
208
+ - test/apps/rails-3-2/test/unit/helpers/posts_helper_test.rb
209
+ - test/apps/rails-3-2/test/unit/post_test.rb
210
+ - test/apps/rails-3-2/vendor/assets/javascripts/.gitkeep
211
+ - test/apps/rails-3-2/vendor/assets/stylesheets/.gitkeep
212
+ - test/apps/rails-3-2/vendor/plugins/.gitkeep
213
+ - test/helper.rb
214
+ - test/unit/application_watcher_test.rb
215
+ has_rdoc: