herbie 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  module Herbie
2
2
  module Helpers
3
-
3
+ private
4
4
  def erb_with_output_buffer(buf = '')
5
5
  @_out_buf, old_buffer = buf, @_out_buf
6
6
  yield
@@ -1,6 +1,6 @@
1
1
  module Herbie
2
2
  module Helpers
3
-
3
+ private
4
4
  def snake_case(string)
5
5
  return string.downcase if string =~ /^[A-Z]+$/
6
6
  string.gsub(/([A-Z]+)(?=[A-Z][a-z]?)|\B[A-Z]/, '_\&') =~ /_*(.*)/
@@ -20,7 +20,7 @@ module Herbie
20
20
  if block_given?
21
21
  erb_concat "#{tag :script, attrs}\n#{capture_erb(&block)}\n</script>"
22
22
  else
23
- source = "/javascripts/#{source}" unless source.nil? || source.match(/^\//)
23
+ source = "/javascripts/#{source}" unless source.nil? || source.match(/^\//) || source.match(/^http/)
24
24
  attrs = attrs.merge({:src => source})
25
25
  "#{tag :script, attrs}</script>"
26
26
  end
data/lib/herbie.rb CHANGED
@@ -3,5 +3,5 @@ require 'herbie/generic_helpers.rb'
3
3
  require 'herbie/html_helpers.rb'
4
4
 
5
5
  module Herbie
6
- VERSION = '0.0.2'
6
+ VERSION = '0.0.3'
7
7
  end
data/spec/herbie_spec.rb CHANGED
@@ -46,6 +46,10 @@ describe Herbie::Helpers do
46
46
  script("/path/to/script.js").should == "<script type=\"text/javascript\" charset=\"utf-8\" src=\"/path/to/script.js\"></script>"
47
47
  end
48
48
 
49
+ it "should output a script with an absolute path to the script if the path provided begins with http" do
50
+ script("http://code.jquery.com/jquery.js").should == "<script type=\"text/javascript\" charset=\"utf-8\" src=\"http://code.jquery.com/jquery.js\"></script>"
51
+ end
52
+
49
53
  it "should output a script element with arbitrary javascript content provided by a block" do
50
54
  pending "Need a mechanism for capturing erb output within a passed block"
51
55
  script_block = Proc.new { "function hello_world(){ console.log(\"hello world!\"); }" }
@@ -71,7 +75,7 @@ describe Herbie::Helpers do
71
75
  pending "Need a mechanism for capturing erb output within a passed block"
72
76
  media = "screen and (min-width:500px)"
73
77
  css_block = Proc.new { "body { font-family:'Helvetica'; }" }
74
- style({:media => media}, &css_block).should == "<script type=\"text/css\" media=\"#{media}\">\n#{capture_erb(&css_block)}\n</script>"
78
+ style({:media => media}, &css_block).should == "<style type=\"text/css\" media=\"#{media}\">\n#{capture_erb(&css_block)}\n</style>"
75
79
  end
76
80
  end
77
81
 
metadata CHANGED
@@ -1,63 +1,72 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: herbie
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.0.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Ben Darlow
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-22 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2011-10-01 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
15
17
  name: rspec
16
- requirement: &70233134684500 !ruby/object:Gem::Requirement
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
17
20
  none: false
18
- requirements:
21
+ requirements:
19
22
  - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '2.6'
23
+ - !ruby/object:Gem::Version
24
+ version: "2.6"
22
25
  type: :development
23
- prerelease: false
24
- version_requirements: *70233134684500
26
+ version_requirements: *id001
25
27
  description: Lovable HTML view helpers for use with ERB.
26
28
  email: ben@kapowaz.net
27
29
  executables: []
30
+
28
31
  extensions: []
32
+
29
33
  extra_rdoc_files: []
30
- files:
34
+
35
+ files:
31
36
  - lib/herbie/erb_helpers.rb
32
37
  - lib/herbie/generic_helpers.rb
33
38
  - lib/herbie/html_helpers.rb
34
39
  - lib/herbie.rb
35
40
  - spec/herbie_spec.rb
36
41
  - spec/spec_helper.rb
42
+ has_rdoc: true
37
43
  homepage: http://github.com/kapowaz/herbie
38
44
  licenses: []
45
+
39
46
  post_install_message:
40
47
  rdoc_options: []
41
- require_paths:
48
+
49
+ require_paths:
42
50
  - lib
43
- required_ruby_version: !ruby/object:Gem::Requirement
51
+ required_ruby_version: !ruby/object:Gem::Requirement
44
52
  none: false
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
48
56
  version: 1.9.2
49
- required_rubygems_version: !ruby/object:Gem::Requirement
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
58
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
55
63
  requirements: []
64
+
56
65
  rubyforge_project:
57
- rubygems_version: 1.8.6
66
+ rubygems_version: 1.6.2
58
67
  signing_key:
59
68
  specification_version: 3
60
69
  summary: herbie
61
- test_files:
70
+ test_files:
62
71
  - spec/herbie_spec.rb
63
72
  - spec/spec_helper.rb