Module: BitScopeModule
- Included in:
- Takelage::BitScope
- Defined in:
- lib/takelage/bit/scope/module.rb
Overview
takelage bit scope module
Instance Method Summary collapse
-
#bit_scope_add(scope) ⇒ Object
Backend method for bit scope add.
-
#bit_scope_list ⇒ String
Backend method for bit scope list.
-
#bit_scope_new(scope) ⇒ Int
Backend method for bit scope new.
Instance Method Details
#bit_scope_add(scope) ⇒ Object
Backend method for bit scope add.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/takelage/bit/scope/module.rb', line 5 def bit_scope_add(scope) log.debug "Adding bit remote scope \"#{scope}\" to local workspace" if git_check_workspace unless git_check_master log.error 'Not on git master branch' return end end # check if bit remote scope exists scope_list = bit_scope_list log.debug scope_list unless scope_list.include? scope log.error "The bit remote bit scope \"#{scope}\" doesn't exist" exit false end # get bit remote from active config bit_remote = config.active['bit_remote'] # prepare scope add command cmd_bit_scope_add = "bit remote add #{bit_remote}/#{scope}" run cmd_bit_scope_add log.info "Added bit remote scope \"#{scope}\" to local bit workspace" end |
#bit_scope_list ⇒ String
Backend method for bit scope list.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/takelage/bit/scope/module.rb', line 35 def bit_scope_list log.debug "Listing bit remote scopes" # get ssh command from active config cmd_bit_ssh = config.active['bit_ssh'] # prepare scope list command root = config.active['bit_scope_root'] cmd_bit_scope_list = config.active['bit_scope_list'] % {root: root} # run ssh command with scope list command scope_list, stderr, status = run_and_check "#{cmd_bit_ssh} '#{cmd_bit_scope_list}'" # remove bit remote root directory from results scope_list.gsub!(/#{root}\/*/, '') # remove /scope.json from results scope_list.gsub!(/\/scope.json/, '') scope_list end |
#bit_scope_new(scope) ⇒ Int
Backend method for bit scope new.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/takelage/bit/scope/module.rb', line 59 def bit_scope_new(scope) log.debug "Creating new bit remote scope \"#{scope}\"" # check if bit remote scope already exists scope_list = bit_scope_list if scope_list.include? scope log.error "The remote bit scope \"#{scope}\" already exists" exit false end # get ssh command from active config cmd_bit_ssh = config.active['bit_ssh'] # prepare scope list command root = config.active['bit_scope_root'] cmd_bit_scope_new = config.active['bit_scope_new'] % {scope: scope, root: root} # run ssh command with scope new command run "#{cmd_bit_ssh} '#{cmd_bit_scope_new}'" log.info "Created new bit remote scope \"#{scope}\"" end |