Class: Yade::Composer::Rest::Model::ComposerProject

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, ActiveModel::Serializers::JSON, ActiveModel::Validations, Yade::Common::Config
Defined in:
lib/yade/composer/rest/model/composer_project.rb

Overview

Project

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gitUrlObject

Returns the value of attribute gitUrl.



18
19
20
# File 'lib/yade/composer/rest/model/composer_project.rb', line 18

def gitUrl
  @gitUrl
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/yade/composer/rest/model/composer_project.rb', line 18

def id
  @id
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/yade/composer/rest/model/composer_project.rb', line 18

def name
  @name
end

Instance Method Details

#attributesObject



22
23
24
# File 'lib/yade/composer/rest/model/composer_project.rb', line 22

def attributes
  instance_values
end

#git_repo_nameObject



38
39
40
41
42
# File 'lib/yade/composer/rest/model/composer_project.rb', line 38

def git_repo_name
  uri = URI(gitUrl)

  uri.path.split('/').last.split('.').first
end

#install_dirObject



26
27
28
# File 'lib/yade/composer/rest/model/composer_project.rb', line 26

def install_dir
  "#{ComposerConfig[:composer_home]}/#{name}"
end

#installed?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/yade/composer/rest/model/composer_project.rb', line 30

def installed?
  File.directory?("#{ComposerConfig[:composer_home]}/#{name}")
end

#uninstallObject



34
35
36
# File 'lib/yade/composer/rest/model/composer_project.rb', line 34

def uninstall
  FileUtils.rm_rf("#{ComposerConfig[:composer_home]}/#{name}")
end