rails_development_toolkit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -0
- data/lib/rack/development_mode.rb +19 -0
- data/lib/rails_development_toolkit/version.rb +1 -1
- metadata +9 -6
- data/README +0 -5
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Rails Development Toolkit
|
2
|
+
=========================
|
3
|
+
|
4
|
+
Installation
|
5
|
+
------------
|
6
|
+
Add to your Gemfile:
|
7
|
+
|
8
|
+
gem 'rails_development_toolkit', :group => :development
|
9
|
+
|
10
|
+
And install it via bundler:
|
11
|
+
|
12
|
+
bundle install
|
13
|
+
|
14
|
+
Rake tasks
|
15
|
+
----------
|
16
|
+
|
17
|
+
rake development:config:prepare # Build templates from current development config files (existing files will be overwritten)
|
18
|
+
rake development:config:setup # Build development config files from templates (existing files will be overwritten)
|
19
|
+
|
20
|
+
|
21
|
+
Rack::DevelopmentMode
|
22
|
+
---------------------
|
23
|
+
DevelopmentMode is rack middleware module, which inject special markup to each HTML page, so it is easy to visually identify production or development mode you are in.
|
24
|
+
|
25
|
+
To enable it add to your environment/development.rb:
|
26
|
+
|
27
|
+
config.middleware.use ::Rack::DevelopmentMode
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Rack
|
2
|
+
class DevelopmentMode
|
3
|
+
|
4
|
+
DEV_CODE = '<div style="height: 32px; text-align: center; line-height: 32px; text-shadow: 0 1px 1px #333; color: #fff; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAaBJREFUWMO9188rBGEcx/H399ndmdkf2CTlP3BxQUkhrBCK0JL24KCUKJSbnKQkJVJKLko5uJKLcpM7d/+Bo/xox4HUxu7a7zO7z+2ZZ56Zz+s7z0zPyMfDhI+yvb3D1mlWO52WRiGMRbu883l80s9fmRKMjf78Rl08epqFmgT6AJd3Pll99cn0C6AMYKvvaxWq4+gD2OpnvvWqALb6wTahKoo+gK1+uk9y+qaS+uF2Ie6hD2CrT6fk1zFTKf1YlxBz0Qew1Y93yZ/HTSX0k91C1EUfwEZvzFf5846XW5/uFdxI/nF5vzUFr7595rN+7Kv1z1eGmIeuAi+vsHGi12/OScGbFw2wf2H37Jcmpfh55dLvLAiegz6AjT4cgvlR+V+lyqHfXSy88osGsNE7EZgbkf+vlaD1e0uCE0EfwEbvOTA7JKW9LUHqD5aFSIkbfROUPuZBZkBK/14EpT9cFcIh9AFs9IkoTKdENdcEoT9a0+l/Atjok4mvDYe2mSD0IfUPHoSv7306msB1hPpk7mBDXW6/toqcj0zcg7FOvR7gEykBpflo0fvfAAAAAElFTkSuQmCC) repeat 0 0; font-size: 14px; font-weight: bold; font-family: arial, sans-serif;">Under Construction</div>'
|
5
|
+
|
6
|
+
def initialize app
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call env
|
11
|
+
status, headers, response = @app.call(env)
|
12
|
+
content_type = headers["Content-Type"]
|
13
|
+
if content_type && content_type.include?("text/html")
|
14
|
+
response.body = response.body.gsub(/(<body.*?>)/, '\\1' << DEV_CODE)
|
15
|
+
end
|
16
|
+
[status, headers, response]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_development_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- ingeniarius
|
@@ -15,7 +15,8 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-02 00:00:00 +04:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rake
|
@@ -43,13 +44,15 @@ extra_rdoc_files: []
|
|
43
44
|
files:
|
44
45
|
- .gitignore
|
45
46
|
- Gemfile
|
46
|
-
- README
|
47
|
+
- README.md
|
47
48
|
- Rakefile
|
49
|
+
- lib/rack/development_mode.rb
|
48
50
|
- lib/rails_development_toolkit.rb
|
49
51
|
- lib/rails_development_toolkit/railtie.rb
|
50
52
|
- lib/rails_development_toolkit/railties/rails_development_toolkit.rake
|
51
53
|
- lib/rails_development_toolkit/version.rb
|
52
54
|
- rails_development_toolkit.gemspec
|
55
|
+
has_rdoc: true
|
53
56
|
homepage: https://github.com/ingeniarius/rails_development_toolkit
|
54
57
|
licenses: []
|
55
58
|
|
@@ -79,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
82
|
requirements: []
|
80
83
|
|
81
84
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.6.2
|
83
86
|
signing_key:
|
84
87
|
specification_version: 3
|
85
88
|
summary: Rails Development Toolkit
|
data/README
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
Rails Development Toolkit
|
2
|
-
=========================
|
3
|
-
|
4
|
-
rake development:config:prepare # Build templates from current development config files (existing files will be overwritten)
|
5
|
-
rake development:config:setup # Build development config files from templates (existing files will be overwritten)
|