Class: Chronicler
- Inherits:
-
Object
show all
- Defined in:
- lib/chronicler.rb,
lib/chronicler/cli.rb,
lib/chronicler/git.rb,
lib/chronicler/config.rb,
lib/chronicler/version.rb,
lib/chronicler/repository.rb
Defined Under Namespace
Modules: Git
Classes: CLI, Config, Repository
Constant Summary
collapse
- CONFIG =
".chronicler"
- DEFAULT_PATH =
"~/Chronicles"
- MAJOR =
0
- MINOR =
1
- TINY =
3
- VERSION =
[MAJOR, MINOR, TINY].join(".")
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
40
41
42
|
# File 'lib/chronicler.rb', line 40
def self.config
Config[config_path]
end
|
.config_path ⇒ Object
36
37
38
|
# File 'lib/chronicler.rb', line 36
def self.config_path
File.join(Dir.home, CONFIG)
end
|
.destroy! ⇒ Object
44
45
46
47
|
# File 'lib/chronicler.rb', line 44
def self.destroy!
FileUtils.rm_rf(store) if File.exists?(store)
File.delete(config_path) if File.exists?(config_path)
end
|
.repositories ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/chronicler.rb', line 26
def self.repositories
if store
Dir[File.join(store, "*")]
.select{|file| File.directory?(file)}
.collect{|dir| File.basename(dir)}
else
[]
end
end
|
.setup(path) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/chronicler.rb', line 14
def self.setup(path)
path = DEFAULT_PATH if path.to_s.strip.empty?
path = File.expand_path(path)
FileUtils.mkdir_p(path)
config[:store] = path
end
|
.store ⇒ Object
22
23
24
|
# File 'lib/chronicler.rb', line 22
def self.store
config[:store]
end
|