rack-dev-mark 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2284315953d245c1158c596752a2e0bdbcadfd5
4
+ data.tar.gz: 92cc595d1e50b3572d43d7b9ef8dae877e850ae4
5
+ SHA512:
6
+ metadata.gz: 03ea9c2672008516b0ae66fed3b0ae6d3c4e512f55328eb125eda129059b092aa5b47995ba78e10f413ae8c2918e20aabf9a71c21b216bcfb25cee971cabc733
7
+ data.tar.gz: 3de9e6db01b3545bb11ebeed2264bbac42cf3c228153d1f6af63a7ed6def433d68490f3c3ae6e62813e053327c6577a4078b9b5a4ad514d9a7061748e3b83d49
data/.gitignore ADDED
@@ -0,0 +1,33 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+ /log/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalisation:
25
+ /.bundle/
26
+ /lib/bundler/man/
27
+
28
+ ## Misc
29
+ Gemfile.lock
30
+ gemfiles/*.lock
31
+ .ruby-version
32
+ .ruby-gemset
33
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+ gemfile:
8
+ - gemfiles/gemfile
9
+ - gemfiles/rack.1.4.x.gemfile
10
+
11
+ script: "bundle exec rake spec"
12
+
13
+ branches:
14
+ only:
15
+ - master
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Daisuke Taniwaki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # rack-dev-mark
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rack-dev-mark.png)](https://rubygems.org/gems/rack-dev-mark) [![Build Status](https://secure.travis-ci.org/dtaniwaki/rack-dev-mark.png?branch=master)](http://travis-ci.org/dtaniwaki/rack-dev-mark) [![Coverage Status](https://coveralls.io/repos/dtaniwaki/rack-dev-mark/badge.png?branch=master)](https://coveralls.io/r/dtaniwaki/rack-dev-mark?branch=master)
4
+
5
+ Differenciate development environment from production.
6
+
7
+ ## Screenshot
8
+
9
+ ### Development
10
+
11
+ ![screenshot development](screenshot-development.png)
12
+
13
+ ### Production
14
+
15
+ ![screenshot production](screenshot-production.png)
16
+
17
+ ## Installation
18
+
19
+ Add the rack-dev-mark gem to your Gemfile.
20
+
21
+ ```ruby
22
+ gem "rack-dev-mark"
23
+ ```
24
+
25
+ And run `bundle install`. The rest of the installation depends on
26
+ whether the asset pipeline is being used.
27
+
28
+ Then, initialize planbcd.
29
+
30
+ ## Usage
31
+
32
+ ### For your Rack app
33
+
34
+ ```ruby:config.ru
35
+ require 'rack/dev-mark'
36
+ use Rack::DevMark::Middleware
37
+ run MyApp
38
+ ```
39
+
40
+ ### For your Rails app
41
+
42
+ This gem inserts rack middleware for all the environment except production automatically.
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create new [Pull Request](../../pull/new/master)
51
+
52
+ ### Use custom theme
53
+
54
+ Define a sub class of `Rack::DevMark::Theme::Base` somewhere in your app.
55
+
56
+ ```ruby
57
+ require 'rack/dev-mark/theme/base'
58
+
59
+ class NewTheme < Rack::DevMark::Theme::Base
60
+ def insert_into(html, env)
61
+ # Do something for your theme
62
+ html
63
+ end
64
+ end
65
+ ```
66
+
67
+ Then, insert it in your app.
68
+
69
+ For your Rack app
70
+
71
+ ```ruby
72
+ use Rack::DevMark::Middleware, Rack::DevMark::Theme::NewTheme.new
73
+ ```
74
+
75
+ For your Rails app
76
+
77
+ ```ruby:config/application.rb
78
+ module MyApp
79
+ class Application < Rails::Application
80
+ config.middleware.delete Rack::DevMark::Middleware
81
+ config.middleware.use Rack::DevMark::Middleware, NewTheme.new
82
+ end
83
+ end
84
+ ```
85
+
86
+ ## Copyright
87
+
88
+ Copyright (c) 2014 Daisuke Taniwaki. See [LICENSE](LICENSE) for details.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core'
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = FileList['spec/**/*_spec.rb']
7
+ end
8
+ task :default => :spec
data/gemfiles/gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec :path => '../'
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rack', '~> 1.4.0'
4
+ gemspec :path => '../'
@@ -0,0 +1 @@
1
+ require 'rack/dev-mark'
@@ -0,0 +1,16 @@
1
+ require 'rack'
2
+ require 'rack/dev-mark/error'
3
+ require 'rack/dev-mark/utils'
4
+ require 'rack/dev-mark/title'
5
+ require 'rack/dev-mark/theme'
6
+ require 'rack/dev-mark/middleware'
7
+ require 'rack/dev-mark/railtie' if defined?(Rails)
8
+ require 'rack/dev-mark/version'
9
+
10
+ module Rack
11
+ module DevMark
12
+ def self.env
13
+ ENV['RAILS_ENV'] || ENV['RACK_ENV']
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ module Rack
2
+ module DevMark
3
+ class Exception < ::Exception; end
4
+ class RuntimeError < Exception; end
5
+ end
6
+ end
@@ -0,0 +1,42 @@
1
+ module Rack
2
+ module DevMark
3
+ class Middleware
4
+ include Rack::Utils
5
+ include Rack::DevMark::Utils
6
+
7
+ def initialize(app, theme = :github_fork_ribbon)
8
+ @app = app
9
+ @title = Rack::DevMark::Title.new
10
+ @theme = theme.is_a?(Symbol) ? Rack::DevMark::Theme.const_get(camelize(theme.to_s)).new : theme
11
+ end
12
+
13
+ def call(env)
14
+ status, headers, response = @app.call(env)
15
+
16
+ headers = HeaderHash.new(headers)
17
+
18
+ if headers['Content-Type'].to_s =~ %r{^text/html;}i
19
+ begin
20
+ response = insert_dev_marks(response)
21
+ rescue Rack::DevMark::Exception => e
22
+ $stderr.write "Failed to insert dev marks: #{e.message}\n"
23
+ end
24
+ end
25
+
26
+ [status, headers, response]
27
+ end
28
+
29
+ private
30
+
31
+ def insert_dev_marks(response)
32
+ body = ""
33
+ response.each do |r|
34
+ body.concat r.to_s
35
+ end
36
+ body = @title.insert_into(body, Rack::DevMark.env)
37
+ body = @theme.insert_into(body, Rack::DevMark.env)
38
+ [body]
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,14 @@
1
+ require 'rack/dev-mark/middleware'
2
+
3
+ module Rack
4
+ module DevMark
5
+ class Railtie < ::Rails::Railtie
6
+ config.before_configuration do |app|
7
+ app.middleware.delete Rack::DevMark::Middleware
8
+ if Rack::DevMark.env != 'production'
9
+ app.middleware.use Rack::DevMark::Middleware
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module Rack
2
+ module DevMark
3
+ module Theme
4
+ end
5
+ end
6
+ end
7
+
8
+ Dir[File.join(File.dirname(__FILE__), 'theme', '*.rb')].each do |f|
9
+ require f
10
+ end
@@ -0,0 +1,21 @@
1
+ module Rack
2
+ module DevMark
3
+ module Theme
4
+ class Base
5
+ def initialize(*args)
6
+ raise RuntimeError, 'Abstract class can not be instantiated' if self.class == Rack::DevMark::Theme::Base
7
+ end
8
+
9
+ def insert_into(html, env)
10
+
11
+ end
12
+
13
+ private
14
+
15
+ def stylesheet_link_tag(path)
16
+ %Q~<style>#{::File.open(::File.join(::File.dirname(__FILE__), '../../../../vendor/assets/stylesheets', path)).read}</style>~
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Thanks to https://github.com/simonwhitaker/github-fork-ribbon-css
2
+ require 'rack/dev-mark/theme/base'
3
+
4
+ module Rack
5
+ module DevMark
6
+ module Theme
7
+ class GithubForkRibbon < Base
8
+ def insert_into(html, env)
9
+ s = <<-EOS
10
+ #{stylesheet_link_tag "github-fork-ribbon-css/gh-fork-ribbon.css"}
11
+ <!--[if lt IE 9]>
12
+ #{stylesheet_link_tag "github-fork-ribbon-css/gh-fork-ribbon.ie.css"}
13
+ <![endif]-->
14
+ <div class="github-fork-ribbon-wrapper left"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css" class="github-fork-ribbon-text" target="_blank">#{env}</a></div></div>
15
+ EOS
16
+ html.sub %r{(<body[^>]*>)}i, "\\1#{s.strip}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module Rack
2
+ module DevMark
3
+ class Title
4
+ def insert_into(html, env)
5
+ html.sub %r{(<title[^>]*>)}i, "\\1(#{env}) "
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Rack
2
+ module DevMark
3
+ module Utils
4
+ def camelize(s)
5
+ s.split('_').map{ |_s| "#{_s[0].upcase}#{_s[1..-1]}" }.join
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Rack
2
+ module DevMark
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../lib/rack/dev-mark/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "rack-dev-mark"
5
+ gem.version = Rack::DevMark::VERSION
6
+ gem.platform = Gem::Platform::RUBY
7
+ gem.authors = ["Daisuke Taniwaki"]
8
+ gem.email = ["daisuketaniwaki@gmail.com"]
9
+ gem.homepage = "https://github.com/dtaniwaki/rack-dev-mark"
10
+ gem.summary = "Differenciate development environemt from production"
11
+ gem.description = "Differenciate development environemt from production"
12
+ gem.license = "MIT"
13
+
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ gem.require_paths = ['lib']
18
+
19
+ gem.add_dependency "rack", ">= 1.4"
20
+
21
+ gem.add_development_dependency "rails", ">= 3.1"
22
+ gem.add_development_dependency "rake"
23
+ gem.add_development_dependency "rspec"
24
+ gem.add_development_dependency "coveralls"
25
+ end
Binary file
Binary file
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rack::DevMark::Middleware do
4
+ let(:app) { double call: [200, {'Content-Type' => 'text/html; charset=utf-8'}, ['response']] }
5
+ subject { Rack::DevMark::Middleware.new(app) }
6
+ before do
7
+ allow(Rack::DevMark).to receive(:env).and_return('test')
8
+ end
9
+
10
+ it "inserts planbcd tag" do
11
+ expect_any_instance_of(Rack::DevMark::Title).to receive(:insert_into).with('response', 'test').once.and_return('response')
12
+ expect_any_instance_of(Rack::DevMark::Theme::GithubForkRibbon).to receive(:insert_into).with('response', 'test').once.and_return('response')
13
+ status, headers, body = subject.call({})
14
+ expect(status).to eq(200)
15
+ expect(headers).to eq({'Content-Type' => 'text/html; charset=utf-8'})
16
+ expect(body).to eq(['response'])
17
+ end
18
+ context "not html request" do
19
+ let(:app) { double call: [200, {'Content-Type' => 'application/json;'}, ['{}']] }
20
+ it "does not insert planbcd tag if the body does not have head tag" do
21
+ expect_any_instance_of(Rack::DevMark::Title).not_to receive(:insert_into)
22
+ expect_any_instance_of(Rack::DevMark::Theme::GithubForkRibbon).not_to receive(:insert_into)
23
+ status, headers, body = subject.call({})
24
+ expect(status).to eq(200)
25
+ expect(headers).to eq({'Content-Type' => 'application/json;'})
26
+ expect(body).to eq(['{}'])
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+ require 'rails'
3
+ require 'rack/dev-mark/railtie'
4
+
5
+ describe Rack::DevMark::Railtie do
6
+ let(:env) { nil }
7
+ let(:app) { Class.new(Rails::Application) }
8
+ before do
9
+ @env = ENV['RAILS_ENV']
10
+ ENV['RAILS_ENV'] = env
11
+ app.initialize!
12
+ end
13
+ after do
14
+ ENV['RAILS_ENV'] = @env
15
+ Rails.application = nil
16
+ end
17
+
18
+ context "development env" do
19
+ it "adds rack middleware" do
20
+ expect(app.middleware.middlewares).to include(Rack::DevMark::Middleware)
21
+ end
22
+ end
23
+ context "production env" do
24
+ let(:env) { 'production' }
25
+
26
+ it "does not add rack middleware" do
27
+ expect(app.middleware.middlewares).not_to include(Rack::DevMark::Middleware)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rack::DevMark::Theme::Base do
4
+ it "has private initialize method" do
5
+ expect {
6
+ Rack::DevMark::Theme::Base.new
7
+ }.to raise_error(Rack::DevMark::RuntimeError)
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rack::DevMark::Theme::GithubForkRibbon do
4
+ it_behaves_like "theme" do
5
+ let :out do
6
+ s = <<-EOS
7
+ <html><head>head<title>title</title></head><body><style>#{read_stylesheet "github-fork-ribbon-css/gh-fork-ribbon.css"}</style>
8
+ <!--[if lt IE 9]>
9
+ <style>#{read_stylesheet "github-fork-ribbon-css/gh-fork-ribbon.ie.css"}</style>
10
+ <![endif]-->
11
+ <div class="github-fork-ribbon-wrapper left"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css" class="github-fork-ribbon-text" target="_blank">env</a></div></div>body</body></html>
12
+ EOS
13
+ s.strip
14
+ end
15
+
16
+ subject { Rack::DevMark::Theme::GithubForkRibbon.new }
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rack::DevMark::Title do
4
+ it_behaves_like "theme" do
5
+ let (:out) { %Q~<html><head>head<title>(env) title</title></head><body>body</body></html>~ }
6
+ subject { Rack::DevMark::Title.new }
7
+ end
8
+ context "no title tag" do
9
+ let (:src) { %Q~<html><head>head</head><body>body</body></html>~ }
10
+ let (:out) { %Q~<html><head>head</head><body>body</body></html>~ }
11
+ it "does not insert anything" do
12
+ expect(subject.insert_into(src, 'env')).to eq(src)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rack::DevMark do
4
+ subject { Rack::DevMark }
5
+ before do
6
+ @rack_env = ENV['RACK_ENV']
7
+ @rails_env = ENV['RAILS_ENV']
8
+ end
9
+ after do
10
+ ENV['RACK_ENV'] = @rack_env
11
+ ENV['RAILS_ENV'] = @rails_env
12
+ end
13
+ it "returns nil" do
14
+ ENV['RAILS_ENV'] = nil
15
+ ENV['RACK_ENV'] = nil
16
+ expect(subject.env).to eq(nil)
17
+ end
18
+ it "returns rack_env" do
19
+ ENV['RAILS_ENV'] = nil
20
+ ENV['RACK_ENV'] = 'abc'
21
+ expect(subject.env).to eq('abc')
22
+ end
23
+ it "returns rails_env instead of rack_env" do
24
+ ENV['RACK_ENV'] = 'abc'
25
+ ENV['RAILS_ENV'] = 'def'
26
+ expect(subject.env).to eq('def')
27
+ end
28
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+
5
+ require 'rack'
6
+ require 'rack-dev-mark'
7
+
8
+ Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
9
+
10
+ ENV['RACK_ENV'] = 'test'
11
+ RSpec.configure do |config|
12
+ end
13
+
@@ -0,0 +1,10 @@
1
+ RSpec.shared_examples "theme" do
2
+ def read_stylesheet(path)
3
+ ::File.open(::File.join(::File.dirname(__FILE__), '../../vendor/assets/stylesheets', path)).read
4
+ end
5
+
6
+ let (:src) { %Q~<html><head>head<title>title</title></head><body>body</body></html>~ }
7
+ it "insert env mark" do
8
+ expect(subject.insert_into(src, 'env')).to eq(out)
9
+ end
10
+ end
@@ -0,0 +1,135 @@
1
+ /* Left will inherit from right (so we don't need to duplicate code) */
2
+ .github-fork-ribbon {
3
+ /* The right and left classes determine the side we attach our banner to */
4
+ position: absolute;
5
+
6
+ /* Add a bit of padding to give some substance outside the "stitching" */
7
+ padding: 2px 0;
8
+
9
+ /* Set the base colour */
10
+ background-color: #a00;
11
+
12
+ /* Set a gradient: transparent black at the top to almost-transparent black at the bottom */
13
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.15)));
14
+ background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
15
+ background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
16
+ background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
17
+ background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
18
+ background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
19
+
20
+ /* Add a drop shadow */
21
+ -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
22
+ -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
23
+ box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
24
+
25
+ /* Set the font */
26
+ font: 700 13px "Helvetica Neue", Helvetica, Arial, sans-serif;
27
+
28
+ z-index: 9999;
29
+ pointer-events: auto;
30
+ }
31
+
32
+ .github-fork-ribbon .github-fork-ribbon-text,
33
+ .github-fork-ribbon .github-fork-ribbon-text:hover {
34
+ /* Set the text properties */
35
+ color: #fff;
36
+ text-decoration: none;
37
+ text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
38
+ text-align: center;
39
+
40
+ /* Set the geometry. If you fiddle with these you'll also need
41
+ to tweak the top and right values in .github-fork-ribbon. */
42
+ width: 200px;
43
+ line-height: 20px;
44
+
45
+ /* Set the layout properties */
46
+ display: inline-block;
47
+ padding: 2px 0;
48
+
49
+ /* Add "stitching" effect */
50
+ border-width: 1px 0;
51
+ border-style: dotted;
52
+ border-color: #fff;
53
+ border-color: rgba(255, 255, 255, 0.7);
54
+ }
55
+
56
+ .github-fork-ribbon-wrapper {
57
+ width: 150px;
58
+ height: 150px;
59
+ position: absolute;
60
+ overflow: hidden;
61
+ top: 0;
62
+ z-index: 9999;
63
+ pointer-events: none;
64
+ }
65
+
66
+ .github-fork-ribbon-wrapper.fixed {
67
+ position: fixed;
68
+ }
69
+
70
+ .github-fork-ribbon-wrapper.left {
71
+ left: 0;
72
+ }
73
+
74
+ .github-fork-ribbon-wrapper.right {
75
+ right: 0;
76
+ }
77
+
78
+ .github-fork-ribbon-wrapper.left-bottom {
79
+ position: fixed;
80
+ top: inherit;
81
+ bottom: 0;
82
+ left: 0;
83
+ }
84
+
85
+ .github-fork-ribbon-wrapper.right-bottom {
86
+ position: fixed;
87
+ top: inherit;
88
+ bottom: 0;
89
+ right: 0;
90
+ }
91
+
92
+ .github-fork-ribbon-wrapper.right .github-fork-ribbon {
93
+ top: 42px;
94
+ right: -43px;
95
+
96
+ -webkit-transform: rotate(45deg);
97
+ -moz-transform: rotate(45deg);
98
+ -ms-transform: rotate(45deg);
99
+ -o-transform: rotate(45deg);
100
+ transform: rotate(45deg);
101
+ }
102
+
103
+ .github-fork-ribbon-wrapper.left .github-fork-ribbon {
104
+ top: 42px;
105
+ left: -43px;
106
+
107
+ -webkit-transform: rotate(-45deg);
108
+ -moz-transform: rotate(-45deg);
109
+ -ms-transform: rotate(-45deg);
110
+ -o-transform: rotate(-45deg);
111
+ transform: rotate(-45deg);
112
+ }
113
+
114
+
115
+ .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon {
116
+ top: 80px;
117
+ left: -43px;
118
+
119
+ -webkit-transform: rotate(45deg);
120
+ -moz-transform: rotate(45deg);
121
+ -ms-transform: rotate(45deg);
122
+ -o-transform: rotate(45deg);
123
+ transform: rotate(45deg);
124
+ }
125
+
126
+ .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon {
127
+ top: 80px;
128
+ right: -43px;
129
+
130
+ -webkit-transform: rotate(-45deg);
131
+ -moz-transform: rotate(-45deg);
132
+ -ms-transform: rotate(-45deg);
133
+ -o-transform: rotate(-45deg);
134
+ transform: rotate(-45deg);
135
+ }
@@ -0,0 +1,73 @@
1
+ /* IE voodoo courtesy of http://stackoverflow.com/a/4617511/263871 and
2
+ * http://www.useragentman.com/IETransformsTranslator */
3
+
4
+ .github-fork-ribbon {
5
+ filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#000000', EndColorStr='#000000');
6
+ }
7
+
8
+ .github-fork-ribbon-wrapper.right .github-fork-ribbon {
9
+ /* IE positioning hack (couldn't find a transform-origin alternative for IE) */
10
+ top: -22px;
11
+ right: -62px;
12
+
13
+ /* IE8+ */
14
+ -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865474, M12=-0.7071067811865477, M21=0.7071067811865477, M22=0.7071067811865474, SizingMethod='auto expand')";
15
+ /* IE6 and 7 */
16
+ filter: progid:DXImageTransform.Microsoft.Matrix(
17
+ M11=0.7071067811865474,
18
+ M12=-0.7071067811865477,
19
+ M21=0.7071067811865477,
20
+ M22=0.7071067811865474,
21
+ SizingMethod='auto expand'
22
+ );
23
+ }
24
+
25
+ .github-fork-ribbon-wrapper.left .github-fork-ribbon {
26
+ top: -22px;
27
+ left: -22px;
28
+
29
+ /* IE8+ */
30
+ -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865483, M12=0.7071067811865467, M21=-0.7071067811865467, M22=0.7071067811865483, SizingMethod='auto expand')";
31
+ /* IE6 and 7 */
32
+ filter: progid:DXImageTransform.Microsoft.Matrix(
33
+ M11=0.7071067811865483,
34
+ M12=0.7071067811865467,
35
+ M21=-0.7071067811865467,
36
+ M22=0.7071067811865483,
37
+ SizingMethod='auto expand'
38
+ );
39
+ }
40
+
41
+ .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon {
42
+ /* IE positioning hack (couldn't find a transform-origin alternative for IE) */
43
+ top: 12px;
44
+ left: -22px;
45
+
46
+
47
+ /* IE8+ */
48
+ -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865474, M12=-0.7071067811865477, M21=0.7071067811865477, M22=0.7071067811865474, SizingMethod='auto expand')";
49
+ /* IE6 and 7 */
50
+ /* filter: progid:DXImageTransform.Microsoft.Matrix(
51
+ M11=0.7071067811865474,
52
+ M12=-0.7071067811865477,
53
+ M21=0.7071067811865477,
54
+ M22=0.7071067811865474,
55
+ SizingMethod='auto expand'
56
+ );
57
+ */}
58
+
59
+ .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon {
60
+ top: 12px;
61
+ right: -62px;
62
+
63
+ /* IE8+ */
64
+ -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865483, M12=0.7071067811865467, M21=-0.7071067811865467, M22=0.7071067811865483, SizingMethod='auto expand')";
65
+ /* IE6 and 7 */
66
+ filter: progid:DXImageTransform.Microsoft.Matrix(
67
+ M11=0.7071067811865483,
68
+ M12=0.7071067811865467,
69
+ M21=-0.7071067811865467,
70
+ M22=0.7071067811865483,
71
+ SizingMethod='auto expand'
72
+ );
73
+ }
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-dev-mark
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Daisuke Taniwaki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Differenciate development environemt from production
84
+ email:
85
+ - daisuketaniwaki@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
+ - Gemfile
93
+ - LICENSE
94
+ - README.md
95
+ - Rakefile
96
+ - gemfiles/gemfile
97
+ - gemfiles/rack.1.4.x.gemfile
98
+ - lib/rack-dev-mark.rb
99
+ - lib/rack/dev-mark.rb
100
+ - lib/rack/dev-mark/error.rb
101
+ - lib/rack/dev-mark/middleware.rb
102
+ - lib/rack/dev-mark/railtie.rb
103
+ - lib/rack/dev-mark/theme.rb
104
+ - lib/rack/dev-mark/theme/base.rb
105
+ - lib/rack/dev-mark/theme/github_fork_ribbon.rb
106
+ - lib/rack/dev-mark/title.rb
107
+ - lib/rack/dev-mark/utils.rb
108
+ - lib/rack/dev-mark/version.rb
109
+ - rack-dev-mark.gemspec
110
+ - screenshot-development.png
111
+ - screenshot-production.png
112
+ - spec/rack/dev-mark/middleware_spec.rb
113
+ - spec/rack/dev-mark/railtie_spec.rb
114
+ - spec/rack/dev-mark/theme/base_spec.rb
115
+ - spec/rack/dev-mark/theme/github_fork_ribbon_spec.rb
116
+ - spec/rack/dev-mark/title_spec.rb
117
+ - spec/rack/dev-mark_spec.rb
118
+ - spec/spec_helper.rb
119
+ - spec/support/theme_helper.rb
120
+ - vendor/assets/stylesheets/github-fork-ribbon-css/gh-fork-ribbon.css
121
+ - vendor/assets/stylesheets/github-fork-ribbon-css/gh-fork-ribbon.ie.css
122
+ homepage: https://github.com/dtaniwaki/rack-dev-mark
123
+ licenses:
124
+ - MIT
125
+ metadata: {}
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.2.2
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: Differenciate development environemt from production
146
+ test_files:
147
+ - spec/rack/dev-mark/middleware_spec.rb
148
+ - spec/rack/dev-mark/railtie_spec.rb
149
+ - spec/rack/dev-mark/theme/base_spec.rb
150
+ - spec/rack/dev-mark/theme/github_fork_ribbon_spec.rb
151
+ - spec/rack/dev-mark/title_spec.rb
152
+ - spec/rack/dev-mark_spec.rb
153
+ - spec/spec_helper.rb
154
+ - spec/support/theme_helper.rb
155
+ has_rdoc: