Class: Linner::Bundler
- Inherits:
-
Object
- Object
- Linner::Bundler
- Defined in:
- lib/linner/bundler.rb
Defined Under Namespace
Classes: Bundle
Constant Summary collapse
- VENDOR =
Pathname(".").join "vendor"
- REPOSITORY =
File. "~/.linner/bundles"
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(bundles) ⇒ Bundler
constructor
A new instance of Bundler.
- #install ⇒ Object
- #perform ⇒ Object
Constructor Details
Instance Method Details
#check ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/linner/bundler.rb', line 24 def check return [false, "Bundles didn't exsit!"] unless File.exist? REPOSITORY @bundles.each do |bundle| unless File.exist?(bundle.path) and File.exist?(File.join(VENDOR, bundle.name)) return [false, "Bundle #{bundle.name} v#{bundle.version} didn't match!"] end end return [true, "Perfect bundled, ready to go!"] end |
#install ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/linner/bundler.rb', line 34 def install unless File.exist? REPOSITORY FileUtils.mkdir_p(REPOSITORY) end @bundles.each do |bundle| if bundle.version != "master" next if File.exist?(bundle.path) and File.exist?(File.join(VENDOR, bundle.name)) end puts "Installing #{bundle.name} #{bundle.version}..." install_to_repository bundle.url, bundle.path if gzipped?(bundle.path) link_and_extract_to_vendor bundle.path, File.join(VENDOR, ".pkg", bundle.name, File.basename(bundle.path)), File.join(VENDOR, bundle.name) else link_to_vendor bundle.path, File.join(VENDOR, bundle.name) end end end |
#perform ⇒ Object
52 53 54 |
# File 'lib/linner/bundler.rb', line 52 def perform check and install end |