teaspoon 1.0.1 → 1.0.2

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: 17feb8da692ba7ff472c5bf6d3735085ab3ad6e4
4
- data.tar.gz: 33e3ca26a7d1d24b20238eeebeb8b679d6751dd2
3
+ metadata.gz: c6947cdfc11c4b82dfb1c0db440b2effbcaa2b69
4
+ data.tar.gz: 0d792be5439b2f8b55c458620556e0ee9030aca4
5
5
  SHA512:
6
- metadata.gz: 912fef66a4bb0eb74c877c821c1b7e4ad0dd20a30897e6de8e5c95392085424b8a0e7f0a58c917fe01154353c8d9aac3d377f301b01186ec14184bf78883ae13
7
- data.tar.gz: 1e09ccfd90a16392134f958350f3eb41b7bd70e042896852a5b0df9c8c3bdd79848fbce9f2c5b55ec34f465fc2f80ea1fbbda0d8ddd82f4d6ae7710f2fe51e79
6
+ metadata.gz: eb2cc7fb2e22d878e9f6a5877ddc71b8c21c7b004d17b1dfc76e3d6ea8e2fad666f9927cfe9b532fec219963ed27d21a0abb0dc3d712007b0057bf0a7a42a544
7
+ data.tar.gz: d7eab6abba8e2479aad8fe1551ea1e3c3358fe1b54b9cf8262acc7504f992e7df6ba392996b869f9458a6733eaf9d33160f6df4169695c713f65f5b20914280e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 1.0.2 (5/5/15)
4
+
5
+ #### Bug Fixes
6
+
7
+ * Use a more robust phantomjs polyfill (#360)
8
+ * Revive support for 1.9.3 (#361)
9
+
3
10
 
4
11
  ### 1.0.1 (5/5/15)
5
12
 
@@ -0,0 +1,35 @@
1
+ (function() {
2
+
3
+ var Ap = Array.prototype;
4
+ var slice = Ap.slice;
5
+ var Fp = Function.prototype;
6
+
7
+ if (!Fp.bind) {
8
+ // PhantomJS doesn't support Function.prototype.bind natively, so
9
+ // polyfill it whenever this module is required.
10
+ Fp.bind = function(context) {
11
+ var func = this;
12
+ var args = slice.call(arguments, 1);
13
+
14
+ function bound() {
15
+ var invokedAsConstructor = func.prototype && (this instanceof func);
16
+ return func.apply(
17
+ // Ignore the context parameter when invoking the bound function
18
+ // as a constructor. Note that this includes not only constructor
19
+ // invocations using the new keyword but also calls to base class
20
+ // constructors such as BaseClass.call(this, ...) or super(...).
21
+ !invokedAsConstructor && context || this,
22
+ args.concat(slice.call(arguments))
23
+ );
24
+ }
25
+
26
+ // The bound function must share the .prototype of the unbound
27
+ // function so that any object created by one constructor will count
28
+ // as an instance of both constructors.
29
+ bound.prototype = func.prototype;
30
+
31
+ return bound;
32
+ };
33
+ }
34
+
35
+ })();
@@ -1,109 +1,101 @@
1
1
  module Teaspoon
2
2
  class Error < StandardError
3
+ protected
4
+
5
+ def build_message(msg_or_options)
6
+ if msg_or_options.is_a?(String)
7
+ msg_or_options
8
+ else
9
+ yield msg_or_options
10
+ end
11
+ end
3
12
  end
4
13
 
5
14
  class Failure < Teaspoon::Error
6
15
  end
7
16
 
8
17
  class EnvironmentNotFound < Teaspoon::Error
9
- def initialize(msg = nil, searched:)
10
- msg ||= "Unable to locate environment; searched in [#{searched}]. Have you run the installer?"
11
- super(msg)
18
+ def initialize(msg_or_options)
19
+ super(build_message(msg_or_options) do |options|
20
+ "Unable to locate environment; searched in [#{options[:searched]}]. Have you run the installer?"
21
+ end)
12
22
  end
13
23
  end
14
24
 
15
25
  # loading / configuration errors
16
26
 
17
27
  class UnknownFramework < Teaspoon::Error
18
- def initialize(msg = nil, name:, available:)
19
- msg ||= "Unknown framework: expected \"#{name}\" to be a registered framework. Available frameworks are #{available}."
20
- if available.blank?
21
- msg += " Do you need to update your Gemfile to use the teaspoon-#{name} gem? If you are upgrading, please see https://github.com/modeset/teaspoon/blob/master/CHANGELOG.md"
22
- end
23
- super(msg)
24
- end
25
-
26
- def available
28
+ def initialize(msg_or_options)
29
+ super(build_message(msg_or_options) do |options|
30
+ msg = "Unknown framework: expected \"#{options[:name]}\" to be a registered framework. Available frameworks are #{options[:available]}."
31
+ if options[:available].blank?
32
+ msg += " Do you need to update your Gemfile to use the teaspoon-#{options[:name]} gem? If you are upgrading, please see https://github.com/modeset/teaspoon/blob/master/CHANGELOG.md"
33
+ end
34
+ end)
27
35
  end
28
36
  end
29
37
 
30
38
  class UnknownFrameworkVersion < Teaspoon::Error
31
- def initialize(msg = nil, name:, version:)
32
- msg ||= "Unknown framework version: expected \"#{name}\" to have version #{version}."
33
- super(msg)
34
- end
35
-
36
- def available
39
+ def initialize(msg_or_options)
40
+ super(build_message(msg_or_options) do |options|
41
+ "Unknown framework version: expected \"#{options[:name]}\" to have version #{options[:version]}."
42
+ end)
37
43
  end
38
44
  end
39
45
 
40
46
  class UnknownDriver < Teaspoon::Error
41
- def initialize(msg = nil, name:, available:)
42
- msg ||= "Unknown driver: expected \"#{name}\" to be a registered driver. Available drivers are #{available}"
43
- super(msg)
44
- end
45
-
46
- def available
47
+ def initialize(msg_or_options)
48
+ super(build_message(msg_or_options) do |options|
49
+ "Unknown driver: expected \"#{options[:name]}\" to be a registered driver. Available drivers are #{options[:available]}"
50
+ end)
47
51
  end
48
52
  end
49
53
 
50
54
  class UnknownFormatter < Teaspoon::Error
51
- def initialize(msg = nil, name:, available:)
52
- msg ||= "Unknown formatter: expected \"#{name}\" to be a registered formatter. Available formatters are #{available}"
53
- super(msg)
54
- end
55
-
56
- def available
55
+ def initialize(msg_or_options)
56
+ super(build_message(msg_or_options) do |options|
57
+ "Unknown formatter: expected \"#{options[:name]}\" to be a registered formatter. Available formatters are #{options[:available]}"
58
+ end)
57
59
  end
58
60
  end
59
61
 
60
62
  class UnspecifiedFramework < Teaspoon::Error
61
- def initialize(msg = nil, name:)
62
- msg ||= "Missing framework: expected \"#{name}\" suite to configure one using `suite.use_framework`."
63
- super(msg)
64
- end
65
-
66
- def available
63
+ def initialize(msg_or_options)
64
+ super(build_message(msg_or_options) do |options|
65
+ "Missing framework: expected \"#{options[:name]}\" suite to configure one using `suite.use_framework`."
66
+ end)
67
67
  end
68
68
  end
69
69
 
70
70
  class UnspecifiedDependencies < Teaspoon::Error
71
- def initialize(msg = nil, framework:, version:)
72
- msg ||= "Missing dependencies: expected framework \"#{framework}\" (#{version}) to specify the `dependencies` option when registering."
73
- super(msg)
74
- end
75
-
76
- def available
71
+ def initialize(msg_or_options)
72
+ super(build_message(msg_or_options) do |options|
73
+ "Missing dependencies: expected framework \"#{options[:framework]}\" (#{options[:version]}) to specify the `dependencies` option when registering."
74
+ end)
77
75
  end
78
76
  end
79
77
 
80
78
  class UnknownSuite < Teaspoon::Error
81
- def initialize(msg = nil, name:)
82
- msg ||= "Unknown suite configuration: expected \"#{name}\" to be a configured suite."
83
- super(msg)
84
- end
85
-
86
- def available
79
+ def initialize(msg_or_options)
80
+ super(build_message(msg_or_options) do |options|
81
+ "Unknown suite configuration: expected \"#{options[:name]}\" to be a configured suite."
82
+ end)
87
83
  end
88
84
  end
89
85
 
90
86
  class UnknownCoverage < Teaspoon::Error
91
- def initialize(msg = nil, name:)
92
- msg ||= "Unknown coverage configuration: expected \"#{name}\" to be a configured coverage."
93
- super(msg)
94
- end
95
-
96
- def available
87
+ def initialize(msg_or_options)
88
+ super(build_message(msg_or_options) do |options|
89
+ "Unknown coverage configuration: expected \"#{options[:name]}\" to be a configured coverage."
90
+ end)
97
91
  end
98
92
  end
99
93
 
100
94
  class NotFoundInRegistry < Teaspoon::Error
101
- def initialize(msg = nil, name:, available:)
102
- msg ||= "Unknown configuration: expected \"#{name}\" to be registered. Available options are #{available}"
103
- super(msg)
104
- end
105
-
106
- def available
95
+ def initialize(msg_or_options)
96
+ super(build_message(msg_or_options) do |options|
97
+ "Unknown configuration: expected \"#{options[:name]}\" to be registered. Available options are #{options[:available]}"
98
+ end)
107
99
  end
108
100
  end
109
101
 
@@ -130,23 +122,26 @@ module Teaspoon
130
122
  end
131
123
 
132
124
  class ServerError < Teaspoon::Error
133
- def initialize(msg = nil, desc: nil)
134
- msg ||= "Unable to start teaspoon server; #{desc || 'for an unknown reason'}."
135
- super(msg)
125
+ def initialize(msg_or_options)
126
+ super(build_message(msg_or_options) do |options|
127
+ "Unable to start teaspoon server; #{options[:desc] || 'for an unknown reason'}."
128
+ end)
136
129
  end
137
130
  end
138
131
 
139
132
  class DriverOptionsError < Teaspoon::Error
140
- def initialize(msg = nil, types: nil)
141
- msg ||= "Malformed driver options#{types ? ": expected a valid #{types}." : '.'}"
142
- super(msg)
133
+ def initialize(msg_or_options)
134
+ super(build_message(msg_or_options) do |options|
135
+ "Malformed driver options#{options[:types] ? ": expected a valid #{options[:types]}." : '.'}"
136
+ end)
143
137
  end
144
138
  end
145
139
 
146
140
  class AssetNotServableError < Teaspoon::Error
147
- def initialize(msg = nil, filename: nil)
148
- msg ||= "Unable to serve asset: expected \"#{filename || 'unknown file'}\" to be within a registered asset path."
149
- super(msg)
141
+ def initialize(msg_or_options)
142
+ super(build_message(msg_or_options) do |options|
143
+ "Unable to serve asset: expected \"#{options[:filename] || 'unknown file'}\" to be within a registered asset path."
144
+ end)
150
145
  end
151
146
  end
152
147
 
@@ -20,7 +20,10 @@ module Teaspoon
20
20
  name.present? ? @_framework_name ||= name.to_sym : @_framework_name
21
21
  end
22
22
 
23
- def register_version(version, js_runner, dependencies: [], dev_deps: [])
23
+ def register_version(version, js_runner, options = {})
24
+ dependencies = options[:dependencies] || []
25
+ dev_deps = options[:dev_deps] || []
26
+
24
27
  if ENV["TEASPOON_DEVELOPMENT"] && dev_deps.any?
25
28
  dependencies = dev_deps
26
29
  end
@@ -1,3 +1,3 @@
1
1
  module Teaspoon
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -21,9 +21,15 @@ module Teaspoon
21
21
  end
22
22
  end
23
23
 
24
- def self.setup_framework_tasks(framework:, framework_name:, framework_const:, framework_root:, compile_assets:)
24
+ def self.setup_framework_tasks(options)
25
25
  extend Rake::DSL
26
26
 
27
+ framework = options[:framework]
28
+ framework_name = options[:framework_name]
29
+ framework_const = options[:framework_const]
30
+ framework_root = options[:framework_root]
31
+ compile_assets = options[:compile_assets]
32
+
27
33
  namespace :teaspoon do
28
34
  namespace framework do
29
35
  desc "Run the #{framework_name} code examples"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teaspoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jejacks0n
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-05-05 00:00:00.000000000 Z
14
+ date: 2015-05-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: railties
@@ -46,6 +46,7 @@ files:
46
46
  - MIT.LICENSE
47
47
  - README.md
48
48
  - app/assets/javascripts/support/bind-poly.js
49
+ - app/assets/javascripts/support/phantomjs-shims.js
49
50
  - app/assets/javascripts/support/sinon.js
50
51
  - app/assets/javascripts/teaspoon-filterer.js
51
52
  - app/assets/javascripts/teaspoon/error.coffee