Add Spring and spring-aware binstubs

Also remove /script, which is no longer used in Rails 4
This commit is contained in:
Dan Rice 2014-05-16 11:02:08 -04:00
parent 782d94bdc9
commit 7d7e47deff
15 changed files with 59 additions and 25 deletions

1
.gitignore vendored
View file

@ -11,7 +11,6 @@
/.bundle
/.emacs-project
/.redcar
/bin
/coverage
/db/*.db
/db/*.sqlite3

View file

@ -16,7 +16,7 @@ before_install:
- "cp config/site.yml.tmpl config/site.yml"
- "cp config/database.yml.tmpl config/database.yml"
script: "CODECLIMATE_REPO_TOKEN=5c52fdd2bbcd0734d56ddb2c3cbaac782da345273e8689d25f54a065ccc3397c bundle exec rake ci RACK_ENV=test"
script: "CODECLIMATE_REPO_TOKEN=5c52fdd2bbcd0734d56ddb2c3cbaac782da345273e8689d25f54a065ccc3397c bin/rake ci RACK_ENV=test"
notifications:
email: false

View file

@ -42,6 +42,8 @@ gem 'bcrypt-ruby', '~> 3.0.0'
# gem 'jbuilder', '~> 1.2'
group :development do
gem "spring"
gem "spring-commands-cucumber"
gem "yard"
gem 'tolk', '>=1.5.0'
gem "bullet"

View file

@ -167,6 +167,9 @@ GEM
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
spring (1.1.3)
spring-commands-cucumber (1.0.1)
spring (>= 0.9.1)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
@ -235,6 +238,8 @@ DEPENDENCIES
sass-rails (~> 4.0)
selenium-webdriver
simplecov
spring
spring-commands-cucumber
sqlite3
swf_fu
therubyracer

View file

@ -105,7 +105,7 @@
"<%= Preference.human_attribute_name('sms_context') %>" for todos sent in
via email (which could come from an SMS message)</li>
<li>In sendmail/qmail/postfix/whatever, set up an email address
alias to pipe messages to <pre>/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
alias to pipe messages to <pre>/PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
<li>Send an email to your newly configured address!</li>
</ul>
<p>You can also use the Rich Todo API to send in tasks like "do laundry @ Home"
@ -116,7 +116,7 @@
You may need to configure your <tt>site.yml</tt> to tell the message gateway to look at the <tt>to:</tt> field or <tt>from:</tt> field to
lookup Tracks' user from the email address in that field. </p>
<p>You can also send all email to a specific Tracks user. Configure mail_dispatch in site.yml to <tt>single_user</tt> and pass the login of the user:
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> /PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
</p>
<a name="google_gadget"> </a>

View file

@ -107,7 +107,7 @@
"<%= Preference.human_attribute_name('sms_context') %>" for todos sent in
via email (which could come from an SMS message)</li>
<li>In sendmail/qmail/postfix/whatever, set up an email address
alias to pipe messages to <pre>/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
alias to pipe messages to <pre>/PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
<li>Send an email to your newly configured address!</li>
</ul>
<p>You can also use the Rich Todo API to send in tasks like "do laundry @ Home"
@ -118,7 +118,7 @@
You may need to configure your <tt>site.yml</tt> to tell the message gateway to look at the <tt>to:</tt> field or <tt>from:</tt> field to
lookup Tracks' user from the email address in that field. </p>
<p>You can also send all email to a specific Tracks user. Configure mail_dispatch in site.yml to <tt>single_user</tt> and pass the login of the user:
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> /PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
</p>
<a name="mailgun"> </a>

View file

@ -109,7 +109,7 @@
verzonden zijn via email (die bijv. komen via een SMS message)</li>
<li>In sendmail/qmail/postfix/whatever, stel een email address
alias in om berichten door te sturen naar
<pre>/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
<pre>/PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
<li>Verstuur een email naar het net geconfigureerde e-mail adres!</li>
</ul>
<p>Je kan ook de Rich Todo API gebruiken om acties te maken zoals "do laundry @ Home"
@ -120,7 +120,7 @@
Het kan nodig zijn om jouw <tt>site.yml</tt> te configureren om de message gateway te laten kijken naar het <tt>to:</tt> veld of het <tt>from:</tt> veld om
de Tracks-gebruiker op te zoeken met het emailadres uit dat veld. </p>
<p>Je kan ook alle email naar een specifieke Tracks gebruiker sturen. Stel mail_dispatch in site.yml in op <tt>single_user</tt> en geeft de login van de gebruiker door:
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> /PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
</p>
<a name="google_gadget"> </a>

7
bin/cucumber Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('cucumber', 'cucumber')

View file

@ -1,4 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)

7
bin/rake Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('rake', 'rake')

18
bin/spring Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast
# It gets overwritten when you run the `spring binstub` command
unless defined?(Spring)
require "rubygems"
require "bundler"
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = ""
Gem.paths = ENV
gem "spring", match[1]
require "spring/binstub"
end
end

View file

@ -16,6 +16,8 @@
== Version 2.3devel
New and changed features
* Added new binstubs. The commands `bin/rails` and `bin/rake` take the place of
the old `bundle exec rails` and `bundle exec rake`, respectively.
* You can select to group todos on the home page by context or by
project (using the view menu). This also works for tag page, the project page,
the tickler and the context page

View file

@ -60,7 +60,7 @@ h2. Configure variables
# In the @config@ folder, copy the files @database.yml.tmpl@ and @site.yml.tmpl@ to @database.yml@ and @site.yml@, respectively.
# Open the file @config/database.yml@ and edit the @production:@ section with the details of your database. If you are using MySQL the @adapter:@ line should read @adapter: mysql2@, @host: localhost@ (in the majority of cases), and your username and password should match those you assigned when you created the database. If you are using SQLite3, you should have only two lines under the production section: @adapter: sqlite3@ and @database: db/tracks.db@.
# Open the file @config/site.yml@, and read through the settings to make sure that they suit your setup. In most cases, all you need to change are the @salt: "change-me"@ line (change the string "change-me" to some other string of your choice), the administrator email address (@admin_email@), and the time zone setting. For the time zone setting you can use the command @bundle exec rake time:zones:local@ to see all available timezones on your machine
# Open the file @config/site.yml@, and read through the settings to make sure that they suit your setup. In most cases, all you need to change are the @salt: "change-me"@ line (change the string "change-me" to some other string of your choice), the administrator email address (@admin_email@), and the time zone setting. For the time zone setting you can use the command @bin/rake time:zones:local@ to see all available timezones on your machine
# If you are using Windows, you may need to check the 'shebang' lines (@#!/usr/bin/env ruby@) of the @/public/dispatch.*@ files and all the files in the @/script@ directory. They are set to @#!/usr/bin/env ruby@ by default. This should work for all Unix based setups (Linux or Mac OS X), but Windows users will probably have to change it to something like @#c:/ruby/bin/ruby@ to point to the Ruby binary on your system.
# If you intend to deploy Tracks with the built in webserver called WEBrick, you'll need to change @config.serve_static_assets@ to @true@ in @config/environments/production.rb@ in order for the images, stylesheets, and javascript files to be served correctly.
@ -69,7 +69,7 @@ h2. Populate your database with the Tracks schema
Open a terminal and change into the root of your Tracks directory. Enter the following command:
bc. bundle exec rake db:migrate RAILS_ENV=production
bc. bin/rake db:migrate RAILS_ENV=production
This will set up your database with the required structure to hold Tracks' data.
@ -78,14 +78,14 @@ h2. Precompile assets
Static assets (images, stylesheets, and javascript) need to be compiled in order for them to work correctly with the new asset pipeline feature in Rails. Precompiling your assets is as simple as running the following command while inside the Tracks root directory:
bc. bundle exec rake assets:precompile
bc. bin/rake assets:precompile
h2. Start the server
While still in the Terminal inside the Tracks root directory, issue the following command:
bc. bundle exec rails server -e production
bc. bin/rails server -e production
If all goes well, you should see some text informing you that the WEBrick server is running: @=> Rails application starting in production on http://0.0.0.0:3000@. If you are already running other services on port 3000, you need to select a different port when running the server, using the @-p@ option.

View file

@ -9,9 +9,9 @@ That said. To upgrade:
# Install Tracks 2.3devel in a new directory. Or you can create a separate installation of 2.3 for testing purposes.
# Copy over the configuration from your previous Tracks installation. If using SQLite3, copy the old database into the new Tracks 2.3devel directory.
# Check that you have all dependencies installed: @bundle install --without development test@ Or leave out the @--without development test@ part if you intent to test or develop on this tree.
# Run @bundle exec rake db:migrate RAILS_ENV=production@ to update your old database to the new schema. This is the point of no return. Make sure you have backups!
# Precompile your static assets (css, javascript, etc.) by running @bundle exec rake assets:precompile@.
# Run @bundle exec rails server -e production@ inside your Tracks 2.3devel directory to start up Tracks. Or use @-e development@ if you intent to try your changes and get more log info.
# Run @bin/rake db:migrate RAILS_ENV=production@ to update your old database to the new schema. This is the point of no return. Make sure you have backups!
# Precompile your static assets (css, javascript, etc.) by running @bin/rake assets:precompile@.
# Run @bin/rails server -e production@ inside your Tracks 2.3devel directory to start up Tracks. Or use @-e development@ if you intent to try your changes and get more log info.
Please note that if you intend to use Tracks with the built in webserver called WEBrick for production, you'll need to change @config.serve_static_assets@ to @true@ in @config/environments/production.rb@ in order for the images, stylesheets, and javascript files to be served correctly.

View file

@ -1,10 +0,0 @@
#!/usr/bin/env ruby
vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
if vendored_cucumber_bin
load File.expand_path(vendored_cucumber_bin)
else
require 'rubygems' unless ENV['NO_RUBYGEMS']
require 'cucumber'
load Cucumber::BINARY
end