Skip to content

Commit

Permalink
optional filename-argument for the yUMLmeRails:download (needs rake >…
Browse files Browse the repository at this point in the history
…= 0.8.0)
  • Loading branch information
rwoeber authored and Nelson Silva committed Apr 26, 2010
1 parent bda981e commit a19b247
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ There's also a small Shoes app to display the downloaded diagram.
## Requirements

* Shoes (if you want to use the show-task)
* Rake >= 0.8.0 (or remove the 'arg' in the rake task yUMLmeRails:download)

## Instalation
## Installation

* Just clone this into vendor/plugins

Expand Down
18 changes: 9 additions & 9 deletions tasks/yUMLmeRails.rake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
YUMLME_URL="http://yuml.me/diagram/scruffy/class/"
FILENAME=File.join(RAILS_ROOT, 'doc','diagrams',"model.#{Time.now.strftime('%Y%m%d-%H%M%S')}.png")

def generate_diagram
def generate_diagram(file=FILENAME)
require 'open-uri'
FileUtils.mkdir_p File.dirname(FILENAME)
File.open(FILENAME,'wb') do |f|
FileUtils.mkdir_p File.dirname(file)
File.open(file,'wb') do |f|
f.write(open("#{YUMLME_URL}#{CGI.escape(YUMLmeRails.generate_diagram)}").read)
end
end
Expand All @@ -28,11 +28,11 @@ namespace :yUMLmeRails do
end

desc "Download yUML model diagram #{File.dirname(FILENAME)}"
task :download => :environment do
generate_diagram
end
task :download, :filename, :needs => :environment do |t, args|
args.with_defaults(:filename => FILENAME)
generate_diagram args[:filename]
end

end





0 comments on commit a19b247

Please sign in to comment.