jasnode 0.2.0.0 → 0.4.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
- .DS_Store
1
+ .DS_Store
2
+ pkg/
data/README.md CHANGED
@@ -4,6 +4,48 @@ Inspired by [node-jasmine](http://github.com/mhevery/jasmine-node), Angrybits Ja
4
4
 
5
5
  ## Getting Started
6
6
 
7
+ Grab the gem
8
+
9
+ $ [sudo] gem install jasnode
10
+
11
+ Create a project template
12
+
13
+ $ jasnode MyProject
14
+
15
+ This will create the following hierarchy
16
+
17
+ MyProject
18
+ |-- bin
19
+ | `-- hello_world <- replace with your main executable
20
+ |-- lib
21
+ | `-- server.js <- your libraries go here
22
+ |-- Rakefile
23
+ `-- spec
24
+ |-- README.md
25
+ |-- runner.js <- you'll need to add your libraries here
26
+ |-- server
27
+ | |-- server_spec.js <- test specs, replace with your own
28
+ | `-- spec_server.js
29
+ `-- spec.js
30
+
31
+ You can then run the jasmine tests using node
32
+
33
+ $ cd MyProject
34
+ $ jasnoda spec
35
+
36
+ You can also use common rake tasks
37
+
38
+ $ rake
39
+ $ rake test
40
+ $ rake cruise
41
+ $ rake examples
42
+
43
+ All of these map to
44
+
45
+ $ jasnoda spec
46
+
47
+ The exit value is the number of failures, so 0 in the success case, so this should play nicely with CI and other tools.
48
+
7
49
  ## License
8
50
 
9
51
  Copyright (c) 2010 Cory Ondrejka
data/Rakefile CHANGED
@@ -29,6 +29,4 @@ Jeweler::Tasks.new do |gemspec|
29
29
  gemspec.authors = ["Cory Ondrejka"]
30
30
  gemspec.executables = ["jasnode"]
31
31
  gemspec.files.include %w( jasmine/**/* )
32
- end
33
-
34
- Jeweler::GemcutterTasks.new
32
+ end
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :patch: 0
3
3
  :major: 0
4
4
  :build: 0
5
- :minor: 2
5
+ :minor: 4
data/bin/jasnode CHANGED
@@ -21,7 +21,7 @@ program :version, get_version
21
21
  program :description, 'Easy Jasmine BDD with Node.js'
22
22
  program :formatter, :compact
23
23
 
24
- default_command :spec
24
+ default_command :help
25
25
 
26
26
  command :spec do |c|
27
27
  c.syntax = 'jasnode spec [options]'
@@ -35,7 +35,13 @@ command :spec do |c|
35
35
  options.log = true
36
36
  end
37
37
  options.default :logfile => "logfile.txt"
38
- puts Jasnode::Spec.spec(options.verbose, options.log ? options.logfile : nil)
38
+ results = Jasnode::Spec.spec(options.verbose, options.log ? options.logfile : nil)
39
+ puts results
40
+ if results =~ /(\d+) failure/
41
+ exit($1.to_i)
42
+ else
43
+ exit(-1)
44
+ end
39
45
  end
40
46
  end
41
47
 
@@ -47,6 +53,23 @@ command :init do |c|
47
53
  projectname = args.shift or raise 'Project name required'
48
54
  Jasnode::Init.template(projectname)
49
55
  say "Project template initialized at `#{projectname}'"
56
+ say <<-eos
57
+
58
+ #{projectname}
59
+ |-- bin
60
+ | `-- hello_world <- replace with your main executable
61
+ |-- lib
62
+ | `-- server.js <- your libraries go here
63
+ |-- Rakefile
64
+ `-- spec
65
+ |-- README.md
66
+ |-- runner.js <- you'll need to add your libraries here
67
+ |-- server
68
+ | |-- server_spec.js <- test specs, replace with your own
69
+ | `-- spec_server.js
70
+ `-- spec.js
71
+
72
+ eos
50
73
  end
51
74
  end
52
75
 
@@ -1,5 +1,7 @@
1
1
  # Copyright (c) 2010 Cory Ondrejka. All rights reserved.
2
2
  # See MIT.LICENSE for licensing details.
3
+ require 'fileutils.rb'
4
+
3
5
  JASNODE_BIN = File.join(File.dirname(__FILE__), '..', '..', 'bin')
4
6
 
5
7
  Given /^I am ready to work$/ do
@@ -7,11 +9,10 @@ end
7
9
 
8
10
  When /^I give the jasnode command init "([^\"]*)"$/ do |projectname|
9
11
  @name = projectname
10
- %x[#{JASNODE_BIN}/jasnode init #{@name}].should == "Project template initialized at `#{@name}'\n"
12
+ %x[#{JASNODE_BIN}/jasnode --trace init #{@name}].should == "Project template initialized at `#{@name}'\n"
11
13
  end
12
14
 
13
15
  Then /^I should have a properly populated "([^\"]*)" directory$/ do |arg1|
14
- require "ftools"
15
16
  File.exist?("#{@name}").should == true
16
17
  File.exist?("#{@name}/lib").should == true
17
18
  File.exist?("#{@name}/spec").should == true
data/jasnode.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jasnode}
8
- s.version = "0.2.0.0"
8
+ s.version = "0.4.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Cory Ondrejka"]
@@ -134,7 +134,6 @@ Gem::Specification.new do |s|
134
134
  "lib/jasnode.js",
135
135
  "lib/jasnode.rb",
136
136
  "lib/jasnode/core.rb",
137
- "pkg/jasnode-0.1.0.0.gem",
138
137
  "spec/jasnode/jasnode_spec.rb",
139
138
  "spec/rspec_suite.rb",
140
139
  "spec/spec_helper.rb",
@@ -150,7 +149,7 @@ Gem::Specification.new do |s|
150
149
  s.homepage = %q{http://angrybits.github.com/jasnode}
151
150
  s.rdoc_options = ["--charset=UTF-8"]
152
151
  s.require_paths = ["lib"]
153
- s.rubygems_version = %q{1.3.5}
152
+ s.rubygems_version = %q{1.3.6}
154
153
  s.summary = %q{Jasmine Ruby Runner}
155
154
  s.test_files = [
156
155
  "spec/jasnode/jasnode_spec.rb",
data/lib/jasnode/core.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # Copyright (c) 2010 Cory Ondrejka. All rights reserved.
2
2
  # See MIT.LICENSE for licensing details.
3
+ require 'fileutils.rb'
3
4
 
4
5
  module Jasnode
5
6
  class Spec
@@ -156,13 +157,13 @@ for ( var key in jasmine) {
156
157
  end
157
158
 
158
159
  def self.spec(verbose, logfile)
159
- File.open(File.join("lib", "jasnode.js"), "w") {|f| f.write(Jasnode::Spec.build_jasmine_test_file(Jasnode::Spec.find_jasmine, Jasnode::Spec.find_specs(Dir.pwd), true)) }
160
+ File.open(File.expand_path(File.join("lib", "jasnode.js")), "w") {|f| f.write(Jasnode::Spec.build_jasmine_test_file(Jasnode::Spec.find_jasmine, Jasnode::Spec.find_specs(Dir.pwd), true)) }
160
161
  Dir.chdir("spec")
161
162
  output = ""
162
163
  if logfile
163
164
  output = %x[node runner.js > #{logfile}]
164
165
  else
165
- putput = puts %x[node runner.js]
166
+ output = %x[node runner.js]
166
167
  end
167
168
  Dir.chdir("..")
168
169
  output
@@ -171,9 +172,7 @@ for ( var key in jasmine) {
171
172
 
172
173
  class Init
173
174
  def self.template(projectname)
174
- require "ftools"
175
- template_base = File.join(File.dirname(__FILE__), '..', '..', 'templates')
176
- File.makedirs("#{projectname}")
175
+ template_base = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'templates'))
177
176
  FileUtils.cp_r("#{template_base}/.", "#{projectname}")
178
177
  end
179
178
  end
data/spec/spec_helper.rb CHANGED
@@ -2,5 +2,6 @@
2
2
  # See MIT.LICENSE for licensing details.
3
3
 
4
4
  require 'spec'
5
+ require 'fileutils.rb'
5
6
 
6
7
  require File.join(File.dirname(__FILE__), "../lib/jasnode")
data/templates/Rakefile CHANGED
@@ -1,9 +1,16 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+
4
+ task :default => [:examples]
3
5
 
4
- namespace :spec do
5
- desc 'Run jspec executable specs'
6
- task :bin do
7
- sh 'spec --color --require spec/ruby/bin/spec_helper.rb spec/ruby/bin/*_spec.rb'
8
- end
6
+ task :examples do
7
+ sh 'jasnode spec'
8
+ end
9
+
10
+ task :test do
11
+ sh 'jasnode spec'
12
+ end
13
+
14
+ task :cruise do
15
+ sh 'jasnode spec'
9
16
  end
@@ -1,3 +1,70 @@
1
- # Specs
1
+ # Jasnode
2
2
 
3
- Specs can take the form of spec.js, spec_name.js, or name_spec.js. Any files in this form will be read in the spec hierarchy. Note that files can either live directly in the spec directory or in subdirectories.
3
+ Inspired by [node-jasmine](http://github.com/mhevery/jasmine-node), Angrybits Jasmine is a simple way to use Pivotal's [jasmine](http://github.com/pivotal/jasmine) with [Node.js](http://github.com/ry/node).
4
+
5
+ ## Getting Started
6
+
7
+ Grab the gem
8
+
9
+ $ [sudo] gem install jasnode
10
+
11
+ Create a project template
12
+
13
+ $ jasnode MyProject
14
+
15
+ This will create the following hierarchy
16
+
17
+ MyProject
18
+ |-- bin
19
+ | `-- hello_world <- replace with your main executable
20
+ |-- lib
21
+ | `-- server.js <- your libraries go here
22
+ |-- Rakefile
23
+ `-- spec
24
+ |-- README.md <- this file
25
+ |-- runner.js <- you'll need to add your libraries here
26
+ |-- server
27
+ | |-- server_spec.js <- test specs, replace with your own
28
+ | `-- spec_server.js
29
+ `-- spec.js
30
+
31
+ You can then run the jasmine tests using node
32
+
33
+ $ cd MyProject
34
+ $ jasnoda spec
35
+
36
+ You can also use common rake tasks
37
+
38
+ $ rake
39
+ $ rake test
40
+ $ rake cruise
41
+ $ rake examples
42
+
43
+ All of these map to
44
+
45
+ $ jasnoda spec
46
+
47
+ The exit value is the number of failures, so 0 in the success case, so this should play nicely with CI and other tools.
48
+
49
+ ## License
50
+
51
+ Copyright (c) 2010 Cory Ondrejka
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining
54
+ a copy of this software and associated documentation files (the
55
+ "Software"), to deal in the Software without restriction, including
56
+ without limitation the rights to use, copy, modify, merge, publish,
57
+ distribute, sublicense, and/or sell copies of the Software, and to
58
+ permit persons to whom the Software is furnished to do so, subject to
59
+ the following conditions:
60
+
61
+ The above copyright notice and this permission notice shall be
62
+ included in all copies or substantial portions of the Software.
63
+
64
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
65
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
66
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
67
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
68
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
69
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
70
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasnode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 0
9
+ - 0
10
+ version: 0.4.0.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Cory Ondrejka
@@ -138,7 +144,6 @@ files:
138
144
  - lib/jasnode.js
139
145
  - lib/jasnode.rb
140
146
  - lib/jasnode/core.rb
141
- - pkg/jasnode-0.1.0.0.gem
142
147
  - spec/jasnode/jasnode_spec.rb
143
148
  - spec/rspec_suite.rb
144
149
  - spec/spec_helper.rb
@@ -163,18 +168,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
168
  requirements:
164
169
  - - ">="
165
170
  - !ruby/object:Gem::Version
171
+ segments:
172
+ - 0
166
173
  version: "0"
167
- version:
168
174
  required_rubygems_version: !ruby/object:Gem::Requirement
169
175
  requirements:
170
176
  - - ">="
171
177
  - !ruby/object:Gem::Version
178
+ segments:
179
+ - 0
172
180
  version: "0"
173
- version:
174
181
  requirements: []
175
182
 
176
183
  rubyforge_project:
177
- rubygems_version: 1.3.5
184
+ rubygems_version: 1.3.6
178
185
  signing_key:
179
186
  specification_version: 3
180
187
  summary: Jasmine Ruby Runner
Binary file