jasmine-jstd-conf 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
@@ -0,0 +1,7 @@
1
+ == v0.0.2
2
+
3
+ * Obtain jasmine.js from the jasmine-core gem
4
+
5
+ == v0.0.1
6
+
7
+ * Initial release
@@ -2,6 +2,8 @@
2
2
 
3
3
  Based on jasmine.yml, write a jsTestDriver config file to the supplied path.
4
4
 
5
+ http://travis-ci.org/benjaminoakes/jasmine-jstd-conf.png
6
+
5
7
  == Installation
6
8
 
7
9
  Please see http://rubygems.org/gems/jasmine-jstd-conf
@@ -1,4 +1,10 @@
1
+ # Standard lib
2
+ require 'pathname'
3
+
4
+ # Relative
1
5
  require "jasmine-jstd-conf/version"
6
+
7
+ # Gems
2
8
  require 'rubygems'
3
9
  require 'bundler'
4
10
  require 'jasmine'
@@ -7,16 +13,6 @@ require 'mustache'
7
13
  module Jasmine
8
14
  module JSTD
9
15
  module Conf
10
- # This looks like YAML, but it's hard to be sure...
11
- TEMPLATE = <<EOF
12
- server: {{server}}
13
-
14
- load:
15
- {{#paths}}
16
- - {{.}}
17
- {{/paths}}
18
- EOF
19
-
20
16
  def self.map(doc)
21
17
  paths = doc.js_files
22
18
 
@@ -36,7 +32,7 @@ EOF
36
32
  end
37
33
 
38
34
  def self.render
39
- Mustache.render(TEMPLATE, map(Jasmine::Config.new))
35
+ Mustache.render(raw_mustache('conf'), map(Jasmine::Config.new))
40
36
  end
41
37
 
42
38
  def self.write(path)
@@ -44,43 +40,27 @@ EOF
44
40
  end
45
41
 
46
42
  def self.show_usage
47
- puts <<EOF
48
- Usage: #{$PROGRAM_NAME} path [--help]
49
-
50
- path Path to write to.
51
- --help Show this help text.
52
-
53
- Based on jasmine.yml, write a JSTD config file to the supplied path.
54
-
55
- Example:
56
-
57
- $ #{$PROGRAM_NAME} jsTestDriver.conf
58
- $ cat jsTestDriver.conf
59
- server: http://localhost:9876
60
-
61
- load:
62
- - /path/to/jasmine.js
63
- - spec/javascripts/support/JasmineAdapter.js
64
- - spec/javascripts/helpers/jasmine-jquery-1.3.1.js
65
- - spec/javascripts/FooSpec.js
66
- - spec/javascripts/BarSpec.js
67
- - spec/javascripts/BazSpec.js
68
- - spec/javascripts/QuxSpec.js
69
- # [...]
70
- EOF
43
+ puts Mustache.render(raw_mustache('usage'), {:program_name => $PROGRAM_NAME})
71
44
  exit -1
72
45
  end
73
46
 
74
47
  private
75
48
 
76
49
  def self.jasmine_js_path
77
- "#{locate_gem}/lib/jasmine-core/jasmine.js"
50
+ # jsTestDriver can only use relative paths. Not sure why...
51
+ absolute_path = "#{locate_gem}/lib/jasmine-core/jasmine.js"
52
+ relative_path = Pathname.new(absolute_path).relative_path_from(Pathname.pwd)
53
+ relative_path.to_s
78
54
  end
79
55
 
80
56
  def self.locate_gem
81
57
  spec = Bundler.load.specs.find{|s| s.name == 'jasmine-core' }
82
58
  spec.full_gem_path
83
59
  end
60
+
61
+ def self.raw_mustache(name)
62
+ File.read(File.join(File.dirname(__FILE__), "views/#{name}.mustache"))
63
+ end
84
64
  end
85
65
  end
86
66
  end
@@ -1,7 +1,7 @@
1
1
  module Jasmine
2
2
  module JSTD
3
3
  module Conf
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,6 @@
1
+ server: {{server}}
2
+
3
+ load:
4
+ {{#paths}}
5
+ - {{.}}
6
+ {{/paths}}
@@ -0,0 +1,22 @@
1
+ Usage: {{program_name}} path [--help]
2
+
3
+ path Path to write to.
4
+ --help Show this help text.
5
+
6
+ Based on jasmine.yml, write a JSTD config file to the supplied path.
7
+
8
+ Example:
9
+
10
+ $ {{program_name}} jsTestDriver.conf
11
+ $ cat jsTestDriver.conf
12
+ server: http://localhost:9876
13
+
14
+ load:
15
+ - /path/to/jasmine.js
16
+ - spec/javascripts/support/JasmineAdapter.js
17
+ - spec/javascripts/helpers/jasmine-jquery-1.3.1.js
18
+ - spec/javascripts/FooSpec.js
19
+ - spec/javascripts/BarSpec.js
20
+ - spec/javascripts/BazSpec.js
21
+ - spec/javascripts/QuxSpec.js
22
+ # [...]
@@ -22,10 +22,10 @@ module Jasmine::JSTD
22
22
  rendered.should match(%r{^ - spec/javascripts/BarSpec.rb$})
23
23
  end
24
24
 
25
- it 'includes jasmine.js from the jasmine-core gem' do
25
+ it 'includes jasmine.js from the jasmine-core gem as a relative path' do
26
26
  rendered = render
27
27
 
28
- md = rendered.match(%r{^ - (/.*?/jasmine.js)$})
28
+ md = rendered.match(%r{^ - (../.*?/jasmine.js)$})
29
29
  md.should_not be_nil
30
30
  jasmine_js_path = md[1]
31
31
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jasmine-jstd-conf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Benjamin Oakes
@@ -103,6 +103,8 @@ files:
103
103
  - .gitignore
104
104
  - .rspec
105
105
  - .rvmrc
106
+ - .travis.yml
107
+ - CHANGELOG.rdoc
106
108
  - Gemfile
107
109
  - MIT-LICENSE
108
110
  - README.rdoc
@@ -112,6 +114,8 @@ files:
112
114
  - jasmine-jstd-conf.gemspec
113
115
  - lib/jasmine-jstd-conf.rb
114
116
  - lib/jasmine-jstd-conf/version.rb
117
+ - lib/views/conf.mustache
118
+ - lib/views/usage.mustache
115
119
  - spec/lib/conf_spec.rb
116
120
  - spec/spec_helper.rb
117
121
  has_rdoc: true