Sha256: 0bac459e13230f114eb5ac7140bfbe540ffc4e189c9144a3b6933a1d6c34ea9e

Contents?: true

Size: 628 Bytes

Versions: 5

Compression:

Stored size: 628 Bytes

Contents

require 'anvil/task'
require 'anvil/task/repositories'
require 'anvil/config'
require 'git'

module Projects
  class AddTask < Anvil::Task
    include Anvil::Task::Repositories
    description 'Adds a new project for anvil.'

    parser do
      arguments %w[name repository]
    end

    attr_reader :name, :repo

    def initialize(name, repo, options = {})
      @name = name
      @repo = repo
    end

    def task
      url_to_clone = resolve_url(repo)
      clone_repo(url_to_clone, name)
    end

    def clone_repo(url, name)
      Dir.chdir(Anvil::Config.base_projects_path) { Git.clone(url, name) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
anvil-core-0.2.0 lib/tasks/projects/add_task.rb
anvil-core-0.1.0 lib/tasks/projects/add_task.rb
anvil-core-0.0.1.pre.alpha.3 lib/tasks/projects/add_task.rb
anvil-core-0.0.1.pre.alpha.2 lib/tasks/projects/add_task.rb
anvil-core-0.0.1.alpha.1 lib/tasks/projects/add_task.rb