Class: Adaptibrew
- Inherits:
-
Object
- Object
- Adaptibrew
- Defined in:
- lib/brewer/adaptibrew.rb
Overview
This is the ‘manager’ for the adaptibrew repo. It handles cloning and such.
Instance Method Summary collapse
-
#clear ⇒ Object
Danger zone…
-
#clone ⇒ Object
This will clone adaptibrew into ~/.brewer/adaptibrew/.
-
#initialize ⇒ Adaptibrew
constructor
A new instance of Adaptibrew.
- #present? ⇒ Boolean
-
#refresh ⇒ Object
This is a good catch-all method If it’s not there, it will clone.
Constructor Details
#initialize ⇒ Adaptibrew
Returns a new instance of Adaptibrew.
6 7 8 |
# File 'lib/brewer/adaptibrew.rb', line 6 def initialize refresh end |
Instance Method Details
#clear ⇒ Object
Danger zone…
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/brewer/adaptibrew.rb', line 20 def clear # :nocov: since this requires network to be off if !network? print "Warning: you have no network connection. If you clear, you will not be able to clone again, and you'll be stuck without the adaptibrew source. Are you sure? " confirm ? nil : abort end # :nocov: FileUtils.rm_rf(adaptibrew_dir) self end |
#clone ⇒ Object
This will clone adaptibrew into ~/.brewer/adaptibrew/
11 12 13 14 15 16 17 |
# File 'lib/brewer/adaptibrew.rb', line 11 def clone raise "🛑 Cannot clone, no network connection" unless network? if !Dir.exists?(adaptibrew_dir) Git.clone('https://github.com/llamicron/adaptibrew.git', 'adaptibrew', :path => brewer_dir) end self end |
#present? ⇒ Boolean
41 42 43 |
# File 'lib/brewer/adaptibrew.rb', line 41 def present? return Dir.exists?(adaptibrew_dir) ? true : false end |
#refresh ⇒ Object
This is a good catch-all method If it’s not there, it will clone. If it is, it will delete and re-clone
34 35 36 37 38 39 |
# File 'lib/brewer/adaptibrew.rb', line 34 def refresh raise "🛑 Cannot refresh, no network connection" unless network? clear clone self end |