spectacular_rails 1.5.1

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: 2d076eb8ad52b04976424b00a2c1db6cc1b025d4
4
+ data.tar.gz: 99631b0d94b1950e9d17bf59da44064ae1b03844
5
+ SHA512:
6
+ metadata.gz: a40189c5ee350ca9659d84768b71c32429d82469078999b1807ca871314a603ebec3e91a4671fd7c8a9a09bcf355b7838f0e8551ad0cccbb0b837a1470d38213
7
+ data.tar.gz: e86065861f74d4f272fde5d9e5d443604b2ae84b71eb8888d15c7160bf25575667af3a9fa3eff2173531fafea4da36250eb82d05ad58b7ab600aba935a56d27c
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = SpectacularRails
2
+
3
+ Rails Engine that expose routes to run Spectacular tests in browsers through the assets pipeline.
4
+
5
+ == Installation
6
+
7
+ gem install spectacular_rails
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SpectacularRails'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
22
+ require 'rake/testtask'
23
+
24
+ Rake::TestTask.new(:test) do |t|
25
+ t.libs << 'lib'
26
+ t.libs << 'test'
27
+ t.pattern = 'test/**/*_test.rb'
28
+ t.verbose = false
29
+ end
30
+
31
+
32
+ task default: :test
@@ -0,0 +1,19 @@
1
+ #= require jade
2
+ #= require snap
3
+ #= require source-map
4
+ #= require_self
5
+ #= require spectacular
6
+ #= require templates
7
+
8
+ previous_on_load = window.onload
9
+
10
+ spectacular.templates = {}
11
+
12
+ window.onload = ->
13
+ scripts = document.querySelectorAll 'script'
14
+ a = Array::map.call scripts, (s) -> s.attributes.src?.value
15
+
16
+ spectacular.options.paths = a.filter (s) -> s? and s.indexOf('spectacular') is -1
17
+
18
+ do previous_on_load if previous_on_load?
19
+
@@ -0,0 +1,2 @@
1
+ //= require font-awesome/css/font-awesome
2
+ //= require spectacular
@@ -0,0 +1,4 @@
1
+ module SpectacularRails
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,23 @@
1
+ module SpectacularRails
2
+ class SpecController < SpectacularRails::ApplicationController
3
+
4
+ def index
5
+ @spec_options = SpectacularRails.spec_options
6
+ @specsuite = params[:suite].try(:concat, ".spec") || "spec"
7
+ @asset_options = %w(true false).include?(params[:debug]) ? { debug: params[:debug] == 'true' } : {}
8
+ end
9
+
10
+ def fixtures
11
+ format = params[:format]
12
+
13
+ p format
14
+
15
+ if %w(txt dom).include? format
16
+ path = File.new("#{Rails.root}/#{SpectacularRails.fixture_path}/#{params[:filename]}.#{format}").read
17
+ render text: path
18
+ else
19
+ render "#{SpectacularRails.fixture_path}/#{params[:filename]}", layout: false
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ module SpectacularRails
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>SpectacularRails</title>
5
+ <link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300' rel='stylesheet' type='text/css'>
6
+ <%= stylesheet_link_tag "spectacular_rails", media: "all" %>
7
+ <%= stylesheet_link_tag "spec", @asset_options.clone %>
8
+ <script>
9
+ window.spectacular = {
10
+ options: <%= @spec_options.to_json.html_safe %>
11
+ };
12
+ spectacular.options.hasSourceMap = function(file) {
13
+ return /\\.js/.test(file);
14
+ };
15
+ spectacular.options.getSourceURLFor = function(file) {
16
+ return file.replace('.js', '.coffee')
17
+ };
18
+ spectacular.options.getSourceMapURLFor = function(file) {
19
+ return file.replace('.coffee', 'coffee.map')
20
+ };
21
+ </script>
22
+ <%= javascript_include_tag "spectacular_rails" %>
23
+ <%= javascript_include_tag @specsuite, @asset_options.clone %>
24
+ <%= csrf_meta_tags %>
25
+ </head>
26
+ <body>
27
+
28
+ <%= yield %>
29
+
30
+ </body>
31
+ </html>
File without changes
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ SpectacularRails::Engine.routes.draw do
2
+ resources :spec, :controller => 'spec', :only => [:index] do
3
+ get "fixtures/*filename", :action => :fixtures
4
+ end
5
+ get "fixtures/*filename", :to => "spec#fixtures"
6
+ get "/(:suite)", :to => "spec#index"
7
+ root to: 'spec#index'
8
+ end
@@ -0,0 +1,55 @@
1
+
2
+ module SpectacularRails
3
+ # Determine whether or not to mount the SpectacularRails engine implicitly. True/False
4
+ mattr_accessor :mount
5
+ @@mount = true
6
+
7
+ # Specify location at which to mount the engine, default to '/spectacular'
8
+ mattr_accessor :mount_at
9
+ @@mount_at = '/spectacular'
10
+
11
+ # Specify the path for specs, defaults to 'spec'
12
+ mattr_accessor :spec_path
13
+ @@spec_path = 'spec'
14
+
15
+ #Specify the path for fixutures, defaults to 'spec/javascripts/fixtures'
16
+ mattr_accessor :fixture_path
17
+ @@fixture_path = 'spec/javascripts/fixtures'
18
+
19
+ mattr_accessor :spec_options
20
+ @@spec_options = {
21
+ coffee: true,
22
+ verbose: false,
23
+ trace: true,
24
+ longTrace: false,
25
+ showSource: true,
26
+ format: 'documentation',
27
+ random: true,
28
+ seed: nil,
29
+ fixturesRoot: 'spectacular/fixtures'
30
+ }
31
+
32
+ # Default way to setup SpectacularRails. Run rails generate spectacular_rails:install to create
33
+ # a fresh initializer with all configuration values.
34
+ def self.setup
35
+ yield self
36
+ end
37
+
38
+ class Engine < ::Rails::Engine
39
+ isolate_namespace SpectacularRails
40
+
41
+ initializer :assets, :group => :all do |app|
42
+ app.config.assets.paths << Rails.root.join(SpectacularRails.spec_path, "javascripts").to_s
43
+ app.config.assets.paths << Rails.root.join(SpectacularRails.spec_path, "stylesheets").to_s
44
+ end
45
+
46
+ config.after_initialize do |app|
47
+
48
+ app.config.assets.paths << Rails.root.join("vendor", "assets", "font")
49
+
50
+ app.routes.prepend do
51
+ mount SpectacularRails::Engine => SpectacularRails.mount_at
52
+ end if SpectacularRails.mount
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,16 @@
1
+ module SpectacularRails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace SpectacularRails
4
+
5
+ initializer :assets, :group => :all do |app|
6
+ app.config.assets.paths << Rails.root.join(SpectacularRails.spec_path, "javascripts").to_s
7
+ app.config.assets.paths << Rails.root.join(SpectacularRails.spec_path, "stylesheets").to_s
8
+ end
9
+
10
+ config.after_initialize do |app|
11
+ app.routes.prepend do
12
+ mount SpectacularRails::Engine => SpectacularRails.mount_at
13
+ end if SpectacularRails.mount
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module SpectacularRails
2
+ VERSION = "1.5.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :spectacular_rails do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spectacular_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.1
5
+ platform: ruby
6
+ authors:
7
+ - Cédric Néhémie
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.13
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.13
27
+ description: SpectacularRails.
28
+ email:
29
+ - cedric.nehemie@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - app/assets/javascripts/spectacular_rails.js.coffee
35
+ - app/assets/stylesheets/spectacular_rails.css.sass
36
+ - app/controllers/spectacular_rails/application_controller.rb
37
+ - app/controllers/spectacular_rails/spec_controller.rb
38
+ - app/helpers/spectacular_rails/application_helper.rb
39
+ - app/views/layouts/spectacular_rails/application.html.erb
40
+ - app/views/spectacular_rails/spec/index.html.erb
41
+ - config/routes.rb
42
+ - lib/spectacular_rails/engine.rb
43
+ - lib/spectacular_rails/version.rb
44
+ - lib/spectacular_rails.rb
45
+ - lib/tasks/spectacular_rails_tasks.rake
46
+ - MIT-LICENSE
47
+ - Rakefile
48
+ - README.rdoc
49
+ homepage: ''
50
+ licenses: []
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.0.3
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: SpectacularRails.
72
+ test_files: []