Permalink
Browse files

Merge pull request #25 from shulmang/master

moved dotdir to state_path
  • Loading branch information...
2 parents e2e44dd + 3fc27e0 commit 7583a389a42df9897cf7d10f7bcebf0d3ac38530 @shulmang shulmang committed Jul 7, 2012
Showing with 13 additions and 10 deletions.
  1. +3 −0 README.erb
  2. +8 −8 lib/main/program/class_methods.rb
  3. +2 −2 lib/main/program/instance_methods.rb
View
@@ -188,6 +188,9 @@ DOCS
API section below
HISTORY
+ 4.5.1
+ - moved dotdir to state_path
+
4.5.0
- use map.rb for config objects
@@ -268,32 +268,32 @@ def run(&block)
define_method(:run, &block) if block
end
- def dotdir(*dotdir, &block)
- @dotdir = File.join(Util.home, ".#{ name }") unless defined?(@dotdir)
+ def state_path(*state_path, &block)
+ @state_path = File.join(Util.home, ".#{ name }") unless defined?(@state_path)
- @dotdir = dotdir.join('/') unless dotdir.empty?
+ @state_path = state_path.join('/') unless state_path.empty?
if block
require 'fileutils' unless defined?(FileUtils)
- FileUtils.mkdir_p(@dotdir) unless test(?d, @dotdir)
+ FileUtils.mkdir_p(@state_path) unless test(?d, @state_path)
Dir.chdir(&block)
else
- @dotdir
+ @state_path
end
end
def db(*args, &block)
unless defined?(@db)
require 'sequel' unless defined?(Sequel)
require 'amalgalite' unless defined?(Amalgalite)
- @db = dotdir{ Sequel.amalgalite(db_path) }
+ @db = state_path{ Sequel.amalgalite(db_path) }
@db.instance_eval(&block) if block
end
@db
end
def db_path(*db_path)
- @db_path = File.join(dotdir, 'db.sqlite') unless defined?(@db_path)
+ @db_path = File.join(state_path, 'db.sqlite') unless defined?(@db_path)
@db_path = File.join(*db_path) unless db_path.empty?
@db_path
end
@@ -332,7 +332,7 @@ def config(*args, &block)
alias_method('edit_config_file!', 'config')
def config_path(*config_path)
- @config_path = File.join(dotdir, 'config.yml') unless defined?(@config_path)
+ @config_path = File.join(state_path, 'config.yml') unless defined?(@config_path)
@config_path = File.join(*config_path) unless config_path.empty?
@config_path
end
@@ -269,8 +269,8 @@ class << self
fcall(self, '__instance_eval_block', *argv, &block)
end
- def dotdir(&block)
- self.class.dotdir(&block)
+ def state_path(&block)
+ self.class.state_path(&block)
end
def db(&block)

0 comments on commit 7583a38

Please sign in to comment.