visionmedia-jspec 1.1.1 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/History.rdoc +8 -0
  2. data/README.rdoc +7 -1
  3. data/Rakefile +41 -39
  4. data/bin/jspec +28 -9
  5. data/jspec.gemspec +2 -2
  6. data/lib/jspec.js +7 -13
  7. metadata +2 -2
data/History.rdoc CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ === 1.1.3 / 2009-04-14
3
+
4
+ * Removed /test used for the executable, causing gem to fail building
5
+
6
+ === 1.1.2 / 2009-04-14
7
+
8
+ * Added `jspec update` sub-command [#63]
9
+
2
10
  === 1.1.1 / 2009-04-12
3
11
 
4
12
  * Added gemspec
data/README.rdoc CHANGED
@@ -53,7 +53,13 @@ and much more.
53
53
 
54
54
  Simply download JSpec and include JSpec.css and JSpec.js in your markup.
55
55
  Head over to the downloads section on Github, clone this public repo, or
56
- add JSpec as a git submodule with in your project.
56
+ add JSpec as a git submodule with in your project. Alternatively JSpec is
57
+ also available as a Ruby Gem, which also provides the `jspec` executable. To
58
+ install as a gem simply:
59
+ $ sudo gem install visionmedia-jspec
60
+
61
+ At which point you may:
62
+ $ jspec init myproject
57
63
 
58
64
  JSpec scripts should NOT be referenced via the <script> tag, they should be
59
65
  loaded using the exec method. Below is an example:
data/Rakefile CHANGED
@@ -15,48 +15,50 @@ Echoe.new "jspec", version do |p|
15
15
  p.runtime_dependencies << "visionmedia-commander >=3.2.9"
16
16
  end
17
17
 
18
- desc 'Package'
19
- task :package => [:clear] do
20
- begin
21
- sh 'mkdir pkg'
22
- sh 'cp -fr lib/* pkg'
23
- minify 'lib/jspec.js', 'pkg/jspec.min.js'
24
- minify 'lib/jspec.jquery.js', 'pkg/jspec.jquery.min.js'
25
- compress 'lib/jspec.css', 'pkg/jspec.min.css'
26
- sh 'git add pkg/.'
27
- rescue Exception => e
28
- puts "Failed to package: #{e}."
29
- else
30
- puts "Packaging of JSpec-#{version} completed."
18
+ namespace :pkg do
19
+ desc 'Build package'
20
+ task :build => ['pkg:clear'] do
21
+ begin
22
+ sh 'mkdir pkg'
23
+ sh 'cp -fr lib/* pkg'
24
+ minify 'lib/jspec.js', 'pkg/jspec.min.js'
25
+ minify 'lib/jspec.jquery.js', 'pkg/jspec.jquery.min.js'
26
+ compress 'lib/jspec.css', 'pkg/jspec.min.css'
27
+ sh 'git add pkg/.'
28
+ rescue Exception => e
29
+ puts "Failed to package: #{e}."
30
+ else
31
+ puts "Packaging of JSpec-#{version} completed."
32
+ end
31
33
  end
32
- end
33
-
34
- desc 'Clear packaging'
35
- task :clear do
36
- if File.directory? 'pkg'
37
- sh 'rm -fr pkg/*'
38
- sh 'rmdir pkg'
34
+
35
+ desc 'Clear packaging'
36
+ task :clear do
37
+ if File.directory? 'pkg'
38
+ sh 'rm -fr pkg/*'
39
+ sh 'rmdir pkg'
40
+ end
39
41
  end
40
- end
41
-
42
- desc 'Display compression savings of last release'
43
- task :savings do
44
- totals = Hash.new { |h, k| h[k] = 0 }
45
- format = '%-20s : %0.3f kb'
46
- totals = %w( pkg/jspec.min.js pkg/jspec.jquery.min.js pkg/jspec.min.css ).inject totals do |total, file|
47
- uncompressed = File.size(file.sub('.min', '')).to_f / 1024
48
- compressed = File.size(file).to_f / 1024
49
- saved = uncompressed - compressed
50
- puts format % [file.sub('pkg/', ''), saved]
51
- totals[:saved] += saved
52
- totals[:uncompressed] += uncompressed
53
- totals[:compressed] += compressed
54
- totals
42
+
43
+ desc 'Display compression savings of last release'
44
+ task :savings do
45
+ totals = Hash.new { |h, k| h[k] = 0 }
46
+ format = '%-20s : %0.3f kb'
47
+ totals = %w( pkg/jspec.min.js pkg/jspec.jquery.min.js pkg/jspec.min.css ).inject totals do |total, file|
48
+ uncompressed = File.size(file.sub('.min', '')).to_f / 1024
49
+ compressed = File.size(file).to_f / 1024
50
+ saved = uncompressed - compressed
51
+ puts format % [file.sub('pkg/', ''), saved]
52
+ totals[:saved] += saved
53
+ totals[:uncompressed] += uncompressed
54
+ totals[:compressed] += compressed
55
+ totals
56
+ end
57
+ puts
58
+ puts format % ['total uncompressed', totals[:uncompressed]]
59
+ puts format % ['total compressed', totals[:compressed]]
60
+ puts format % ['total saved', totals[:saved]]
55
61
  end
56
- puts
57
- puts format % ['total uncompressed', totals[:uncompressed]]
58
- puts format % ['total compressed', totals[:compressed]]
59
- puts format % ['total saved', totals[:saved]]
60
62
  end
61
63
 
62
64
  def minify from, to
data/bin/jspec CHANGED
@@ -7,14 +7,15 @@ require 'fileutils'
7
7
  JSPEC_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
8
8
 
9
9
  program :name, 'JSpec'
10
- program :version, '1.1.1'
10
+ program :version, '1.1.3'
11
11
  program :description, 'JavaScript BDD Testing Framework'
12
12
  default_command :bind
13
13
 
14
14
  command :init do |c|
15
- c.syntax = 'jspec init [dest] [options]'
15
+ c.syntax = 'jspec init [dest]'
16
16
  c.summary = 'Initialize a JSpec project template'
17
- c.description = 'Initialize a JSpec project template. Defaults to the current directory when <dest> is not specified.'
17
+ c.description = 'Initialize a JSpec project template. Defaults to the current directory when
18
+ <dest> is not specified.'
18
19
  c.example 'Create a directory foo, initialized with a jspec template', 'jspec init foo'
19
20
  c.when_called do |args, options|
20
21
  dest = args.shift || '.'
@@ -24,18 +25,36 @@ command :init do |c|
24
25
  FileUtils.mkdir_p dest
25
26
  FileUtils.cp_r File.join(JSPEC_ROOT, 'templates', 'default', '.'), dest
26
27
  spec = File.join dest, 'spec', 'spec.html'
27
- contents = File.read spec
28
- File.open(spec, 'w') { |file| file.write contents.gsub('JSPEC_ROOT', JSPEC_ROOT) }
29
- say "Template initialized at '#{dest}'."
28
+ contents = File.read(spec).gsub 'JSPEC_ROOT', JSPEC_ROOT
29
+ File.open(spec, 'w') { |file| file.write contents }
30
+ say "Template initialized at '#{dest}'"
31
+ end
32
+ end
33
+
34
+ command :update do |c|
35
+ c.syntax = 'jspec update [path ...]'
36
+ c.summary = 'Update JSpec releases'
37
+ c.description = 'Update JSpec release in [paths], this will allow you to utilize the latest
38
+ JSpec features. If you have suites running at a path other than the regular
39
+ spec/spec.html simply pass them as arguments to this sub-command.'
40
+ c.when_called do |args, options|
41
+ args = %w( spec/spec.html ) if args.empty?
42
+ args.each do |path|
43
+ next unless File.exists? path
44
+ contents = File.read(path).gsub /visionmedia-jspec-(\d+\.\d+\.\d+)/, "visionmedia-jspec-#{program(:version)}"
45
+ File.open(path, 'r+'){ |file| file.write contents }
46
+ say "Updated #{path} to JSpec #{program(:version)}"
47
+ end
30
48
  end
31
49
  end
32
50
 
33
51
  command :run do |c|
34
52
  c.syntax = 'jspec run [path] [options]'
35
53
  c.summary = 'Run specifications'
36
- c.description = 'Run specifications, defaulting <path> to spec/spec.html. You will need supply <path>
37
- if your specs do not reside in this location. `run --bind` is the default sub-command of jspec so you
38
- may simply execute `jspec` in order to bind execution of your specs when a file is altered.'
54
+ c.description = 'Run specifications, defaulting [path] to spec/spec.html. You will need
55
+ supply [path] if your specs do not reside in this location. `run --bind` is
56
+ the default sub-command of jspec so you may simply execute `jspec` in order
57
+ to bind execution of your specs when a file is altered.'
39
58
  c.example 'Run once in Safari', 'jspec run'
40
59
  c.example 'Run once in Safari and Firefox', 'jspec run --browsers Safari,Firefox'
41
60
  c.example 'Run custom spec file', 'jspec run foo.html'
data/jspec.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{jspec}
5
- s.version = "1.1.1"
5
+ s.version = "1.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
9
- s.date = %q{2009-04-12}
9
+ s.date = %q{2009-04-14}
10
10
  s.default_executable = %q{jspec}
11
11
  s.description = %q{JavaScript BDD Testing Framework}
12
12
  s.email = %q{tj@vision-media.ca}
data/lib/jspec.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  JSpec = {
7
7
 
8
- version : '1.1.1',
8
+ version : '1.1.3',
9
9
  main : this,
10
10
  suites : [],
11
11
  matchers : {},
@@ -172,15 +172,12 @@
172
172
  markup += '<tr class="description"><td colspan="2">' + suite.description + '</td></tr>'
173
173
  each(suite.specs, function(i, spec){
174
174
  markup += '<tr class="' + (i % 2 ? 'odd' : 'even') + '">'
175
- if (spec.requiresImplementation() && !failuresOnly) {
175
+ if (spec.requiresImplementation() && !failuresOnly)
176
176
  markup += '<td class="requires-implementation" colspan="2">' + spec.description + '</td>'
177
- }
178
- else if (spec.passed() && !failuresOnly) {
177
+ else if (spec.passed() && !failuresOnly)
179
178
  markup += '<td class="pass">' + spec.description+ '</td><td>' + spec.assertionsGraph() + '</td>'
180
- }
181
- else if(!spec.passed()) {
179
+ else if(!spec.passed())
182
180
  markup += '<td class="fail">' + spec.description + ' <em>' + spec.failure().message + '</em>' + '</td><td>' + spec.assertionsGraph() + '</td>'
183
- }
184
181
  markup += '<tr class="body" style="display: none;"><td colspan="2">' + spec.body + '</td></tr>'
185
182
  })
186
183
  markup += '</tr>'
@@ -777,13 +774,10 @@
777
774
  request.send(null)
778
775
  if (request.readyState == 4) return request.responseText
779
776
  }
780
- else if ('load' in this.main) {
781
- // TODO: workaround for IO issue / preprocessing
782
- load(file)
783
- }
784
- else {
777
+ else if ('load' in this.main)
778
+ load(file) // TODO: workaround for IO issue / preprocessing
779
+ else
785
780
  error('cannot load ' + file)
786
- }
787
781
  },
788
782
 
789
783
  /**
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visionmedia-jspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-12 00:00:00 -07:00
12
+ date: 2009-04-14 00:00:00 -07:00
13
13
  default_executable: jspec
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency