Class: FlickrTools::Command
- Inherits:
-
Object
- Object
- FlickrTools::Command
- Defined in:
- lib/flickr-tools/command.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(argv) ⇒ Command
Returns a new instance of Command.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/flickr-tools/command.rb', line 15 def initialize(argv) @config_dir = self.class.find_config_dir @args = argv.dup @name = @args.shift @token_cache = File.join(@config_dir, "#{@name}.yml") @flickr_yml = File.join @config_dir, 'flickr.yml' unless File.readable?(@flickr_yml) FileUtils.cp File.('../../../doc/flickr.yml.example', __FILE__), @flickr_yml puts "Please get a flickr API key and secret from flickr.com and edit #{@flickr_yml} accordingly." exit 1 end end |
Class Method Details
.find_config_dir ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/flickr-tools/command.rb', line 5 def self.find_config_dir config_dir = File.('../../../config', __FILE__) unless File.directory?(config_dir) config_dir = File.join(ENV['HOME'], '.flickr-tools') FileUtils.mkdir_p config_dir end return config_dir end |