Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

/Library/Ruby/Gems/1.8/gems/showoff-0.2.3

/Users/drnic/Library/Application Support/TextMate/Bundles/Showoff.tmbundle doesn't clone over images; so force it anyway
  • Loading branch information...
commit c186d92919854f7c35fa5fb475fe5647a0283443 1 parent 788ad12
Dr Nic Williams authored
16 Support/bin/showoff_page.rb
View
@@ -4,15 +4,16 @@
class ShowoffPage
- def initialize(file_path, project_path)
+ def initialize(file_path, project_path, tmp_path = "/tmp")
@file_path, @project_path = File.expand_path(file_path), File.expand_path(project_path)
+ @tmp_path = tmp_path
end
def showoff!
project = "textmate-showoff"
section = File.basename(File.dirname(@file_path))
results = {}
- FileUtils.chdir("/tmp") do
+ FileUtils.chdir(@tmp_path) do
FileUtils.rm_rf(project)
FileUtils.cp_r(@project_path, project)
FileUtils.chdir(project) do
@@ -26,11 +27,14 @@ def showoff!
json["sections"] = [ { "section" => solo_page_section } ]
File.open("showoff.json", "w") {|f| f << JSON.dump(json)}
-
FileUtils.rm_rf("static")
- results[:output] = `showoff static`
- results[:error] = results[:output] =~ /error/
- results[:url] = "file://localhost#{FileUtils.pwd}/static/index.html"
+ results[:output] = `showoff static`
+ results[:error] = results[:output] =~ /error/
+ results[:url] = "file://localhost#{FileUtils.pwd}/static/index.html"
+ results[:root_path] = FileUtils.pwd
+
+ FileUtils.mkdir_p("static/#{solo_page_section}/images")
+ Dir[solo_page_section + "/images/*"].each { |f| FileUtils.cp_r f, "static/#{solo_page_section}/images/" }
end
end
results
0  ...s/test-presentation/images/bananajour-example.png → ...st-presentation/one/images/bananajour-example.png
View
File renamed without changes
2  Support/fixtures/test-presentation/one/target_slide.md
View
@@ -8,4 +8,4 @@
!SLIDE center
# Image #
-![Bananajour Example](../images/bananajour-example.png)
+![Bananajour Example](images/bananajour-example.png)
4 Support/spec/showoff_page_spec.rb
View
@@ -13,9 +13,11 @@
results = page.showoff!
results[:url].should =~ %r{file://localhost(/private)?/tmp/textmate-showoff/static/index.html}
results[:error].should be_false
- json = JSON.parse(File.read(File.join(project_path, "showoff.json")))
+ tmp_project_path = results[:root_path]
+ json = JSON.parse(File.read(File.join(tmp_project_path, "showoff.json")))
json["sections"].length.should == 1
json["sections"].first["section"] == "textmate-showoff"
+ File.should be_exist(File.join(tmp_project_path, "static", "textmate-showoff", "images", "bananajour-example.png"))
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.