davetron5000-gliffy 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -50,3 +50,21 @@ If you are not on OS X, you will want to configure two other options, and you ca
50
50
  [<tt>open_url</tt>] Configures the command for opening an url from the command line. This should be a string of the form <tt>command %s</tt> where <tt>%s</tt> will be replaced with the name of the url to open.
51
51
 
52
52
  The other options are all documented in Gliffy::Config. Note that your most previously received user token is stored here as well, to keep from getting it every time the client is run.
53
+
54
+ === Example
55
+
56
+ > gliffy ls
57
+ 1573119 Deployment Artifacts
58
+ 1569470 Monthly_Eligible
59
+ 1569477 Monthly_Ineligibile
60
+ 1569478 Quarterly_Eligible
61
+ 1569479 Quarterly_Ineligibile
62
+ > gliffy get 1569479
63
+ Quarterly_Ineligibile.jpg
64
+ > gliffy get 1569479 -d ~/Downloads -t png
65
+ /Users/davec/Downloads/Quarterly_Ineligibile.png
66
+ > gliffy edit 1569470
67
+ # You are sent to gliffy.com in your browser to edit that diagram
68
+ > gliffy new -e "Class Diagram"
69
+ # You are sent to gliffy.com to edit the new diagram
70
+
@@ -55,9 +55,11 @@ end
55
55
 
56
56
  desc 'Download a diagram as an image to a file'
57
57
  usage <<eos
58
- [-v version_num] [-f filename] [-t image_type] diagram_id
58
+ [-v version_num] [-f filename] [-d download_dir] [-t image_type] diagram_id
59
59
 
60
- image_type can be :jpeg, :png, :svg, or :xml
60
+ image_type can be :jpeg, :jpg, :png, :svg, or :xml
61
+ if no filename specified, uses the diagram's name
62
+ if -d and -f are specified, -d is ignored
61
63
  eos
62
64
  command :get do |gliffy,args|
63
65
 
@@ -67,12 +69,15 @@ command :get do |gliffy,args|
67
69
  version_number = options['v'].to_i if options['v']
68
70
  filename = options['f'] if options['f']
69
71
  type = options['t'].to_sym if options['t']
70
- type = :jpeg if !type
72
+ type = :jpg if !type
71
73
  if !filename
74
+ dir = options['d'] || '.'
75
+ metadata = gliffy.get_diagram_metadata(diagram_id)
76
+ filename = metadata.name.gsub(/[\s\/\-\+\$]/,'_')
72
77
  if version_number
73
- filename = "#{diagram_id}_v#{version_number}.#{type.to_s}"
78
+ filename = "#{dir}/#{filename}_v#{version_number}.#{type.to_s}"
74
79
  else
75
- filename = "#{diagram_id}.#{type.to_s}"
80
+ filename = "#{dir}/#{filename}.#{type.to_s}"
76
81
  end
77
82
  end
78
83
 
@@ -97,19 +102,17 @@ end
97
102
 
98
103
  desc 'Create a new diagram'
99
104
  usage <<eos
100
- [-e] diagram_name
105
+ [-t template_id] diagram_name
101
106
 
102
- -e edit the diagram after creating it
107
+ -t specify the id of a diagram to server as the initial revision
103
108
  eos
104
109
  command :new do |gliffy,args|
105
- edit = args[0] == '-e'
106
- args.shift if edit
107
- diagram = gliffy.create_diagram(args[0])
108
- if edit
109
- Gliffy::Command.commands[:edit].run [diagram.id]
110
- else
111
- puts "#{diagram.name} created with id #{diagram.id}"
112
- end
110
+ options = parse_options(args)
111
+ name = args.shift
112
+ template_id = options['t']
113
+
114
+ diagram = gliffy.create_diagram(name,template_id)
115
+ Gliffy::Command.commands[:edit].run [diagram.id]
113
116
  end
114
117
 
115
118
  desc 'Show commands'
@@ -167,8 +167,8 @@ module Gliffy
167
167
  ""
168
168
  end
169
169
 
170
- # GliffyDiagram getDiagramMetaData (integer $diagramId)
171
- def get_diagram_meta_data(diagram_id)
170
+ # Returns a Diagram with the diagram's meta data filled in.
171
+ def get_diagram_metadata(diagram_id)
172
172
  params = {'diagramId' => diagram_id}
173
173
  diagrams = do_simple_rest(:get,'diagrams',"Getting meta data for diagram #{diagram_id}",params)
174
174
  diagrams[0]
data/lib/gliffy.rb CHANGED
@@ -1 +1 @@
1
- require 'gliffy/gliffy'
1
+ require 'gliffy/handle'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: davetron5000-gliffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-22 00:00:00 -08:00
12
+ date: 2009-01-11 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -37,7 +37,7 @@ files:
37
37
  - lib/gliffy/config.rb
38
38
  - lib/gliffy/diagram.rb
39
39
  - lib/gliffy/folder.rb
40
- - lib/gliffy/gliffy.rb
40
+ - lib/gliffy/handle.rb
41
41
  - lib/gliffy/response.rb
42
42
  - lib/gliffy/rest.rb
43
43
  - lib/gliffy/url.rb