Skip to content

Commit

Permalink
Alias to_script_tag and to_link_tag to script_tag and link_tag respec…
Browse files Browse the repository at this point in the history
…tively. Deprecate the former.
  • Loading branch information
tobie committed Jul 22, 2009
1 parent b1eb4c6 commit b811722
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/unittest_js/builder/fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def initialize(name, options)
end

def to_s
exists? ? to_link_tag(rel_filepath) : ''
exists? ? link_tag(rel_filepath) : ''
end
end

Expand All @@ -52,7 +52,7 @@ def initialize(name, options)
end

def to_s
exists? ? to_script_tag(rel_filepath) : ''
exists? ? script_tag(rel_filepath) : ''
end
end
end
Expand Down
10 changes: 7 additions & 3 deletions lib/unittest_js/builder/html_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
module UnittestJS
module Builder
module HtmlHelper
def to_script_tag(filename)
def script_tag(filename)
"<script src=\"#{filename}?#{cache_buster}\" type=\"text/javascript\" charset=\"utf-8\"></script>"
end

def to_link_tag(filename)
# for backwards compatibility:
alias :to_script_tag :script_tag

def link_tag(filename)
"<link rel=\"stylesheet\" href=\"#{filename}?#{cache_buster}\" type=\"text/css\" />"
end
# for backwards compatibility:
alias :to_link_tag :link_tag

def cache_buster
@cache_buster ||= Time.now.to_i.to_s
Expand Down
8 changes: 4 additions & 4 deletions lib/unittest_js/builder/test_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def css_fixtures
end

def test_file
to_script_tag("#{@options.output_tests_dir.name}/#{filename}")
script_tag("#{@options.output_tests_dir.name}/#{filename}")
end

def timestamp
Expand All @@ -37,9 +37,9 @@ def timestamp
def lib_files
assets = @options.output_unittest_assets_dir.name
[
to_script_tag("#{assets}/prototype.js"),
to_script_tag("#{assets}/unittest.js"),
to_link_tag("#{assets}/unittest.css")
script_tag("#{assets}/prototype.js"),
script_tag("#{assets}/unittest.js"),
link_tag("#{assets}/unittest.css")
].join("\n")
end

Expand Down

0 comments on commit b811722

Please sign in to comment.