Sha256: 1915956cadac052aa309905f8b5288e7390696cc8db654f53e5a06037463e990

Contents?: true

Size: 1.08 KB

Versions: 26

Compression:

Stored size: 1.08 KB

Contents

require 'rake_factory'

require_relative '../../client'

module RakeCircleCI
  module Tasks
    module EnvironmentVariables
      class Provision < RakeFactory::Task
        default_name :provision
        default_description RakeFactory::DynamicValue.new { |t|
          "Provision environment variables on the #{t.project_slug} project"
        }

        parameter :project_slug, required: true
        parameter :api_token, required: true
        parameter :base_url, default: 'https://circleci.com/api'
        parameter :environment_variables, default: {}

        action do |t|
          client = Client.new(
              base_url: t.base_url,
              api_token: t.api_token,
              project_slug: t.project_slug)

          puts "Provisioning all environment variables to the " +
              "'#{t.project_slug}' project... "

          t.environment_variables.each do |name, value|
            print "Setting environment variable: '#{name}'... "
            client.create_env_var(name.to_s, value)
            puts "Done."
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rake_circle_ci-0.10.0.pre.6 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.10.0.pre.5 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.10.0.pre.4 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.10.0.pre.3 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.10.0.pre.2 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.10.0.pre.1 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.9.0 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.8.0.pre.4 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.8.0.pre.3 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.8.0.pre.2 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.8.0.pre.1 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.7.0 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.6.0.pre.1 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.5.0 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.4.0.pre.1 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.3.0 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.2.0.pre.11 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.2.0.pre.10 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.2.0.pre.9 lib/rake_circle_ci/tasks/environment_variables/provision.rb
rake_circle_ci-0.2.0.pre.8 lib/rake_circle_ci/tasks/environment_variables/provision.rb