Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

optional filename-argument for the yUMLmeRails:download (needs rake >…

…= 0.8.0)
  • Loading branch information...
commit a19b247b82431967d045677ac6d0ca5b3e5916d5 1 parent bda981e
@rwoeber rwoeber authored committed
Showing with 11 additions and 10 deletions.
  1. +2 −1  README.markdown
  2. +9 −9 tasks/yUMLmeRails.rake
3  README.markdown
@@ -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
View
18 tasks/yUMLmeRails.rake
@@ -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
@@ -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
-
-
-
+
Please sign in to comment.
Something went wrong with that request. Please try again.