Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed wget-dependecy,

image download into doc/diagrams directory
  • Loading branch information...
commit bda981ef695f178890646dfbbb57432bbc2c5460 1 parent 916a1f4
@rwoeber rwoeber authored committed
Showing with 32 additions and 30 deletions.
  1. +4 −3 README.markdown
  2. +28 −27 tasks/yUMLmeRails.rake
View
7 README.markdown
@@ -1,3 +1,5 @@
+Fork from [dmitry](http://github.com/dmitry/yUMLmeRails/) < [nelsonsilva](http://github.com/nelsonsilva/yUMLmeRails/) to adapt/improve some things (according to my working style).
+
# yUMLmeRails
This is a simple plugin that adds Rake tasks to display model diagrams for RoR apps.
@@ -12,8 +14,7 @@ There's also a small Shoes app to display the downloaded diagram.
## Requirements
- * Shoes
- * wget (I'm using it to dowload the image for now since openuri wasn't found of my URI)
+ * Shoes (if you want to use the show-task)
## Instalation
@@ -21,7 +22,7 @@ There's also a small Shoes app to display the downloaded diagram.
## Usage (rake -T)
- * rake yUMLmeRails:download # Download yUML model diagram
+ * rake yUMLmeRails:download # Download yUML model diagram to doc/diagrams
* rake yUMLmeRails:show # Show model diagram
* rake yUMLmeRails:url # Get yUML URL
View
55 tasks/yUMLmeRails.rake
@@ -1,37 +1,38 @@
YUMLME_URL="http://yuml.me/diagram/scruffy/class/"
-DIR=File.join(Dir.pwd, "diagrams")
-FILENAME="#{DIR}/model_" << Time.new.strftime("%b_%d_%Y") << ".png"
+FILENAME=File.join(RAILS_ROOT, 'doc','diagrams',"model.#{Time.now.strftime('%Y%m%d-%H%M%S')}.png")
-def save_diagram url
- FileUtils.mkdir_p DIR
- system "wget -O #{FILENAME} '#{url}'"
- FILENAME
+def generate_diagram
+ require 'open-uri'
+ FileUtils.mkdir_p File.dirname(FILENAME)
+ File.open(FILENAME,'wb') do |f|
+ f.write(open("#{YUMLME_URL}#{CGI.escape(YUMLmeRails.generate_diagram)}").read)
+ end
end
namespace :yUMLmeRails do
+
desc "Show model diagram"
task :show => :environment do
- filename=save_diagram(YUMLME_URL << YUMLmeRails.generate_diagram)
+ generate_diagram
+
app=File.join(File.dirname(__FILE__), "..", "lib","shoes_app.rb")
- sh %{shoes #{app} #{filename} } do |ok, res|
- puts res
- if !ok
- puts "shoes not found (status = #{res.exitstatus})"
- end
+ sh %{shoes #{app} #{FILENAME} } do |ok, res|
+ puts res
+ puts "shoes not found (status = #{res.exitstatus})" if !ok
end
- end
-
- desc "Get yUML URL"
- task :url => :environment do
- puts YUMLME_URL << YUMLmeRails.generate_diagram
- end
-
- desc "Download yUML model diagram"
- task :download => :environment do
- filename=save_diagram(YUMLME_URL << YUMLmeRails.generate_diagram)
- # TODO - Make the following work
- #require 'open-uri'
- #open(, "wb").
- # write(open("http://yuml.me/diagram/scruffy/class/" << YUMLmeRails.generate_diagram))
- end
+ end
+
+ desc "Get yUML URL"
+ task :url => :environment do
+ puts YUMLME_URL << YUMLmeRails.generate_diagram
+ end
+
+ desc "Download yUML model diagram #{File.dirname(FILENAME)}"
+ task :download => :environment do
+ generate_diagram
+ end
end
+
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.