berkflow 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82119c15270ae75c0a17ead97c9ad4bc3ff6d6d9
4
- data.tar.gz: 688c26a208667342e4dc725fb180e5798370f08c
3
+ metadata.gz: 197296b77edc263b1aa7ea524b13568b47d65c5c
4
+ data.tar.gz: c64d9d73d6e5e731825859861a5d6e8847080ad1
5
5
  SHA512:
6
- metadata.gz: fff28fe3baf00be3725ac469b7b55ef4aeb06fa5a437926db961b66001ecbb83d1aee81732a0853d9100da3bb156cef1c9abb18829f6cf19679055d17441bf2d
7
- data.tar.gz: f20e9c7ecada439295c2809f5f1ce10d94dc13e2c0147d86c7e7e83b4b0189bf0036907a4bb3810e8fd51a05137c92684073e013cf0e62e725051329cd1573e5
6
+ metadata.gz: 3c8cb94f4bf982781bac37cb5f992ca14534d5adb63653839a1e68b8ce28184ae41ae75d1729323e519eb0258eafba7d176b4c9b7f2091a1c6306f738d95f6e1
7
+ data.tar.gz: 96c30d2b5779f7acd155b2e42595a79d9dad84440d6f25b8b6386474e34dbec250a327e5b720222952ea51991a46f43f26295c59afed1c4dd1b5ff6250ceefd6
@@ -1,3 +1,13 @@
1
+ # 0.4.0
2
+
3
+ * Enhancements
4
+ * Finalize support for Berkshelf 3.0
5
+
6
+ # 0.3.0
7
+
8
+ * Enhancements
9
+ * Lock gem dependencies to stable versions
10
+
1
11
  # 0.2.0
2
12
 
3
13
  * Features
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Berkflow
2
2
 
3
- A command line tool for managing Chef Environments using Berkshelf and the [Environment Cookbook Pattern](http://vialstudios.logdown.com/posts/166848-the-environment-cookbook-pattern).
3
+ A command line tool for managing Chef Environments using Berkshelf and the [Environment Cookbook Pattern](http://blog.vialstudios.com/the-environment-cookbook-pattern/).
4
4
 
5
5
  > TLDR of the Environment Cookbook Pattern; You have one top level cookbook that is locked to a Chef Environment. One application per Chef Environment. This Chef Environment is named `{application_name}-{environment}` (i.e. "myface-dev").
6
6
 
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "semverse", "~> 1.1"
22
- spec.add_dependency "berkshelf", "~> 3.0.0.beta9"
22
+ spec.add_dependency "berkshelf", "~> 3.0"
23
23
  spec.add_dependency "ridley", "~> 3.0"
24
24
  spec.add_dependency "ridley-connectors", "~> 2.0"
25
- spec.add_dependency "thor", "~> 0.18"
25
+ spec.add_dependency "thor", "~> 0.18"
26
+ spec.add_dependency "octokit", "~> 2.6"
26
27
 
27
28
  spec.add_development_dependency "bundler", "~> 1.5"
28
29
  spec.add_development_dependency "rake"
@@ -220,6 +220,7 @@ module Berkflow
220
220
  exit(1)
221
221
  end
222
222
 
223
+ say "Upgrading #{environment} to #{cookbook.version}"
223
224
  say "Applying cookbook locks to #{environment}..."
224
225
  lockfile = Berkshelf::Lockfile.from_file(file.path)
225
226
  unless lockfile.apply(environment)
@@ -0,0 +1,58 @@
1
+ require 'berkshelf'
2
+ require 'octokit'
3
+ require 'ridley/chef/cookbook'
4
+
5
+ module Berkflow
6
+ class ThorTasks < Thor
7
+ namespace "blo"
8
+
9
+ REGEX = /(git\@github.com\:|https\:\/\/github.com\/)(.+).git/.freeze
10
+
11
+ method_option :berksfile,
12
+ type: :string,
13
+ default: Berkshelf::DEFAULT_FILENAME,
14
+ desc: "Path to a Berksfile to operate off of.",
15
+ aliases: "-b",
16
+ banner: "PATH"
17
+ method_option :github_token,
18
+ type: :string,
19
+ default: ENV["GITHUB_TOKEN"],
20
+ required: true,
21
+ aliases: "-t",
22
+ banner: "TOKEN"
23
+ desc "release", "Create a Github Release for the current cookbook version."
24
+ def release
25
+ cookbook = Ridley::Chef::Cookbook.from_path(File.dirname(options[:berksfile]))
26
+ version = "v#{cookbook.version}"
27
+ begin
28
+ release = github_client.create_release(repository, version)
29
+ rescue Octokit::UnprocessableEntity
30
+ release = github_client.releases(repository).find { |release| release[:tag_name] == version }
31
+ end
32
+
33
+ berksfile = Berkshelf::Berksfile.from_file(options[:berksfile])
34
+ pkg_dir = File.join(File.dirname(File.expand_path(berksfile.filepath)), "pkg")
35
+ out_file = File.join(pkg_dir, "cookbooks-#{Time.now.to_i}.tar.gz")
36
+ FileUtils.mkdir_p(pkg_dir)
37
+ berksfile.package(out_file)
38
+
39
+ say "Uploading #{File.basename(out_file)} to Github..."
40
+ github_client.upload_asset(release[:url], out_file, name: "cookbooks.tar.gz", content_type: "application/x-tar")
41
+ end
42
+
43
+ private
44
+
45
+ def github_client
46
+ @github_client ||= Octokit::Client.new(access_token: options[:github_token])
47
+ end
48
+
49
+ def repository
50
+ @repository ||= extract_repository
51
+ end
52
+
53
+ def extract_repository
54
+ _, repository = `git remote show origin | grep Push`.scan(REGEX).first
55
+ repository
56
+ end
57
+ end
58
+ end
@@ -1,3 +1,3 @@
1
1
  module Berkflow
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-07 00:00:00.000000000 Z
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semverse
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0.beta9
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0.beta9
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ridley
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.18'
83
+ - !ruby/object:Gem::Dependency
84
+ name: octokit
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.6'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.6'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +141,7 @@ files:
127
141
  - bin/blo
128
142
  - lib/berkflow.rb
129
143
  - lib/berkflow/cli.rb
144
+ - lib/berkflow/thor_tasks.rb
130
145
  - lib/berkflow/version.rb
131
146
  homepage: https://github.com/reset/berkflow
132
147
  licenses: