Module: Boson::Save
- Included in:
- Boson
- Defined in:
- lib/boson/save.rb
Instance Method Summary collapse
- #config ⇒ Object
- #config=(val) ⇒ Object
-
#global_repo ⇒ Object
Optional global repository at /etc/boson.
-
#local_repo ⇒ Object
An optional local repository which defaults to ./lib/boson or ./.boson.
-
#repo ⇒ Object
The main required repository which defaults to ~/.boson.
-
#repos ⇒ Object
The array of loaded repositories containing the main repo and possible local and global repos.
Instance Method Details
#config ⇒ Object
8 9 10 |
# File 'lib/boson/save.rb', line 8 def config repo.config end |
#config=(val) ⇒ Object
12 13 14 |
# File 'lib/boson/save.rb', line 12 def config=(val) repo.config = val end |
#global_repo ⇒ Object
Optional global repository at /etc/boson
37 38 39 |
# File 'lib/boson/save.rb', line 37 def global_repo File.exists?('/etc/boson') ? Repo.new('/etc/boson') : nil end |
#local_repo ⇒ Object
An optional local repository which defaults to ./lib/boson or ./.boson.
22 23 24 25 26 27 28 29 |
# File 'lib/boson/save.rb', line 22 def local_repo @local_repo ||= begin ignored_dirs = (config[:ignore_directories] || []).map {|e| File.(e) } dir = ["lib/boson", ".boson"].find {|e| File.directory?(e) && File.(e) != repo.dir && !ignored_dirs.include?(File.('.')) } Repo.new(dir) if dir end end |
#repo ⇒ Object
The main required repository which defaults to ~/.boson.
17 18 19 |
# File 'lib/boson/save.rb', line 17 def repo @repo ||= Repo.new("#{ENV['BOSON_HOME'] || Dir.home}/.boson") end |
#repos ⇒ Object
The array of loaded repositories containing the main repo and possible local and global repos
32 33 34 |
# File 'lib/boson/save.rb', line 32 def repos @repos ||= [repo, local_repo, global_repo].compact end |