Sha256: 606f86c945cb0cf9b6d1419bcf80af09d1722e4fe7651f3cd97dca09a7c52474

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'gli'
require 'clenver'
require 'clenver/project'
require 'clenver/logging'
require 'clenver/package_manager'

module Clenver
  class Runner
    include Logging

    def initialize(path, dst)
      @path = path
      @dst = dst
    end

    def start
      if File.exist?(@path)
        begin
          yaml = Psych.load_file("#{@path}")
          logger.debug("yaml: #{yaml}")
          #TODO: create test and fix this place with check for empty file
          p = Project.new(File.basename("#{@path}", ".yml"), yaml, @dst)
          unless yaml['apt'].nil?
            for pkg in yaml['apt'] do
              pkgs = pkg + " "
            end
            puts pkgs
            p_mgr = PackageManger.new('apt', pkgs)
            p_mgr.install()
          end
          unless yaml['gem'].nil?
            for pkg in yaml['gem'] do
              pkgs = pkg + " "
            end
            puts pkgs
            p_mgr = PackageManger.new('gem', pkgs)
            p_mgr.install()
          end
          p.create_repos
          p.init_project
        rescue Psych::SyntaxError => ex
          exit_now!("#{@path}: syntax error : #{ex.message}", 1)
        end
      else
        exit_now!("#{@path} no such file or directory", 2)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clenver-0.1.10 lib/clenver/runner.rb