Class: Babushka::GitFS
Constant Summary collapse
Class Method Summary collapse
- .commit(message) ⇒ Object
- .init ⇒ Object
- .repo ⇒ Object
- .root ⇒ Object
- .set_name_and_email ⇒ Object
- .snapshotting_with(message, &blk) ⇒ Object
Class Method Details
.commit(message) ⇒ Object
14 15 16 17 |
# File 'lib/babushka/git_fs.rb', line 14 def self.commit repo.repo_shell_as_owner('git add -A .') repo.commit!() end |
.init ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/babushka/git_fs.rb', line 19 def self.init unless repo.exists? set_name_and_email repo.init!(File.read(GITIGNORE_FILE)) commit("Add the base system.") end end |
.repo ⇒ Object
35 36 37 38 39 40 |
# File 'lib/babushka/git_fs.rb', line 35 def self.repo # Using :run_as_owner means babushka will sudo to commit to the gitfs when # meeting deps as a regular user. For this to work well, the app user # should have passwordless sudo during provisioning, revoked on completion. @repo ||= Babushka::GitRepo.new(root, :run_as_owner => true) end |
.set_name_and_email ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/babushka/git_fs.rb', line 27 def self.set_name_and_email if !Babushka::ShellHelpers.shell?("git config --global user.name") || !Babushka::ShellHelpers.shell?("git config --global user.email") Babushka::ShellHelpers.shell("git config --global user.name babushka", :as => root.owner) Babushka::ShellHelpers.shell("git config --global user.email [email protected]", :as => root.owner) end end |