rails-sandbox-assets 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c33e158d4aaa6c1d85bdfcc9245d0ed14861176
4
- data.tar.gz: 7e86635b67f51b22cecc413281da34c00c6b039a
3
+ metadata.gz: 4077420e306bf38918ede39e3a318e419f120b6b
4
+ data.tar.gz: de4f7c6c255dfb036cfb8e39e7a8a359e7907a1b
5
5
  SHA512:
6
- metadata.gz: 8f4bd7d4aff7efd8cdae40c74fd1f8c09126546f5487925598af495302a76d35762d482129d92e4ea5023db7907f5d1d1dc46ed2e0a48e6d61e16cd958280a16
7
- data.tar.gz: a075466c5fccb747e9f783cb1d1f03656e986a630cc95435f57aa129e02ae1d4a7054f556aeb8f224861fbe94ffc0ec185ad74baa02a9dc57c0abfe29e869c1d
6
+ metadata.gz: 07ff7b16ac8e95f3938b58f4f2725f8c8c845780c7686b61c86c749a0ce8496e46ea9b305698b7f90fb99d5ccd9d9ed6f966f0a1d6e544c225f962b2d5a2bdf3
7
+ data.tar.gz: 21a942556025db6ff62c673e9ebb37c0c4c58a87a71a7d4494e0bb7d65b0bc11464dfa6345e4ba54b75c296d6cea526423abd6dc4677c8c2020a985db0f7845a
data/README.md CHANGED
@@ -101,3 +101,7 @@ the _@tests_ and _@stylesheets_ instance variables to include them anywhere in y
101
101
  3. Commit your changes (`git commit -am 'Add some feature'`)
102
102
  4. Push to the branch (`git push origin my-new-feature`)
103
103
  5. Create new Pull Request
104
+
105
+
106
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rosenfeld/rails-sandbox-assets/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
107
+
@@ -1,4 +1,4 @@
1
- require "sandbox_assets/test_asset"
1
+ require_dependency "sandbox_assets/test_asset"
2
2
 
3
3
  module SandboxAssets
4
4
  class BaseController < ActionController::Base
@@ -24,16 +24,26 @@ module SandboxAssets
24
24
 
25
25
  def extract_template_from_params
26
26
  @template ||= params[:template] unless cfg.disable_template_param
27
+ @iframe_template ||= params[:iframe_template] unless cfg.disable_template_param
27
28
  end
28
29
 
29
30
  def render_template
31
+ (render_iframe_template; return) if params[:action] == 'iframe'
30
32
  render @template if template
31
33
  end
32
34
 
35
+ def render_iframe_template
36
+ render @iframe_template if iframe_template
37
+ end
38
+
33
39
  def template
34
40
  @template ||= cfg.template
35
41
  end
36
42
 
43
+ def iframe_template
44
+ @iframe_template ||= cfg.iframe_template
45
+ end
46
+
37
47
  def cfg
38
48
  @cfg ||= Engine.config.sandbox_assets
39
49
  end
@@ -0,0 +1,28 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+
6
+ <title>Test runner</title>
7
+ <% @stylesheets.each do |css| -%>
8
+ <%= stylesheet_link_tag css %>
9
+ <% end -%>
10
+ <%= javascript_include_tag @tests.first %>
11
+ </head>
12
+ <body>
13
+ <p>Override this test runner with your own at app/views/sandbox_assets/test_runner/iframe.html.erb. The test to include is available at @tests.first:</p>
14
+ <ul>
15
+ <li><%= link_to @tests.first, javascript_path(@tests.first) %></li>
16
+ </ul>
17
+ <p>And those stylesheets will be also included:</p>
18
+ <ul>
19
+
20
+ <% @stylesheets.each do |css| -%>
21
+ <li><%= link_to css, stylesheet_path(css) %></li>
22
+ <% end -%>
23
+ </ul>
24
+
25
+ <p>Here is the source for this file (<%= __FILE__ %>):</p>
26
+ <pre style="background-color: lightgreen; color: black"><%= IO.read __FILE__ %></pre>
27
+ </body>
28
+ </html>
data/config/routes.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  SandboxAssets::Engine.routes.draw do
2
2
  mount Rails.application.assets => Rails.configuration.assets.prefix
3
- ['/', '*path'].each do |p|
3
+ get '_iframe/*path' => 'sandbox_assets/test_runner#iframe', format: false,
4
+ as: :sandbox_assets_iframe
5
+ ['', '*path'].each do |p|
4
6
  get p => 'sandbox_assets/test_runner#index', format: false
5
7
  end
6
8
  end
@@ -3,7 +3,7 @@ module SandboxAssets
3
3
  attr_reader :options
4
4
  attr_accessor :tests_roots, :assets_paths, :port,
5
5
  :tests_patterns, :stylesheets_patterns,
6
- :template, :disable_template_param
6
+ :template, :iframe_template, :disable_template_param
7
7
 
8
8
  def initialize
9
9
  @tests_roots = %w(test/javascripts spec/javascripts)
@@ -1,3 +1,3 @@
1
1
  module SandboxAssets
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-sandbox-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Rosenfeld Rosas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-02-26 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,7 @@ files:
38
38
  - Rakefile
39
39
  - app/controllers/sandbox_assets/base_controller.rb
40
40
  - app/controllers/sandbox_assets/test_runner_controller.rb
41
+ - app/views/sandbox_assets/test_runner/iframe.html.erb
41
42
  - app/views/sandbox_assets/test_runner/index.html.erb
42
43
  - config/routes.rb
43
44
  - lib/rails-sandbox-assets.rb
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
68
  version: '0'
68
69
  requirements: []
69
70
  rubyforge_project:
70
- rubygems_version: 2.0.0
71
+ rubygems_version: 2.0.14
71
72
  signing_key:
72
73
  specification_version: 4
73
74
  summary: Allows assets to be served in a sandboxed application in a Rails project