dtaniwaki / rack-dev-mark Goto Github PK
View Code? Open in Web Editor NEWShow dev mark on development env
License: MIT License
Show dev mark on development env
License: MIT License
How can I also add another environment apart from development?
e.g., qa, staging etc?
I don't have the time to look into this myself right now, but it's noteworthy that the Github Fork Ribbon theme with position: fixed
duplicates the ribbon. One is scrolling out, the other one is fixed.
(As a side note, you might want to modify the themes readme subtitle from "github-fork-ribbon" to "github_fork_ribbon" since the symbol must be :github_fork_ribbon to actually work.)
I would like to turn off the ribbon in some specific page
Can i turn if off dynamically?
I am using a Rails 4.1.4 application. When I follow the Heroku-based instructions and set up the RACK_MARK_DEV
environment variable, I am unable to get the ribbon to appear in non-development enrivonments.
When I check the headers, I do see that X-Rack-Dev-Mark-Env
is set:
X-Rack-Dev-Mark-Env:staging
However, I can't get the ribbon to appear in staging environments either on Heroku or locally on my development machine. Are there other factors I can use to troubleshoot the issue? We run our application in several environments, and this tool would have a lot of value for us.
I have tried to use skip_rack_dev_mark filter to ignore the ribbin new filter like this:
skip_rack_dev_mark only: [:new]
I used:
I also debuged in the action, the flag of Rack::DevMark.tmp_disabled was already set to true.
And I also found the description about this in README is not correct.
I recken it should be:
skip_rack_dev_mark except: [:index]
update for ruby 2.5.0?
I installed new_relic in dev mode, and this happened. Goes away when I remove new_relic and/or dev_mark
Puma caught this error: undefined method `bytesize' for #<Rack::DevMark::Middleware:0x007fd5e78621e8> (NoMethodError)
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/rack-dev-mark-0.7.4/lib/rack/dev-mark/middleware.rb:36:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/railties-5.0.0.beta4/lib/rails/rack/logger.rb:36:in `call_app'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/railties-5.0.0.beta4/lib/rails/rack/logger.rb:24:in `block in call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/activesupport-5.0.0.beta4/lib/active_support/tagged_logging.rb:70:in `block in tagged'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/activesupport-5.0.0.beta4/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/activesupport-5.0.0.beta4/lib/active_support/tagged_logging.rb:70:in `tagged'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/railties-5.0.0.beta4/lib/rails/rack/logger.rb:24:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/actionpack-5.0.0.beta4/lib/action_dispatch/middleware/request_id.rb:24:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/rack-2.0.0.alpha/lib/rack/method_override.rb:22:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/rack-2.0.0.alpha/lib/rack/runtime.rb:22:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/activesupport-5.0.0.beta4/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/actionpack-5.0.0.beta4/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/actionpack-5.0.0.beta4/lib/action_dispatch/middleware/static.rb:136:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/rack-2.0.0.alpha/lib/rack/sendfile.rb:111:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/rack-cors-0.4.0/lib/rack/cors.rb:80:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/railties-5.0.0.beta4/lib/rails/engine.rb:522:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/puma-3.4.0/lib/puma/configuration.rb:224:in `call'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/puma-3.4.0/lib/puma/server.rb:569:in `handle_request'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/puma-3.4.0/lib/puma/server.rb:406:in `process_client'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/puma-3.4.0/lib/puma/server.rb:271:in `block in run'
/Users/rexmadden/.rvm/gems/ruby-2.3.0@the_sting/gems/puma-3.4.0/lib/puma/thread_pool.rb:114:in `block in spawn_thread'
Happened warning log: warning: Rack::Utils::HeaderHash is deprecated and will be removed in Rack 3.1, switch to Rack::Headers
in the rack-dev-mark-0.7.11/lib/rack/dev-mark/middleware.rb:21 when I update rails 7.1.0
The Rack::Utils::HeaderHash was removed by Rack on the commit:
rack/rack@a5762cf#diff-85960cbd609e7f51a9881d1876b82d748f4ba8312a31e3329a5bb9bf791c60be
On Rails, redirect_to
sets the response body to:
<html><body>You are being <a href="http://url">redirected</a>.</body></html>
along with a redirect status.
Rails provides this as a response_body by default: https://github.com/rails/rails/blob/4ba1376c608cc797c80402a73568744b1c855f67/actionpack/lib/action_controller/metal/redirecting.rb#L76
Using rack-dev-mark, this gets expanded to the following:
<html><body><style>/* Left will inherit from right (so we don't need to duplicate code) */
.github-fork-ribbon {
/* The right and left classes determine the side we attach our banner to */
position: absolute;
/* Add a bit of padding to give some substance outside the "stitching" */
padding: 2px 0;
/* Set the base colour */
background-color: #a00;
/* Set a gradient: transparent black at the top to almost-transparent black at the bottom */
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.15)));
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
/* Add a drop shadow */
-webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
/* Set the font */
font: 700 13px "Helvetica Neue", Helvetica, Arial, sans-serif;
z-index: 9999;
pointer-events: auto;
opacity: 1;
transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;
}
.github-fork-ribbon:hover {
opacity: 0.2;
}
.github-fork-ribbon.red {
background-color: #a00;
}
.github-fork-ribbon.green {
background-color: #090;
}
.github-fork-ribbon.black {
background-color: #333;
}
.github-fork-ribbon.orange {
background-color: #f80;
}
.github-fork-ribbon .github-fork-ribbon-text,
.github-fork-ribbon .github-fork-ribbon-text:hover {
/* Set the text properties */
color: #fff;
text-decoration: none;
text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
text-align: center;
cursor: pointer;
/* Set the geometry. If you fiddle with these you'll also need
to tweak the top and right values in .github-fork-ribbon. */
width: 200px;
line-height: 20px;
/* Set the layout properties */
display: inline-block;
padding: 2px 0;
/* Add "stitching" effect */
border-width: 1px 0;
border-style: dotted;
border-color: #fff;
border-color: rgba(255, 255, 255, 0.7);
}
.github-fork-ribbon-wrapper {
width: 150px;
height: 150px;
position: absolute;
overflow: hidden;
top: 0;
z-index: 9999;
pointer-events: none;
}
.github-fork-ribbon-wrapper.fixed {
position: fixed;
}
.github-fork-ribbon-wrapper.left {
left: 0;
}
.github-fork-ribbon-wrapper.right {
right: 0;
}
.github-fork-ribbon-wrapper.left-bottom {
position: fixed;
top: inherit;
bottom: 0;
left: 0;
}
.github-fork-ribbon-wrapper.right-bottom {
position: fixed;
top: inherit;
bottom: 0;
right: 0;
}
.github-fork-ribbon-wrapper.right .github-fork-ribbon {
top: 42px;
right: -43px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.github-fork-ribbon-wrapper.left .github-fork-ribbon {
top: 42px;
left: -43px;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon {
top: 80px;
left: -43px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon {
top: 80px;
right: -43px;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
}
</style>
<!--[if lt IE 9]>
<style>/* IE voodoo courtesy of http://stackoverflow.com/a/4617511/263871 and
* http://www.useragentman.com/IETransformsTranslator */
.github-fork-ribbon {
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#000000', EndColorStr='#000000');
}
.github-fork-ribbon-wrapper.right .github-fork-ribbon {
/* IE positioning hack (couldn't find a transform-origin alternative for IE) */
top: -22px;
right: -62px;
/* IE8+ */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865474, M12=-0.7071067811865477, M21=0.7071067811865477, M22=0.7071067811865474, SizingMethod='auto expand')";
/* IE6 and 7 */
filter: progid:DXImageTransform.Microsoft.Matrix(
M11=0.7071067811865474,
M12=-0.7071067811865477,
M21=0.7071067811865477,
M22=0.7071067811865474,
SizingMethod='auto expand'
);
}
.github-fork-ribbon-wrapper.left .github-fork-ribbon {
top: -22px;
left: -22px;
/* IE8+ */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865483, M12=0.7071067811865467, M21=-0.7071067811865467, M22=0.7071067811865483, SizingMethod='auto expand')";
/* IE6 and 7 */
filter: progid:DXImageTransform.Microsoft.Matrix(
M11=0.7071067811865483,
M12=0.7071067811865467,
M21=-0.7071067811865467,
M22=0.7071067811865483,
SizingMethod='auto expand'
);
}
.github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon {
/* IE positioning hack (couldn't find a transform-origin alternative for IE) */
top: 12px;
left: -22px;
/* IE8+ */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865474, M12=-0.7071067811865477, M21=0.7071067811865477, M22=0.7071067811865474, SizingMethod='auto expand')";
/* IE6 and 7 */
/* filter: progid:DXImageTransform.Microsoft.Matrix(
M11=0.7071067811865474,
M12=-0.7071067811865477,
M21=0.7071067811865477,
M22=0.7071067811865474,
SizingMethod='auto expand'
);
*/}
.github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon {
top: 12px;
right: -62px;
/* IE8+ */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865483, M12=0.7071067811865467, M21=-0.7071067811865467, M22=0.7071067811865483, SizingMethod='auto expand')";
/* IE6 and 7 */
filter: progid:DXImageTransform.Microsoft.Matrix(
M11=0.7071067811865483,
M12=0.7071067811865467,
M21=-0.7071067811865467,
M22=0.7071067811865483,
SizingMethod='auto expand'
);
}
</style>
<![endif]-->
<div class="github-fork-ribbon-wrapper left" onClick="this.style.display='none'" title=""><div class="github-fork-ribbon red"><span class="github-fork-ribbon-text">development</span></div></div>You are being <a href="http://url">redirected</a>.</body></html>
This takes the redirect body from ~80 B to about 7 KB.
Without having to explicitly use skip_rack_dev_mark
everywhere, is it possible to exclude redirects from the dev-mark automatically?
Is there a chance for cutting a version that supports Ruby 2.6.0?
Hi :)
I use rack-dev-mark 0.7.5. I want use version containing this commit da27ec9 .
I wirte Gemfile ref to master, now. Are you planning to update gem?
When installed, this gem takes 2.7MB. The main reason for this is that the misc/
directory is included, which pulls in animated gifs and pictures of the usage.
Would there be any objections to me excluding everything in misc/
with the gemspec file? Currently it just adds everything with git ls-files
.
I am using your gem. The title is only based on the environment. Can we set a custom title?
I try config.rack_dev_mark.custom_theme = [Rack::DevMark::Theme::Tag.new(attribute: 'hello')]
then
environments/development.rb:51:in `block in <top (required)>': uninitialized constant Rack::DevMark::Theme::Tag (NameError)
When I printed out page with left-bottom ribbon in development environment, ribbon is middle of page 2.
How about hiding ribbon in css of @media print
?
Hey,
I added the gem, then ran my rails app in development and it was showing the ribbon with the text 'staging'.
I disabled the mark with config.rack_dev_mark.enable = false
in app.rb, dev.rb and it was still showing the ribbon with 'staging' as text.
It seems that this check here actually is not working properly as by default it's always shown anyway:
https://github.com/dtaniwaki/rack-dev-mark/blob/master/lib/rack/dev-mark/railtie.rb#L28
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.