Module: RakeFly

Includes:
RubyFly
Defined in:
lib/rake_fly.rb,
lib/rake_fly/version.rb,
lib/rake_fly/task_sets/project.rb,
lib/rake_fly/task_sets/pipeline.rb,
lib/rake_fly/tasks/pipeline/get.rb,
lib/rake_fly/tasks/pipeline/set.rb,
lib/rake_fly/tasks/pipeline/push.rb,
lib/rake_fly/tasks/pipeline/destroy.rb,
lib/rake_fly/tasks/pipeline/unpause.rb,
lib/rake_fly/task_sets/authentication.rb,
lib/rake_fly/tasks/authentication/login.rb,
lib/rake_fly/tasks/authentication/ensure.rb

Defined Under Namespace

Modules: TaskSets, Tasks

Constant Summary collapse

ARTIFACT_FORMAT_CHANGE_VERSION =
'5.0.0'
VERSION =
'2.9.0'

Class Method Summary collapse

Class Method Details

.define_authentication_tasks(opts = {}, &block) ⇒ Object



52
53
54
# File 'lib/rake_fly.rb', line 52

def self.define_authentication_tasks(opts = {}, &block)
  RakeFly::TaskSets::Authentication.define(opts, &block)
end

.define_installation_tasks(opts = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rake_fly.rb', line 13

def self.define_installation_tasks(opts = {})
  namespace = opts[:namespace] || :fly
  version = opts[:version] || '2.7.0'
  path = opts[:path] || File.join('vendor', 'fly')

  type = self.type(version)
  uri_template = self.uri_template(version)
  file_name_template = self.file_name_template(version)
  new_format = self.new_format?(version)

  task_set_opts = {
      namespace: namespace,
      dependency: 'fly',
      version: version,
      path: path,
      type: type,
      platform_os_names: {darwin: 'darwin', linux: 'linux'},
      uri_template: uri_template,
      file_name_template: file_name_template,
      needs_fetch: lambda { |t|
        fly_binary = File.join(t.path, t.binary_directory, 'fly')

        !(File.exist?(fly_binary) && RubyFly.version == version)
      }}

  unless new_format
    task_set_opts[:source_binary_name_template] =
      "fly_<%= @platform_os_name %>_amd64"
    task_set_opts[:target_binary_name_template] =
      "fly"
  end

  RubyFly.configure do |c|
    c.binary = File.join(path, 'bin', 'fly')
  end

  RakeDependencies::TaskSets::All.define(task_set_opts)
end

.define_pipeline_tasks(opts = {}, &block) ⇒ Object



56
57
58
# File 'lib/rake_fly.rb', line 56

def self.define_pipeline_tasks(opts = {}, &block)
  RakeFly::TaskSets::Pipeline.define(opts, &block)
end

.define_project_tasks(opts = {}, &block) ⇒ Object



60
61
62
# File 'lib/rake_fly.rb', line 60

def self.define_project_tasks(opts = {}, &block)
  RakeFly::TaskSets::Project.define(opts, &block)
end

.file_name_template(version) ⇒ Object



90
91
92
93
94
95
96
# File 'lib/rake_fly.rb', line 90

def self.file_name_template(version)
  if new_format?(version)
    "fly-<%= @version %>-<%= @platform_os_name %>-amd64<%= @ext %>"
  else
    "fly_<%= @platform_os_name %>_amd64"
  end
end

.new_format?(version) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
69
# File 'lib/rake_fly.rb', line 66

def self.new_format?(version)
  Semantic::Version.new(version) >=
      Semantic::Version.new(ARTIFACT_FORMAT_CHANGE_VERSION)
end

.type(version) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/rake_fly.rb', line 71

def self.type(version)
  if self.new_format?(version)
    :tgz
  else
    :uncompressed
  end
end

.uri_template(version) ⇒ Object



79
80
81
82
83
84
85
86
87
88
# File 'lib/rake_fly.rb', line 79

def self.uri_template(version)
  if new_format?(version)
    "https://github.com/concourse/concourse/releases/download" +
        "/v<%= @version %>" +
        "/fly-<%= @version %>-<%= @platform_os_name %>-amd64<%= @ext %>"
  else
    "https://github.com/concourse/concourse/releases/" +
        "download/v<%= @version %>/fly_<%= @platform_os_name %>_amd64"
  end
end