Class: Lockness::EnsureMasterKeyGitIgnored
- Inherits:
-
Object
- Object
- Lockness::EnsureMasterKeyGitIgnored
- Defined in:
- lib/lockness/ensure_master_key_git_ignored.rb
Instance Method Summary collapse
Instance Method Details
#ensure_master_key_git_ignored ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/lockness/ensure_master_key_git_ignored.rb', line 4 def ensure_master_key_git_ignored master_key = MasterKey.new return unless git_repo? return unless master_key.exist? return if ignored_files.include?('master.key') puts "You must git ignore #{master_key.path} to use lockness." exit 1 end |
#git_repo? ⇒ Boolean
24 25 26 |
# File 'lib/lockness/ensure_master_key_git_ignored.rb', line 24 def git_repo? `git -C #{Dir.pwd} rev-parse 2>/dev/null; echo $?`.chomp == '0' end |
#ignored_files ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/lockness/ensure_master_key_git_ignored.rb', line 16 def ignored_files files = `git status --short --ignored` files.split("\n") .select { |status_line| status_line.starts_with?('!!') } .map { |status_line| status_line.split.last } end |