concourse 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10b3e2e3d7756b1c61293045f6a7a991df14ec30
4
- data.tar.gz: c44c2ce5b4d0e2091893fa1407e1d73a8d566fbc
3
+ metadata.gz: 309f76ecec1a0a549b9f35131415667cc260857e
4
+ data.tar.gz: 0bd5fe1842f603a620c853d34c61be8009436595
5
5
  SHA512:
6
- metadata.gz: bb6a2494b9e0837859fae6f17ef44702607a4bf613d3060899ee36553694fab366318c67d4ec2e6cab03ea9adf71c9a625641acfad977508c913533b25b47f8c
7
- data.tar.gz: a53d14f3f898d53e6a7b6ae2f6756ef76ea86a49b38f475b54d52a26ae52217dae930f9de96c6d93a47f90aa7499bd4d082cd383be77cb738516440070c48f40
6
+ metadata.gz: 301f6a4ebed72c0711407ef3b7af0ede4b0b6a2483682e07c1dbc5e3c33ba52e9601433c8d1ee13643cae7cfd3f340f1bfa154daac2478aefa3b778eddb53d69
7
+ data.tar.gz: '08723c8657265c31e5ee2c90e5685207751020984080f8c4b38b5859e35a9d5b790b763cf88fce25e17005e2bb0aa58b57caa55eda7f111f035f19be80e294dd'
@@ -1,5 +1,12 @@
1
1
  # concourse-gem changelog
2
2
 
3
+ ## 0.13.0 / 2017-03-23
4
+
5
+ ### Features
6
+
7
+ * allow setting of concourse directory name
8
+
9
+
3
10
  ## 0.12.0 / 2017-02-14
4
11
 
5
12
  ### Features
data/README.md CHANGED
@@ -17,7 +17,45 @@ Concourse.new("myproject").create_tasks!
17
17
 
18
18
  This will create a set of rake tasks for you.
19
19
 
20
- Create a subdirectory named `concourse`, and edit a Concourse pipeline file named `myproject.yml`, whichi will be interpreted as an ERB template.
20
+ ``` sh
21
+ rake concourse:init
22
+ ```
23
+
24
+ The `concourse:init` task will create a subdirectory named `concourse`, and create a Concourse pipeline file named `myproject.yml`, which will be interpreted as an ERB template. It will also ensure that files with sensitive data (`concourse/private.yml` and `concourse/myproject.final.yml`) are in `.gitignore`.
25
+
26
+
27
+ ### Concourse subdirectory name
28
+
29
+ You can choose a directory name other than `concourse`:
30
+
31
+ ``` ruby
32
+ Concourse.new("myproject", directory: "ci").create_tasks!
33
+ ```
34
+
35
+
36
+ ### Keeping credentials private
37
+
38
+ If the file `concourse/private.yml` exists, it will be passed to the `fly` commandline with the `-l` option to fill in template values.
39
+
40
+ For example, I might have a concourse config that looks like this:
41
+
42
+ ``` yaml
43
+ - name: nokogiri-pr
44
+ type: pull-request
45
+ source:
46
+ repo: sparklemotion/nokogiri
47
+ access_token: {{github-repo-status-access-token}}
48
+ ignore_paths:
49
+ - concourse/**
50
+ ```
51
+
52
+ I can put my access token in `private.yml` like this:
53
+
54
+ ``` yaml
55
+ github-repo-status-access-token: "your-token-here"
56
+ ```
57
+
58
+ and the final generate template will substitute your credentials into the appropriate place.
21
59
 
22
60
 
23
61
  ### Templating and `RUBIES`
@@ -11,10 +11,9 @@ class Concourse
11
11
  rbx: %w[latest], # docker repository: "rubinius/docker"
12
12
  }
13
13
 
14
- DIRECTORY = "concourse"
15
- PRIVATE_VAR_FILE = File.join DIRECTORY, "private.yml"
14
+ DEFAULT_DIRECTORY = "concourse"
16
15
 
17
- attr_reader :project_name, :pipeline_filename, :pipeline_erb_filename
16
+ attr_reader :project_name, :pipeline_filename, :pipeline_erb_filename, :directory, :private_var_file
18
17
 
19
18
  def self.validate_fly_target task, task_args
20
19
  unless task_args[:fly_target]
@@ -29,19 +28,30 @@ class Concourse
29
28
  matching_line.split(/ +/)[1]
30
29
  end
31
30
 
32
- def initialize project_name
31
+ def initialize project_name, directory: DEFAULT_DIRECTORY
33
32
  @project_name = project_name
34
- @pipeline_filename = File.join(DIRECTORY, "#{project_name}.final.yml")
35
- @pipeline_erb_filename = File.join(DIRECTORY, "#{project_name}.yml")
33
+ @directory = directory
34
+ @pipeline_filename = File.join(@directory, "#{project_name}.final.yml")
35
+ @pipeline_erb_filename = File.join(@directory, "#{project_name}.yml")
36
+ @private_var_file = File.join(@directory, "private.yml")
36
37
  end
37
38
 
38
39
  def erbify document_string, *args
39
40
  ERB.new(document_string, nil, "%-").result(binding)
40
41
  end
41
42
 
43
+ def rake_init
44
+ FileUtils.mkdir_p File.join(directory, "tasks")
45
+ FileUtils.touch pipeline_erb_filename
46
+ File.open ".gitignore", "a" do |f|
47
+ f.puts private_var_file
48
+ f.puts pipeline_filename
49
+ end
50
+ end
51
+
42
52
  def create_tasks!
43
- unless Dir.exist? DIRECTORY
44
- mkdir_p DIRECTORY
53
+ unless Dir.exist? directory
54
+ mkdir_p directory
45
55
  end
46
56
 
47
57
  unless File.exist? pipeline_erb_filename
@@ -56,13 +66,7 @@ class Concourse
56
66
  #
57
67
  desc "bootstrap a concourse config"
58
68
  task :init do
59
- FileUtils.mkdir_p "concourse"
60
- FileUtils.mkdir_p "concourse/tasks"
61
- FileUtils.touch pipeline_erb_filename
62
- File.open ".gitignore", "a" do |f|
63
- f.puts "concourse/private.yml"
64
- f.puts "concourse/#{project_name}.final.yml"
65
- end
69
+ rake_init
66
70
  end
67
71
 
68
72
  #
@@ -83,9 +87,9 @@ class Concourse
83
87
  "-p '#{project_name}'",
84
88
  "-c '#{pipeline_filename}'",
85
89
  ]
86
- if File.exist? PRIVATE_VAR_FILE
87
- puts "using #{PRIVATE_VAR_FILE} to resolve template vars"
88
- options << "-l '#{PRIVATE_VAR_FILE}'"
90
+ if File.exist? private_var_file
91
+ puts "using #{private_var_file} to resolve template vars"
92
+ options << "-l '#{private_var_file}'"
89
93
  end
90
94
  sh "fly -t #{fly_target} set-pipeline #{options.join(" ")}"
91
95
  end
@@ -2,5 +2,5 @@ require "rake"
2
2
  require "erb"
3
3
 
4
4
  class Concourse
5
- VERSION = "0.12.0"
5
+ VERSION = "0.13.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concourse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-15 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.6.8
94
+ rubygems_version: 2.6.10
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Rake tasks for Concourse pipelines.