Class: Diffend::IntegrationRepository
- Inherits:
-
Object
- Object
- Diffend::IntegrationRepository
- Defined in:
- lib/diffend/integration_repository.rb
Overview
Repository for integrations
Constant Summary collapse
- GEMFILE_PLUGIN_ENTRY =
Plugin code entry in Gemfile
'plugin \'diffend\''
- GEMFILE_FILE_NAME =
Gemfile file name
'Gemfile'
- GEMFILE_BACKUP_FILE_NAME =
Gemfile backup file name
'Gemfile.backup'
- PLUGIN_INSTALL_COMMAND =
Plugin install command
[ 'bundle', "_#{Bundler::VERSION}_", 'plugin', 'install', 'diffend', '--source https://rubygems.org' ].join(' ').freeze
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #config?(path) ⇒ Boolean
-
#full_name ⇒ String
Full name of the repository with command.
-
#initialize(command, name) ⇒ IntegrationRepository
constructor
A new instance of IntegrationRepository.
- #install_plugin(path) ⇒ Object
Constructor Details
#initialize(command, name) ⇒ IntegrationRepository
Returns a new instance of IntegrationRepository.
26 27 28 29 30 |
# File 'lib/diffend/integration_repository.rb', line 26 def initialize(command, name) @command = command @name = name @repository = Diffend::Repository.new(command, name) end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
22 23 24 |
# File 'lib/diffend/integration_repository.rb', line 22 def command @command end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/diffend/integration_repository.rb', line 22 def name @name end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
22 23 24 |
# File 'lib/diffend/integration_repository.rb', line 22 def repository @repository end |
Instance Method Details
#config?(path) ⇒ Boolean
38 39 40 41 42 43 44 |
# File 'lib/diffend/integration_repository.rb', line 38 def config?(path) # check if .diffend.yml exists return if File.exist?(File.join(path, Diffend::Config::FILENAME)) puts "Diffend configuration does not exist for #{command} #{name}" exit 1 end |
#full_name ⇒ String
Returns full name of the repository with command.
33 34 35 |
# File 'lib/diffend/integration_repository.rb', line 33 def full_name "#{command}_#{name}" end |
#install_plugin(path) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/diffend/integration_repository.rb', line 47 def install_plugin(path) cmd = Diffend::Shell.call_in_path(path, PLUGIN_INSTALL_COMMAND) unless cmd[:exit_code].zero? puts "#{PLUGIN_INSTALL_COMMAND} failed" puts cmd[:stderr] exit 1 end switch_plugin_to_development(path, cmd[:stdout]) add_plugin_to_gemfile(path) end |