teaspoon-bundle 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6293886438f754a8f2bb97120a4eb25f827789e7
4
+ data.tar.gz: ce51b7ae49f4d10881f59b04802bd5f53939f215
5
+ SHA512:
6
+ metadata.gz: bd4f0a9c93321280fdbc71f4167b6cb72924216a395226124ba02d3f8b079b0a1b591b07253c7d4be6b49ea7c6cb2eef182ae34df81f558e66f520c7c8ba3f60
7
+ data.tar.gz: ff3daf2962f8b21a9b57243651804cc4edbae5c1ecd0d58c32c474464a276c384e1a89b0272efc819258d5a3fc7adcbc7522908d3ca301be5da55e1eba0d7cdd
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Shopify Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # Teaspoon::Bundle
2
+
3
+ A Teaspoon boot partial and controller that serves up all the test assets into a single JavaScript bundle.
4
+
5
+ ## Usage
6
+
7
+ 1. Add `teaspoon-bundle` to your `Gemfile` and run `bundle install`.
8
+ 2. Add `suite.boot_partial = "bundle_boot"` to your `teaspoon_env.rb`.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :spec
@@ -0,0 +1,17 @@
1
+ module Teaspoon::Bundle
2
+ class BundleController < ActionController::Base
3
+ def serve
4
+ file = File.join(Teaspoon::Bundle.dir, 'teaspoon_bundle.js.erb')
5
+ File.write(file, contents)
6
+
7
+ asset = Rails.application.assets.find_asset(file)
8
+ render js: asset.to_s
9
+ end
10
+
11
+ private
12
+ def contents
13
+ @suite = Teaspoon::Suite.new(params)
14
+ contents = %Q{<% #{JSON.dump(@suite.spec_assets)}.each {|path| require_asset(path)} %>}
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ <%= content_tag(:script, "", src: "/teaspoon_bundle/#{@suite.name}?#{params.slice(:file).to_query}") %>
2
+
3
+ <script type="text/javascript">
4
+ Teaspoon.onWindowLoad(Teaspoon.execute);
5
+ </script>
data/bin/setup ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ pushd test/demo > /dev/null
8
+ bundle install
9
+ popd > /dev/null
data/bin/test ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -e
3
+ pushd test/demo>/dev/null
4
+ bundle exec rake teaspoon
5
+ popd>/dev/null
@@ -0,0 +1,24 @@
1
+ require 'teaspoon/bundle'
2
+
3
+ module Teaspoon
4
+ module Bundle
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace ::Teaspoon::Bundle
7
+
8
+ routes do
9
+ match "/:suite", to: 'bundle#serve', via: :get
10
+ end
11
+
12
+ initializer :assets, group: :all do |app|
13
+ app.config.assets.paths << Teaspoon::Bundle.dir
14
+ end
15
+
16
+ config.after_initialize do |app|
17
+ app.routes.prepend do
18
+ require Teaspoon::Bundle::Engine.root.join("app/controllers/teaspoon/bundle/bundle_controller")
19
+ mount Teaspoon::Bundle::Engine => Teaspoon::Bundle::ENDPOINT, as: 'teaspoon_bundle'
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ module Teaspoon
2
+ module Bundle
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ require 'teaspoon/bundle/version'
2
+
3
+ module Teaspoon
4
+ module Bundle
5
+ ENDPOINT = "/teaspoon_bundle".freeze
6
+
7
+ class << self
8
+ def dir
9
+ @dir ||= Dir.mktmpdir('teaspoon_bundle')
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ require 'teaspoon/bundle/engine'
@@ -0,0 +1 @@
1
+ require 'teaspoon/bundle'
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'teaspoon/bundle/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "teaspoon-bundle"
8
+ spec.version = Teaspoon::Bundle::VERSION
9
+ spec.authors = ["Bouke van der Bijl"]
10
+ spec.email = ["bouke@shopify.com"]
11
+
12
+ spec.summary = %q{Dynamically create a test bundle for Teaspoon that contains all the files}
13
+ spec.description = %q{This gem is boot partial for Teaspoon that puts all the test files into a single bundle}
14
+ spec.homepage = "https://github.com/Shopify/teaspoon-bundle"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_dependency "teaspoon"
31
+ spec.add_development_dependency "bundler", "~> 1.11"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "minitest", "~> 5.0"
34
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: teaspoon-bundle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bouke van der Bijl
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: teaspoon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: This gem is boot partial for Teaspoon that puts all the test files into
70
+ a single bundle
71
+ email:
72
+ - bouke@shopify.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - app/controllers/teaspoon/bundle/bundle_controller.rb
83
+ - app/views/teaspoon/suite/_bundle_boot.html.erb
84
+ - bin/setup
85
+ - bin/test
86
+ - lib/teaspoon-bundle.rb
87
+ - lib/teaspoon/bundle.rb
88
+ - lib/teaspoon/bundle/engine.rb
89
+ - lib/teaspoon/bundle/version.rb
90
+ - teaspoon-bundle.gemspec
91
+ homepage: https://github.com/Shopify/teaspoon-bundle
92
+ licenses:
93
+ - MIT
94
+ metadata:
95
+ allowed_push_host: https://rubygems.org
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.5.1
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Dynamically create a test bundle for Teaspoon that contains all the files
116
+ test_files: []