Module: RoboPigeon::Dsl::InitialJobs

Included in:
Root
Defined in:
lib/robopigeon/dsl/initial_jobs.rb

Constant Summary collapse

INITIAL_FILE =
"#{File.dirname(__FILE__)}/../resources/initial_robopigeon.rb".freeze
INITIAL_TEST =
"#{File.dirname(__FILE__)}/../../../spec/initial_robopigeon_spec.rb".freeze
TARGET_TEST =
'spec/robopigeon_spec.rb'.freeze

Instance Method Summary collapse

Instance Method Details

#baseObject

Used to pull in environment variables for things that are mostly set via dsl



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/robopigeon/dsl/initial_jobs.rb', line 7

def base
  slack do
    api_key ENV['SLACK_API_KEY']
  end
  gitlab do
    api_url ENV['CI_API_V4_URL']
    api_key ENV['GITLAB_API_KEY']
  end
  job 'version', '-v', 'Show version number' do
    puts RoboPigeon::VERSION
  end
end

#init_helpObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/robopigeon/dsl/initial_jobs.rb', line 39

def init_help
  this_job = {
    desc: 'Show usage information',
    action: proc do
      usage
    end
  }
  jobs['help'] = this_job
  jobs['-h'] = this_job.merge(hidden: true)
end

#init_jobObject



20
21
22
23
24
25
26
27
28
# File 'lib/robopigeon/dsl/initial_jobs.rb', line 20

def init_job
  jobs['init'] = {
    desc: 'Initialize a new robopigeon project',
    action: proc do
      FileUtils.cp(INITIAL_FILE, RoboPigeon::DEFAULT_FILE)
      FileUtils.cp(INITIAL_TEST, TARGET_TEST)
    end
  }
end

#init_newObject



30
31
32
33
34
35
36
37
# File 'lib/robopigeon/dsl/initial_jobs.rb', line 30

def init_new
  jobs['new'] = {
    desc: 'Create a new extension for RoboPigeon',
    action: proc do
      RoboPigeon::Extensions::Cli.invoke(ARGV)
    end
  }
end