Class: EySecrets::Repository

Inherits:
Struct
  • Object
show all
Defined in:
lib/ey_secrets/models/repository.rb

Defined Under Namespace

Classes: NotReadyForUpdate

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filesObject

Returns the value of attribute files

Returns:

  • (Object)

    the current value of files



2
3
4
# File 'lib/ey_secrets/models/repository.rb', line 2

def files
  @files
end

#ready_for_updateObject

Returns the value of attribute ready_for_update

Returns:

  • (Object)

    the current value of ready_for_update



2
3
4
# File 'lib/ey_secrets/models/repository.rb', line 2

def ready_for_update
  @ready_for_update
end

#remotesObject

Returns the value of attribute remotes

Returns:

  • (Object)

    the current value of remotes



2
3
4
# File 'lib/ey_secrets/models/repository.rb', line 2

def remotes
  @remotes
end

Instance Method Details

#assert_ready_for_updateObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/ey_secrets/models/repository.rb', line 14

def assert_ready_for_update
  unless ready_for_update?
    raise(NotReadyForUpdate,
          'Commit on master and push your changes before updating config.' \
          "\n\n" \
          'Config can only be updated from the master branch. ' \
          'This helps ensure that the credentials found on a production ' \
          'system always reflect the current state of the master branch.')
  end
end

#glob(pattern) ⇒ Object



10
11
12
# File 'lib/ey_secrets/models/repository.rb', line 10

def glob(pattern)
  files.select { |file| File.fnmatch(pattern, file) }
end

#ready_for_update?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/ey_secrets/models/repository.rb', line 6

def ready_for_update?
  ready_for_update
end