davetron5000-gliffy 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/gliffy CHANGED
@@ -9,16 +9,23 @@ require 'gli'
9
9
  include GLI
10
10
 
11
11
  pre do |global_options,command,options,args|
12
- if !Gliffy::CLIConfig.instance.load
13
- raise "Problem loading config"
14
- end
15
- if command && command.name != :help
12
+ if global_options[:version]
13
+ puts "#{$0} v#{Gliffy::VERSION}"
14
+ false
15
+ elsif !Gliffy::CLIConfig.instance.load
16
+ puts "Problem loading config"
17
+ false
18
+ elsif command && command.name != :help
16
19
  previous_token = Gliffy::CLIConfig.instance.config[:current_token]
17
20
  Gliffy::Config.config.log_level = Logger::DEBUG if global_options[:v]
18
21
  $gliffy = Gliffy::Handle.new(Gliffy::CLIConfig.instance.config[:username],previous_token)
22
+ true
19
23
  end
20
24
  end
21
25
 
26
+ desc 'show version'
27
+ switch :version
28
+
22
29
  desc 'be more verbose'
23
30
  switch :v
24
31
 
data/lib/gliffy/cli.rb CHANGED
@@ -66,10 +66,26 @@ module Gliffy
66
66
 
67
67
  # Saves the configration to the user's config file name as YAML
68
68
  def save
69
+ ld = @config[:log_device]
70
+ @config[:log_device] = log_device_to_string(ld)
69
71
  fp = File.open(@config_file_name,'w') { |out| YAML::dump(@config,out) }
72
+ @config[:log_device] = ld
70
73
  end
71
74
 
72
75
  private
76
+
77
+ def log_device_to_string(ld)
78
+ if ld == STDERR
79
+ 'STDERR'
80
+ elsif ld == STDOUT
81
+ 'STDOUT'
82
+ elsif !ld.kind_of?(String)
83
+ puts "Warning: don't know how to persist a #{ld.class.name}"
84
+ nil
85
+ else
86
+ ld
87
+ end
88
+ end
73
89
  def read_config_from_user(name,symbol)
74
90
  if (!@config[symbol])
75
91
  puts "No #{name} configured. Enter #{name}"
@@ -81,7 +97,7 @@ module Gliffy
81
97
  @config_file_name = File.expand_path("~/.gliffyrc")
82
98
  @config = {
83
99
  :log_level => Gliffy::Config.config.log_level,
84
- :log_device => Gliffy::Config.config.log_device.to_s,
100
+ :log_device => log_device_to_string(Gliffy::Config.config.log_device),
85
101
  :gliffy_app_root => Gliffy::Config.config.gliffy_app_root,
86
102
  :gliffy_rest_context => Gliffy::Config.config.gliffy_rest_context,
87
103
  :protocol => Gliffy::Config.config.protocol,
data/lib/gliffy/handle.rb CHANGED
@@ -7,6 +7,7 @@ require 'gliffy/account'
7
7
  require 'gliffy/config'
8
8
 
9
9
  module Gliffy
10
+ VERSION = '0.1.5'
10
11
 
11
12
 
12
13
  # A "handle" to access Gliffy on a per-user-session basis
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.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland
@@ -9,17 +9,17 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-03 00:00:00 -08:00
12
+ date: 2009-02-05 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: technoweenie-rest-client
16
+ name: davetron5000-rest-client
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.5.1
22
+ version: 0.5.2
23
23
  version:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: davetron5000-gli