class RBCM::Addon
Attributes
name[R]
project[R]
repo[R]
type[R]
Public Class Methods
new(type:, name: @type, @name = type, name)
click to toggle source
Calls superclass method
Project::new
# File app/project/addon.rb, line 2 def initialize type:, name: @type, @name = type, name if [:file, :dir].include? type super name elsif type == :github super load_from_github name end end
Public Instance Methods
load_from_github(repo)
click to toggle source
# File app/project/addon.rb, line 13 def load_from_github repo addon_dir = "/tmp/rbcm-addons/" dir = "#{addon_dir}#{repo}" repo = if Dir.exist? dir Git.open dir else Git.clone "https://github.com/#{repo}.git", repo, path: addon_dir end repo.checkout "master" repo.pull return dir end