Class: MVCLI::Plugins::InstallationModel

Inherits:
Object
  • Object
show all
Defined in:
lib/mvcli/plugins/models/plugins/installation_model.rb

Instance Method Summary collapse

Constructor Details

#initialize(form) ⇒ InstallationModel

Returns a new instance of InstallationModel.



4
5
6
# File 'lib/mvcli/plugins/models/plugins/installation_model.rb', line 4

def initialize(form)
  @form = form
end

Instance Method Details

#gemspecObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/mvcli/plugins/models/plugins/installation_model.rb', line 20

def gemspec
  gemspec = Gem::Specification.load Dir[@form.path.join('*.gemspec')].first
  config.directory "plugins" do |dir|
    target = dir.join(gemspec.name)
    FileUtils.rm_rf target
    target.make_symlink location
    Gem.paths.path.unshift dir.to_s
    request = Gem::RequestSet.new *gemspec.dependencies
    request.resolve
    request.install_into dir
  end
  return gemspec
end

#locationObject



16
17
18
# File 'lib/mvcli/plugins/models/plugins/installation_model.rb', line 16

def location
  @form.path
end

#nameObject



8
9
10
# File 'lib/mvcli/plugins/models/plugins/installation_model.rb', line 8

def name
  gemspec.name
end

#versionObject



12
13
14
# File 'lib/mvcli/plugins/models/plugins/installation_model.rb', line 12

def version
  gemspec.version
end