Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #292 from 37signals/rvm-deprecation

Deprecate automatic RVM support
commit 3e62babd559430baa21aac8a36072c2c0a7d5aa0 2 parents b7ea07d + e789bcd
@sstephenson sstephenson authored
View
1  Cakefile
@@ -29,6 +29,7 @@ buildTemplates = (callback) ->
compile("http_server/layout.html")
compile("http_server/proxy_error.html")
compile("http_server/rackup_file_missing.html")
+ compile("http_server/rvm_deprecation_notice.html")
compile("http_server/welcome.html")
compile("installer/cx.pow.firewall.plist")
compile("installer/cx.pow.powd.plist")
View
66 MANUAL.md
@@ -186,20 +186,64 @@ loaded first.
### Working With Different Versions of Ruby ###
-Pow offers full support for running multiple applications under
-different versions of Ruby with
-[rvm](http://rvm.beginrescueend.com/). Just add a [project
-`.rvmrc`](http://rvm.beginrescueend.com/workflow/rvmrc/#project)
-file to your application's root directory and you're good to go.
+Pow invokes each application's Ruby processes in an isolated
+environment. This design makes it possible to use different Ruby
+runtimes on a per-application basis.
-For example, to instruct Pow to run an application with Ruby 1.9.2,
-use this `.rvmrc` file (assuming you've already installed 1.9.2 with
-`rvm install 1.9.2`):
+There are three ways to specify which version of Ruby to use for a
+particular application.
- rvm 1.9.2
+#### Specifying Ruby Versions with rbenv ####
-If an application has an `.rvmrc` file but rvm isn't installed, Pow
-will ignore the `.rvmrc` file and fall back to your system Ruby.
+You can use [rbenv](https://github.com/sstephenson/rbenv) to specify
+per-application Ruby versions for use with Pow.
+
+The `rbenv local` command lets you set a per-project Ruby version by
+saving an `.rbenv-version` file in the current directory. For example,
+to configure a particular application to run with Ruby 1.9.3-p194,
+change to the application's directory and run:
+
+ $ rbenv local 1.9.3-p194
+
+Assuming you have set up rbenv in your login environment, there is no
+additional configuration necessary to use it with Pow.
+
+For more information, see the [rbenv
+documentation](https://github.com/sstephenson/rbenv#readme).
+
+#### Specifying Ruby Versions with RVM ####
+
+[RVM](http://rvm.io/) is another option for specifying per-application
+Ruby versions for use with Pow.
+
+You can create a [project `.rvmrc`
+file](https://rvm.io/workflow/rvmrc#project) to specify an
+application's Ruby version. For example, to configure your application
+to run with Ruby 1.8.7, add the following to `.rvmrc` in the
+application's root directory:
+
+ rvm 1.8.7
+
+Because RVM works by injecting itself into your shell, you must first
+load it in your application's `.powrc` or `.powenv` file using the
+following code:
+
+ [ ! -f "$rvm_path/scripts/rvm" ] || source "$rvm_path/scripts/rvm"
+ [ ! -f ".rvmrc" ] || source ".rvmrc"
+
+For more information, see the [RVM web site](http://rvm.io/).
+
+#### Specifying Ruby Versions by Setting $PATH ####
+
+You can adjust the `PATH` environment variable in `.powrc` or
+`.powenv` to select Ruby versions on a per-application basis. For
+example, if you have Ruby installed into `/opt/ruby-1.8.7`, you can
+add the following to `.powenv`:
+
+ export PATH="/opt/ruby-1.8.7/bin:$PATH"
+
+When Pow loads your application, it will find and use the first `ruby`
+binary in your `PATH` — in this case `/opt/ruby-1.8.7/bin/ruby`.
### Serving Static Files ###
View
2  build.sh
@@ -9,7 +9,7 @@ DIST="$(pwd)/dist"
cake build
mkdir -p "$ROOT/$VERSION/node_modules"
-cp -R package.json bin lib "$ROOT/$VERSION"
+cp -R package.json bin lib libexec "$ROOT/$VERSION"
cp Cakefile "$ROOT/$VERSION"
cd "$ROOT/$VERSION"
BUNDLE_ONLY=1 npm install --production &>/dev/null
View
11 lib/configuration.js
@@ -74,7 +74,8 @@
this.extDomains = (_ref10 = typeof (_base1 = this.extDomains).split === "function" ? _base1.split(",") : void 0) != null ? _ref10 : this.extDomains;
this.allDomains = this.domains.concat(this.extDomains);
this.allDomains.push(/\d+\.\d+\.\d+\.\d+\.xip\.io$/, /[0-9a-z]{1,7}\.xip\.io$/);
- this.hostRoot = (_ref11 = env.POW_HOST_ROOT) != null ? _ref11 : libraryPath("Application Support", "Pow", "Hosts");
+ this.supportRoot = libraryPath("Application Support", "Pow");
+ this.hostRoot = (_ref11 = env.POW_HOST_ROOT) != null ? _ref11 : path.join(this.supportRoot, "Hosts");
this.logRoot = (_ref12 = env.POW_LOG_ROOT) != null ? _ref12 : libraryPath("Logs", "Pow");
this.rvmPath = (_ref13 = env.POW_RVM_PATH) != null ? _ref13 : path.join(process.env.HOME, ".rvm/scripts/rvm");
this.dnsDomainPattern = compilePattern(this.domains);
@@ -97,6 +98,14 @@
return (_base = this.loggers)[name] || (_base[name] = new Logger(path.join(this.logRoot, name + ".log")));
};
+ Configuration.prototype.disableRvmDeprecationNotices = function() {
+ return fs.writeFile(path.join(this.supportRoot, ".disableRvmDeprecationNotices"), "");
+ };
+
+ Configuration.prototype.enableRvmDeprecationNotices = function() {
+ return fs.unlink(path.join(this.supportRoot, ".disableRvmDeprecationNotices"));
+ };
+
Configuration.prototype.findHostConfiguration = function(host, callback) {
var _this = this;
if (host == null) {
View
38 lib/http_server.js
@@ -71,6 +71,8 @@
this.handleApplicationNotFound = __bind(this.handleApplicationNotFound, this);
+ this.handleRvmDeprecationRequest = __bind(this.handleRvmDeprecationRequest, this);
+
this.handleProxyRequest = __bind(this.handleProxyRequest, this);
this.findRackApplication = __bind(this.findRackApplication, this);
@@ -83,7 +85,7 @@
this.logRequest = __bind(this.logRequest, this);
- HttpServer.__super__.constructor.call(this, [o(this.logRequest), o(this.annotateRequest), o(this.handlePowRequest), o(this.findHostConfiguration), o(this.handleStaticRequest), o(this.findRackApplication), o(this.handleProxyRequest), o(this.handleApplicationRequest), x(this.handleErrorStartingApplication), o(this.handleFaviconRequest), o(this.handleApplicationNotFound), o(this.handleWelcomeRequest), o(this.handleRailsAppWithoutRackupFile), o(this.handleLocationNotFound)]);
+ HttpServer.__super__.constructor.call(this, [o(this.logRequest), o(this.annotateRequest), o(this.handlePowRequest), o(this.findHostConfiguration), o(this.handleStaticRequest), o(this.findRackApplication), o(this.handleProxyRequest), o(this.handleRvmDeprecationRequest), o(this.handleApplicationRequest), x(this.handleErrorStartingApplication), o(this.handleFaviconRequest), o(this.handleApplicationNotFound), o(this.handleWelcomeRequest), o(this.handleRailsAppWithoutRackupFile), o(this.handleLocationNotFound)]);
this.staticHandlers = {};
this.rackApplications = {};
this.requestCount = 0;
@@ -187,7 +189,7 @@
return exists(join(root, "config.ru"), function(rackConfigExists) {
var application, _base, _ref1;
if (rackConfigExists) {
- req.pow.application = (_ref1 = (_base = _this.rackApplications)[root]) != null ? _ref1 : _base[root] = new RackApplication(_this.configuration, root);
+ req.pow.application = (_ref1 = (_base = _this.rackApplications)[root]) != null ? _ref1 : _base[root] = new RackApplication(_this.configuration, root, req.pow.host);
} else if (application = _this.rackApplications[root]) {
delete _this.rackApplications[root];
application.quit();
@@ -230,6 +232,38 @@
return req.pow.resume();
};
+ HttpServer.prototype.handleRvmDeprecationRequest = function(req, res, next) {
+ var action, application, match;
+ if (!(application = req.pow.application)) {
+ return next();
+ }
+ if (match = req.url.match(/^\/__pow__\/rvm_deprecation(.*)/)) {
+ action = match[1];
+ if (!(action === "" || req.method === "POST")) {
+ return next();
+ }
+ switch (action) {
+ case "":
+ true;
+ break;
+ case "/add_to_powrc":
+ application.writeRvmBoilerplate();
+ break;
+ case "/enable":
+ this.configuration.enableRvmDeprecationNotices();
+ break;
+ case "/disable":
+ this.configuration.disableRvmDeprecationNotices();
+ break;
+ default:
+ return next();
+ }
+ return renderResponse(res, 200, "rvm_deprecation_notice");
+ } else {
+ return next();
+ }
+ };
+
HttpServer.prototype.handleApplicationRequest = function(req, res, next) {
var application;
if (application = req.pow.application) {
View
28 lib/rack_application.js
@@ -1,6 +1,7 @@
// Generated by CoffeeScript 1.3.3
(function() {
- var RackApplication, async, basename, bufferLines, exists, fs, join, nack, pause, sourceScriptEnv, _ref, _ref1;
+ var RackApplication, async, basename, bufferLines, exists, fs, join, nack, pause, resolve, sourceScriptEnv, _ref, _ref1,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
async = require("async");
@@ -10,13 +11,14 @@
_ref = require("./util"), bufferLines = _ref.bufferLines, pause = _ref.pause, sourceScriptEnv = _ref.sourceScriptEnv;
- _ref1 = require("path"), join = _ref1.join, exists = _ref1.exists, basename = _ref1.basename;
+ _ref1 = require("path"), join = _ref1.join, exists = _ref1.exists, basename = _ref1.basename, resolve = _ref1.resolve;
module.exports = RackApplication = (function() {
- function RackApplication(configuration, root) {
+ function RackApplication(configuration, root, firstHost) {
this.configuration = configuration;
this.root = root;
+ this.firstHost = firstHost;
this.logger = this.configuration.getLogger(join("apps", basename(this.root)));
this.readyCallbacks = [];
this.quitCallbacks = [];
@@ -96,9 +98,10 @@
var rvm;
if (rvmrcExists) {
return exists(rvm = _this.configuration.rvmPath, function(rvmExists) {
- var before;
+ var before, libexecPath;
if (rvmExists) {
- before = "source '" + rvm + "' > /dev/null";
+ libexecPath = resolve("" + __dirname + "/../libexec");
+ before = ("'" + libexecPath + "/pow_rvm_deprecation_notice' '" + [_this.firstHost] + "'\nsource '" + rvm + "' > /dev/null").trim();
return sourceScriptEnv(script, env, {
before: before
}, callback);
@@ -250,6 +253,21 @@
});
};
+ RackApplication.prototype.writeRvmBoilerplate = function() {
+ var line1, line2, powrc;
+ powrc = join(this.root, ".powrc");
+ line1 = '[ ! -f "$rvm_path/scripts/rvm" ] || source "$rvm_path/scripts/rvm"';
+ line2 = '[ ! -f ".rvmrc" ] || source ".rvmrc"';
+ return fs.readFile(powrc, "utf8", function(err, contents) {
+ var lines, _ref2;
+ lines = (_ref2 = contents != null ? contents.split("\n") : void 0) != null ? _ref2 : [];
+ if (!(__indexOf.call(lines, line1) >= 0 && __indexOf.call(lines, line2) >= 0)) {
+ lines.push(line1, line2, "");
+ return fs.writeFile(powrc, lines.join("\n"));
+ }
+ });
+ };
+
return RackApplication;
})();
View
2  lib/templates/http_server/error_starting_application.html.js
@@ -55,7 +55,7 @@ module.exports = function(__obj) {
__out.push(__sanitize(_this.rest.join("\n")));
__out.push('</div>');
}
- return __out.push('</pre>\n <p>(If your app uses Bundler, check to make sure you have the <a href="http://gembundler.com/">latest version</a>, then run <code>bundle install</code>. If you&rsquo;re using rvm, make sure you have the <a href="https://rvm.beginrescueend.com/rvm/upgrading/">latest version</a> installed and your app is using the right gemset.)</p>\n </section>\n');
+ return __out.push('</pre>\n </section>\n');
});
}));
View
48 lib/templates/http_server/rvm_deprecation_notice.html.js
@@ -0,0 +1,48 @@
+module.exports = function(__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+ };
+ }
+ (function() {
+ (function() {
+
+ __out.push('<!doctype html>\n<html>\n <head>\n <title>Pow: Automatic RVM support is deprecated</title>\n <style type="text/css">\n html {\n background: #fff;\n margin: 0;\n padding: 0;\n }\n\n body {\n margin: 30px auto;\n padding: 15px 35px;\n width: 520px;\n font-family: Lucida Grande;\n }\n\n h1 {\n font-family: Helvetica;\n font-size: 24px;\n }\n\n a {\n color: #03f;\n }\n\n p {\n width: 460px;\n font-size: 13px;\n }\n\n .important {\n background: #ff3;\n }\n\n code {\n font-family: Menlo;\n font-size: 12px;\n }\n </style>\n <script type="text/javascript">\n function addToPowrc(link) {\n perform(link, "add_to_powrc",\n "This code has been added to your application&rsquo;s <code>.powrc</code> file."\n )\n }\n\n function disable(link) {\n perform(link, "disable",\n "You will not see this deprecation notice for other applications. " +\n \'<a href="#" onclick="enable(this); return false">Undo</a>\'\n )\n }\n\n function enable(link) {\n perform(link, "enable")\n }\n\n function perform(link, action, successHTML) {\n if (link.className == "busy") return\n link.className = "busy"\n\n xhr = new XMLHttpRequest()\n xhr.open("POST", "/__pow__/rvm_deprecation/" + action, true)\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) return\n link.className = ""\n\n if (xhr.status == 200) {\n var p = link.parentNode\n var previousInnerHTML = p.previousInnerHTML\n p.previousInnerHTML = p.innerHTML\n p.innerHTML = successHTML || previousInnerHTML\n }\n }\n\n xhr.send()\n }\n </script>\n </head>\n <body>\n <h1>Automatic RVM support is deprecated</h1>\n\n <p>We&rsquo;re showing you this notice because you just accessed\n an application with a per-project <code>.rvmrc</code> file.</p>\n\n <p><span class="important">Support for automatically loading\n per-project <code>.rvmrc</code> files in Pow is deprecated and\n will be removed in the next major release.</span></p>\n\n <p>Ensure your application continues to work with future releases\n of Pow by adding the following code to the\n application&rsquo;s <code>.powrc</code> file:</p>\n\n <pre><code>[ ! -f "$rvm_path/scripts/rvm" ] || source "$rvm_path/scripts/rvm"\n[ ! -f ".rvmrc" ] || source ".rvmrc"</code></pre>\n\n <p><a href="#" onclick="addToPowrc(this); return false">Add this\n code to <code>.powrc</code> for me</a></p>\n\n <p>We won&rsquo;t notify you again for this project.</p>\n\n <p><a href="#" onclick="disable(this); return false">Don&rsquo;t\n notify me about deprecations for any other applications,\n either</a></p>\n\n <p>Thanks for using Pow.</p>\n </body>\n</html>\n');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+}
View
24 libexec/pow_rvm_deprecation_notice
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+HOST="$1"
+RVMRC_PATH="$PWD/.rvmrc"
+SUPPORT_ROOT="$HOME/Library/Application Support/Pow"
+DISABLED_FILE="$SUPPORT_ROOT/.disableRvmDeprecationNotices"
+NOTIFIED_FILE="$SUPPORT_ROOT/.rvmDeprecationNotices"
+
+if [ -z "$HOST" ] || [ -f "$DISABLED_FILE" ]; then
+ exit
+fi
+
+if [ -f "$NOTIFIED_FILE" ] && grep -xF "$RVMRC_PATH" "$NOTIFIED_FILE"; then
+ exit
+fi
+
+for file in .powrc .powenv; do
+ if [ -f "$file" ] && egrep 'source.+rvmrc' "$file"; then
+ exit
+ fi
+done
+
+echo "$RVMRC_PATH" >> "$NOTIFIED_FILE"
+open "http://$HOST/__pow__/rvm_deprecation"
View
18 src/configuration.coffee
@@ -108,17 +108,20 @@ module.exports = class Configuration
# Support *.xip.io top-level domains.
@allDomains.push /\d+\.\d+\.\d+\.\d+\.xip\.io$/, /[0-9a-z]{1,7}\.xip\.io$/
+ # Runtime support files live in `~/Library/Application Support/Pow`.
+ @supportRoot = libraryPath "Application Support", "Pow"
+
# `POW_HOST_ROOT`: path to the directory containing symlinks to
# applications that will be served by Pow. Defaults to
# `~/Library/Application Support/Pow/Hosts`.
- @hostRoot = env.POW_HOST_ROOT ? libraryPath "Application Support", "Pow", "Hosts"
+ @hostRoot = env.POW_HOST_ROOT ? path.join @supportRoot, "Hosts"
# `POW_LOG_ROOT`: path to the directory that Pow will use to store
# its log files. Defaults to `~/Library/Logs/Pow`.
@logRoot = env.POW_LOG_ROOT ? libraryPath "Logs", "Pow"
- # `POW_RVM_PATH`: path to the rvm initialization script. Defaults
- # to `~/.rvm/scripts/rvm`.
+ # `POW_RVM_PATH` (**deprecated**): path to the rvm initialization
+ # script. Defaults to `~/.rvm/scripts/rvm`.
@rvmPath = env.POW_RVM_PATH ? path.join process.env.HOME, ".rvm/scripts/rvm"
# ---
@@ -139,6 +142,15 @@ module.exports = class Configuration
getLogger: (name) ->
@loggers[name] ||= new Logger path.join @logRoot, name + ".log"
+ # Globally disable or enable RVM deprecation notices by touching or
+ # removing the `~/Library/Application
+ # Support/Pow/.disableRvmDeprecationNotices` file.
+ disableRvmDeprecationNotices: ->
+ fs.writeFile path.join(@supportRoot, ".disableRvmDeprecationNotices"), ""
+
+ enableRvmDeprecationNotices: ->
+ fs.unlink path.join @supportRoot, ".disableRvmDeprecationNotices"
+
# Search `hostRoot` for files, symlinks or directories matching the
# domain specified by `host`. If a match is found, the matching domain
# name and its configuration are passed as second and third arguments
View
30 src/http_server.coffee
@@ -56,6 +56,7 @@ module.exports = class HttpServer extends connect.HTTPServer
o @handleStaticRequest
o @findRackApplication
o @handleProxyRequest
+ o @handleRvmDeprecationRequest
o @handleApplicationRequest
x @handleErrorStartingApplication
o @handleFaviconRequest
@@ -170,7 +171,7 @@ module.exports = class HttpServer extends connect.HTTPServer
exists join(root, "config.ru"), (rackConfigExists) =>
if rackConfigExists
req.pow.application = @rackApplications[root] ?=
- new RackApplication @configuration, root
+ new RackApplication @configuration, root, req.pow.host
# If `config.ru` isn't present but there's an existing
# `RackApplication` for the root, terminate the application and
@@ -212,6 +213,33 @@ module.exports = class HttpServer extends connect.HTTPServer
req.pow.resume()
+ # Handle requests for the mini-app that serves RVM deprecation
+ # notices. Manually requesting `/__pow__/rvm_deprecation` on any
+ # Rack app will show the notice. The notice is automatically
+ # displayed in a separate browser window by `RackApplication` the
+ # first time you load an app with an `.rvmrc` file.
+ handleRvmDeprecationRequest: (req, res, next) =>
+ return next() unless application = req.pow.application
+
+ if match = req.url.match /^\/__pow__\/rvm_deprecation(.*)/
+ action = match[1]
+ return next() unless action is "" or req.method is "POST"
+
+ switch action
+ when ""
+ true
+ when "/add_to_powrc"
+ application.writeRvmBoilerplate()
+ when "/enable"
+ @configuration.enableRvmDeprecationNotices()
+ when "/disable"
+ @configuration.disableRvmDeprecationNotices()
+ else
+ return next()
+ renderResponse res, 200, "rvm_deprecation_notice"
+ else
+ next()
+
# If the request object is annotated with an application, pass the
# request off to the application's `handle` method.
handleApplicationRequest: (req, res, next) ->
View
27 src/rack_application.coffee
@@ -29,13 +29,13 @@ fs = require "fs"
nack = require "nack"
{bufferLines, pause, sourceScriptEnv} = require "./util"
-{join, exists, basename} = require "path"
+{join, exists, basename, resolve} = require "path"
module.exports = class RackApplication
# Create a `RackApplication` for the given configuration and
# root path. The application begins life in the uninitialized
# state.
- constructor: (@configuration, @root) ->
+ constructor: (@configuration, @root, @firstHost) ->
@logger = @configuration.getLogger join "apps", basename @root
@readyCallbacks = []
@quitCallbacks = []
@@ -105,12 +105,18 @@ module.exports = class RackApplication
# source `.rvmrc`, and invoke `callback` with the resulting
# environment variables. If `.rvmrc` is present but rvm is not
# installed, invoke `callback` without sourcing `.rvmrc`.
+ # Before loading rvm, Pow invokes a helper script that shows a
+ # deprecation notice if it has not yet been displayed.
loadRvmEnvironment: (env, callback) ->
exists script = join(@root, ".rvmrc"), (rvmrcExists) =>
if rvmrcExists
- exists rvm = @configuration.rvmPath, (rvmExists) ->
+ exists rvm = @configuration.rvmPath, (rvmExists) =>
if rvmExists
- before = "source '#{rvm}' > /dev/null"
+ libexecPath = resolve "#{__dirname}/../libexec"
+ before = """
+ '#{libexecPath}/pow_rvm_deprecation_notice' '#{[@firstHost]}'
+ source '#{rvm}' > /dev/null
+ """.trim()
sourceScriptEnv script, env, {before}, callback
else
callback null, env
@@ -230,3 +236,16 @@ module.exports = class RackApplication
@restart callback
else
callback()
+
+ # Append RVM autoload boilerplate to the application's `.powrc`
+ # file. This is called by the RVM deprecation notice mini-app.
+ writeRvmBoilerplate: ->
+ powrc = join @root, ".powrc"
+ line1 = '[ ! -f "$rvm_path/scripts/rvm" ] || source "$rvm_path/scripts/rvm"'
+ line2 = '[ ! -f ".rvmrc" ] || source ".rvmrc"'
+
+ fs.readFile powrc, "utf8", (err, contents) ->
+ lines = contents?.split("\n") ? []
+ unless line1 in lines and line2 in lines
+ lines.push line1, line2, ""
+ fs.writeFile powrc, lines.join("\n")
View
1  src/templates/http_server/error_starting_application.html.eco
@@ -5,6 +5,5 @@
<pre class="breakout small_text"><strong><%= @err %></strong>
<%= @stack.join "\n" %><% if @rest: %>
<a href="#" onclick="this.style.display='none',this.nextSibling.style.display='';return false">Show <%= @rest.length %> more lines</a><div style="display: none"><%= @rest.join "\n" %></div><% end %></pre>
- <p>(If your app uses Bundler, check to make sure you have the <a href="http://gembundler.com/">latest version</a>, then run <code>bundle install</code>. If you&rsquo;re using rvm, make sure you have the <a href="https://rvm.beginrescueend.com/rvm/upgrading/">latest version</a> installed and your app is using the right gemset.)</p>
</section>
<% end %>
View
110 src/templates/http_server/rvm_deprecation_notice.html.eco
@@ -0,0 +1,110 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Pow: Automatic RVM support is deprecated</title>
+ <style type="text/css">
+ html {
+ background: #fff;
+ margin: 0;
+ padding: 0;
+ }
+
+ body {
+ margin: 30px auto;
+ padding: 15px 35px;
+ width: 520px;
+ font-family: Lucida Grande;
+ }
+
+ h1 {
+ font-family: Helvetica;
+ font-size: 24px;
+ }
+
+ a {
+ color: #03f;
+ }
+
+ p {
+ width: 460px;
+ font-size: 13px;
+ }
+
+ .important {
+ background: #ff3;
+ }
+
+ code {
+ font-family: Menlo;
+ font-size: 12px;
+ }
+ </style>
+ <script type="text/javascript">
+ function addToPowrc(link) {
+ perform(link, "add_to_powrc",
+ "This code has been added to your application&rsquo;s <code>.powrc</code> file."
+ )
+ }
+
+ function disable(link) {
+ perform(link, "disable",
+ "You will not see this deprecation notice for other applications. " +
+ '<a href="#" onclick="enable(this); return false">Undo</a>'
+ )
+ }
+
+ function enable(link) {
+ perform(link, "enable")
+ }
+
+ function perform(link, action, successHTML) {
+ if (link.className == "busy") return
+ link.className = "busy"
+
+ xhr = new XMLHttpRequest()
+ xhr.open("POST", "/__pow__/rvm_deprecation/" + action, true)
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState != 4) return
+ link.className = ""
+
+ if (xhr.status == 200) {
+ var p = link.parentNode
+ var previousInnerHTML = p.previousInnerHTML
+ p.previousInnerHTML = p.innerHTML
+ p.innerHTML = successHTML || previousInnerHTML
+ }
+ }
+
+ xhr.send()
+ }
+ </script>
+ </head>
+ <body>
+ <h1>Automatic RVM support is deprecated</h1>
+
+ <p>We&rsquo;re showing you this notice because you just accessed
+ an application with a per-project <code>.rvmrc</code> file.</p>
+
+ <p><span class="important">Support for automatically loading
+ per-project <code>.rvmrc</code> files in Pow is deprecated and
+ will be removed in the next major release.</span></p>
+
+ <p>Ensure your application continues to work with future releases
+ of Pow by adding the following code to the
+ application&rsquo;s <code>.powrc</code> file:</p>
+
+ <pre><code>[ ! -f "$rvm_path/scripts/rvm" ] || source "$rvm_path/scripts/rvm"
+[ ! -f ".rvmrc" ] || source ".rvmrc"</code></pre>
+
+ <p><a href="#" onclick="addToPowrc(this); return false">Add this
+ code to <code>.powrc</code> for me</a></p>
+
+ <p>We won&rsquo;t notify you again for this project.</p>
+
+ <p><a href="#" onclick="disable(this); return false">Don&rsquo;t
+ notify me about deprecations for any other applications,
+ either</a></p>
+
+ <p>Thanks for using Pow.</p>
+ </body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.