stove 2.0.0 → 3.0.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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +6 -1
- data/CHANGELOG.md +20 -0
- data/README.md +34 -80
- data/Rakefile +9 -1
- data/bin/bake +2 -0
- data/bin/stove +4 -0
- data/features/plugins/community.feature +11 -26
- data/features/plugins/git.feature +17 -6
- data/features/step_definitions/community_steps.rb +3 -1
- data/features/step_definitions/config_steps.rb +4 -21
- data/features/step_definitions/git_steps.rb +38 -1
- data/features/support/env.rb +17 -11
- data/features/support/stove/git.rb +28 -8
- data/lib/stove/cli.rb +72 -53
- data/lib/stove/community.rb +16 -67
- data/lib/stove/config.rb +55 -46
- data/lib/stove/cookbook/metadata.rb +3 -5
- data/lib/stove/cookbook.rb +2 -41
- data/lib/stove/error.rb +37 -8
- data/lib/stove/filter.rb +2 -1
- data/lib/stove/mixins/instanceable.rb +3 -2
- data/lib/stove/mixins/validatable.rb +5 -1
- data/lib/stove/packager.rb +11 -3
- data/lib/stove/plugins/base.rb +26 -13
- data/lib/stove/plugins/community.rb +3 -7
- data/lib/stove/plugins/git.rb +27 -30
- data/lib/stove/rake_task.rb +3 -63
- data/lib/stove/runner.rb +16 -65
- data/lib/stove/validator.rb +7 -6
- data/lib/stove/version.rb +1 -1
- data/lib/stove.rb +3 -21
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/error_spec.rb +148 -0
- data/stove.gemspec +10 -14
- data/templates/errors/abstract_method.erb +5 -0
- data/templates/errors/community_category_validation_failed.erb +5 -0
- data/templates/errors/community_key_validation_failed.erb +3 -0
- data/templates/errors/community_username_validation_failed.erb +3 -0
- data/templates/errors/git_clean_validation_failed.erb +1 -0
- data/templates/errors/git_failed.erb +5 -0
- data/templates/errors/git_repository_validation_failed.erb +3 -0
- data/templates/errors/git_up_to_date_validation_failed.erb +7 -0
- data/templates/errors/metadata_not_found.erb +1 -0
- data/templates/errors/server_unavailable.erb +1 -0
- data/templates/errors/stove_error.erb +1 -0
- metadata +32 -114
- data/features/actions/bump.feature +0 -22
- data/features/actions/changelog.feature +0 -52
- data/features/actions/dev.feature +0 -18
- data/features/actions/upload.feature +0 -26
- data/features/rake.feature +0 -15
- data/features/step_definitions/cli_steps.rb +0 -3
- data/lib/stove/actions/base.rb +0 -21
- data/lib/stove/actions/bump.rb +0 -25
- data/lib/stove/actions/changelog.rb +0 -71
- data/lib/stove/actions/dev.rb +0 -22
- data/lib/stove/actions/finish.rb +0 -8
- data/lib/stove/actions/start.rb +0 -7
- data/lib/stove/actions/upload.rb +0 -11
- data/lib/stove/jira.rb +0 -88
- data/lib/stove/middlewares/chef_authentication.rb +0 -60
- data/lib/stove/middlewares/exceptions.rb +0 -17
- data/lib/stove/mixins/filterable.rb +0 -11
- data/lib/stove/plugins/github.rb +0 -107
- data/lib/stove/plugins/jira.rb +0 -72
- data/locales/en.yml +0 -230
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2054d6ff1813a9e732d90f9758cee5f45b39a5b
|
4
|
+
data.tar.gz: 680226a4dd39d13ceac6e78d8811e69206f7f3b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea199748cab9c2d639c4c12acee0bf5e36334cfe7fcc77850ff60fed204798061901f0ec9fb70cbbeaaaf4d8d701da62b4a3e7ba29328a85d37e943370d0b67
|
7
|
+
data.tar.gz: 42e80c8bae4b0166a71c5709bb9ebd4c1411de9fe58fcd09dc5600cdf65615c82607c76aa78b4cc710a4df949ded7dfe6b86bd9711360de3ef16ea6199462be2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,26 @@ Stove CHANGELOG
|
|
2
2
|
===============
|
3
3
|
This is the Changelog for the Stove gem.
|
4
4
|
|
5
|
+
v3.0.0 (2014-07-07)
|
6
|
+
-------------------
|
7
|
+
- Add support for signed git tags
|
8
|
+
- Require Ruby 1.9+
|
9
|
+
- Remove i18n in favor of ERB
|
10
|
+
- Remove solve gem
|
11
|
+
- Remove GitHub functionality
|
12
|
+
- Remove JIRA functionality
|
13
|
+
- Remove bump and devodd functionality
|
14
|
+
- Clear up confusion on Gemfile vs not Gemfile
|
15
|
+
- Always read tarball objects as binary
|
16
|
+
- End tempfiles in the correct extension (needed to detect mime_types)
|
17
|
+
- Bump required version of ChefAPI gem
|
18
|
+
- Remove unused errors and code
|
19
|
+
- Improved documentation
|
20
|
+
- Remove editor files (`.swp`, etc) before packaging
|
21
|
+
- Upgrade to RSpec 3
|
22
|
+
- Improve test coverage
|
23
|
+
- Publish to Supermarket by default
|
24
|
+
|
5
25
|
v2.0.0 (2014-04-04)
|
6
26
|
-------------------
|
7
27
|
- Completely refactor the runner for speed optimizations
|
data/README.md
CHANGED
@@ -14,111 +14,68 @@ Stove
|
|
14
14
|
|
15
15
|
A utility for releasing and managing Chef Cookbooks. It will:
|
16
16
|
|
17
|
-
-
|
18
|
-
-
|
19
|
-
- Commit and push these changes to git
|
20
|
-
- Create a git tag and push those changes to git
|
21
|
-
- Publish a release to GitHub releases
|
22
|
-
- Upload the cookbook to the Opscode Community Site
|
23
|
-
- Resolve (close) the JIRA tickets
|
17
|
+
- Tag and push a new release to git
|
18
|
+
- Upload the cookbook to a cookbook share (such as Supermarket)
|
24
19
|
|
25
20
|
|
26
21
|
Why?
|
27
22
|
----
|
28
|
-
Existing tools to package cookbooks (such as [Knife Community](https://github.com/miketheman/knife-community) and `knife cookbook site share`) require a dependency on Chef. Because of thier dependency on Chef, they enforce the use of a "cookbook repo". Especially with the evolution of [Berkshelf](https://github.com/RiotGames/berkshelf), cookbooks are individualized artifacts and are often contained in their own repositories. [stove](https://github.com/sethvargo/stove) is **cookbook-centric, rather than Chef-centric**.
|
23
|
+
Existing tools to package cookbooks (such as [Knife Community](https://github.com/miketheman/knife-community) and `knife cookbook site share`) require a dependency on Chef. Because of thier dependency on Chef, they enforce the use of a "cookbook repo". Especially with the evolution of [Berkshelf](https://github.com/RiotGames/berkshelf), cookbooks are individualized artifacts and are often contained in their own repositories. [stove](https://github.com/sethvargo/stove) is **cookbook-centric, rather than Chef-centric**.
|
29
24
|
|
30
25
|
|
31
26
|
Installation
|
32
27
|
------------
|
33
|
-
|
28
|
+
1. Add Stove to your project's Gemfile:
|
34
29
|
|
35
|
-
|
36
|
-
gem 'stove'
|
37
|
-
```
|
30
|
+
gem 'stove'
|
38
31
|
|
39
|
-
|
32
|
+
2. Run the `bundle` command to install:
|
40
33
|
|
41
|
-
|
34
|
+
$ bundle install --binstubs
|
42
35
|
|
43
|
-
The use of some plugins (such as GitHub and JIRA) require a Stove configuration file. The Stove config is a JSON file stored at `~/.stove` on your local hard drive. The schema looks like this:
|
44
36
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
"option": "value"
|
49
|
-
}
|
50
|
-
}
|
51
|
-
```
|
37
|
+
Configuration
|
38
|
+
-------------
|
39
|
+
Stove requires your username and private key to upload a cookbook. You can pass these to each command call, or you can set them Stove:
|
52
40
|
|
53
|
-
|
54
|
-
|
55
|
-
```javascript
|
56
|
-
{
|
57
|
-
"community": {
|
58
|
-
"username": "sethvargo",
|
59
|
-
"key": "~/.chef/sethvargo.pem"
|
60
|
-
},
|
61
|
-
"github": {
|
62
|
-
"access_token": "..."
|
63
|
-
},
|
64
|
-
"jira": {
|
65
|
-
"username": "sethvargo",
|
66
|
-
"password": "..."
|
67
|
-
}
|
68
|
-
}
|
41
|
+
```bash
|
42
|
+
$ stove login --username sethvargo --key ~/.chef/sethvargo.pem
|
69
43
|
```
|
70
44
|
|
71
|
-
|
45
|
+
These values will be saved in Stove's configuration file and persisted across your workstation.
|
72
46
|
|
73
|
-
|
47
|
+
The default publishing endpoint is the [Chef Supermarket](https://supermarket.getchef.com), but this is configurable. If you want to publish to an internal community site, you can specify the `--endpoint` value:
|
48
|
+
|
49
|
+
```bash
|
50
|
+
$ stove --endpoint https://internal-cookbook-store.example.com
|
51
|
+
```
|
74
52
|
|
75
53
|
|
76
54
|
Usage
|
77
55
|
-----
|
78
|
-
|
56
|
+
There are two ways to use Stove. You can either use the `stove` command directly or use the embedded rake task.
|
79
57
|
|
80
|
-
|
58
|
+
### Command
|
59
|
+
Execute the `stove` command from inside the root of a cookbook:
|
81
60
|
|
82
|
-
|
83
|
-
|
84
|
-
```text
|
85
|
-
Usage: bake x.y.z
|
86
|
-
|
87
|
-
Actions:
|
88
|
-
--[no-]bump [Don't] Perform a version bump the local version automatically
|
89
|
-
--[no-]changelog [Don't] Generate and prompt for a CHANGELOG
|
90
|
-
--[no-]dev [Don't] Bump a minor version release for development purposes
|
91
|
-
--[no-]upload [Don't] Execute upload stages of enabled plugins
|
92
|
-
|
93
|
-
Plugins:
|
94
|
-
--[no-]community [Don't] Upload to the community site
|
95
|
-
--[no-]git [Don't] Tag and push to a git remote
|
96
|
-
--[no-]github [Don't] Publish the release to GitHub
|
97
|
-
--[no-]jira [Don't] Resolve JIRA issues
|
98
|
-
|
99
|
-
Global Options:
|
100
|
-
--locale [LANGUAGE] Change the language to output messages
|
101
|
-
--log-level [LEVEL] Set the log verbosity
|
102
|
-
--category [CATEGORY] Set category for the cookbook
|
103
|
-
--path [PATH] Change the path to a cookbook
|
104
|
-
--remote [REMOTE] The name of the git remote to push to
|
105
|
-
--branch [BRANCH] The name of the git branch to push to
|
106
|
-
-h, --help Show this message
|
107
|
-
-v, --version Show version
|
61
|
+
```bash
|
62
|
+
$ bin/stove
|
108
63
|
```
|
109
64
|
|
65
|
+
This will package (as a tarball) the cookbook in the current working directory, tag a new version, push to git, and publish to a cookbook share.
|
110
66
|
|
111
|
-
Rake
|
112
|
-
|
113
|
-
Stove also includes a Rake task you can include in your Rakefile:
|
67
|
+
### Rake task
|
68
|
+
If you are familiar with the Bundler approach to publishing Ruby gems, this approach will feel very familiar. Simply add the following to your `Rakefile`:
|
114
69
|
|
115
70
|
```ruby
|
116
71
|
require 'stove/rake_task'
|
72
|
+
Stove::RakeTask.new
|
73
|
+
```
|
117
74
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
75
|
+
And then use rake to publish the cookbook:
|
76
|
+
|
77
|
+
```bash
|
78
|
+
$ bin/rake publish
|
122
79
|
```
|
123
80
|
|
124
81
|
|
@@ -130,9 +87,6 @@ Contributing
|
|
130
87
|
4. Push to the branch (`git push origin my-new-feature`)
|
131
88
|
5. Create new Pull Request
|
132
89
|
|
133
|
-
TODO:
|
134
|
-
- Secure the authentication file
|
135
|
-
|
136
90
|
|
137
91
|
See Also
|
138
92
|
--------
|
@@ -145,8 +99,8 @@ License & Authors
|
|
145
99
|
- Author: Seth Vargo (sethvargo@gmail.com)
|
146
100
|
|
147
101
|
```text
|
148
|
-
Copyright 2013 Seth Vargo <sethvargo@gmail.com>
|
149
|
-
Copyright 2013
|
102
|
+
Copyright 2013-2014 Seth Vargo <sethvargo@gmail.com>
|
103
|
+
Copyright 2013-2014 Chef Software, Inc
|
150
104
|
|
151
105
|
Licensed under the Apache License, Version 2.0 (the "License");
|
152
106
|
you may not use this file except in compliance with the License.
|
data/Rakefile
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
RSpec::Core::RakeTask.new(:unit) do |t|
|
5
|
+
t.rspec_opts = [].tap do |a|
|
6
|
+
a.push('--color')
|
7
|
+
a.push('--format progress')
|
8
|
+
end.join(' ')
|
9
|
+
end
|
10
|
+
|
3
11
|
require 'cucumber/rake/task'
|
4
12
|
Cucumber::Rake::Task.new(:acceptance) do |t|
|
5
13
|
t.cucumber_opts = [].tap do |a|
|
@@ -11,6 +19,6 @@ Cucumber::Rake::Task.new(:acceptance) do |t|
|
|
11
19
|
end
|
12
20
|
|
13
21
|
desc 'Run all tests'
|
14
|
-
task :test => [:acceptance]
|
22
|
+
task :test => [:unit, :acceptance]
|
15
23
|
|
16
24
|
task :default => [:test]
|
data/bin/bake
CHANGED
data/bin/stove
ADDED
@@ -1,40 +1,25 @@
|
|
1
1
|
Feature: Community
|
2
2
|
Background:
|
3
|
-
* the Stove config is empty
|
4
|
-
* the CLI options are all off
|
5
3
|
* I have a cookbook named "bacon"
|
6
4
|
* I am using the community server
|
7
5
|
|
8
|
-
Scenario: When the configuration does not exist
|
9
|
-
* I run `bake --upload --community`
|
10
|
-
* it should fail with "configuration for the Chef community site does not exist"
|
11
|
-
|
12
6
|
Scenario: When the username does not exist
|
13
|
-
* the Stove config at "
|
14
|
-
* I run `
|
15
|
-
* it should fail with "
|
7
|
+
* the Stove config at "username" is unset
|
8
|
+
* I run `stove --no-git`
|
9
|
+
* it should fail with "requires a username"
|
16
10
|
|
17
11
|
Scenario: When the key does not exist
|
18
|
-
* the Stove config at "
|
19
|
-
* I run `
|
20
|
-
* it should fail with "
|
12
|
+
* the Stove config at "key" is unset
|
13
|
+
* I run `stove --no-git`
|
14
|
+
* it should fail with "requires a private key"
|
21
15
|
|
22
16
|
Scenario: When the category does not exist
|
23
|
-
*
|
24
|
-
* the Stove config at "community.key" is "../../features/support/stove.pem"
|
25
|
-
* I run `bake --upload --community`
|
17
|
+
* I run `stove --no-git`
|
26
18
|
* it should fail with "You did not specify a category"
|
27
19
|
|
28
|
-
Scenario:
|
29
|
-
* the Stove config at "community.username" is "bobo"
|
30
|
-
* the Stove config at "community.key" is "../../features/support/stove.pem"
|
20
|
+
Scenario: With the default parameters
|
31
21
|
* the community server has the cookbook:
|
32
22
|
| bacon | 1.2.3 | Application |
|
33
|
-
* I successfully run `
|
34
|
-
|
35
|
-
|
36
|
-
* the Stove config at "community.username" is "bobo"
|
37
|
-
* the Stove config at "community.key" is "../../features/support/stove.pem"
|
38
|
-
* I successfully run `bake --upload --no-community`
|
39
|
-
* the community server will not have the cookbook:
|
40
|
-
| bacon | | |
|
23
|
+
* I successfully run `stove --no-git`
|
24
|
+
* the community server will have the cookbooks:
|
25
|
+
| bacon | 0.0.0 | Application |
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Feature: git Plugin
|
2
2
|
Background:
|
3
|
-
* the Stove config is empty
|
4
|
-
* the CLI options are all off
|
5
3
|
* I have a cookbook named "bacon"
|
4
|
+
* the community server has the cookbooks:
|
5
|
+
| bacon | 1.0.0 | Application |
|
6
6
|
|
7
7
|
Scenario: When the directory is not a git repository
|
8
|
-
* I run `
|
8
|
+
* I run `stove`
|
9
9
|
* it should fail with "does not appear to be a valid git repository"
|
10
10
|
|
11
11
|
Scenario: When the directory is dirty
|
@@ -14,16 +14,27 @@ Feature: git Plugin
|
|
14
14
|
"""
|
15
15
|
This is new content
|
16
16
|
"""
|
17
|
-
* I run `
|
17
|
+
* I run `stove`
|
18
18
|
* it should fail with "has untracked files"
|
19
19
|
|
20
20
|
Scenario: When the local is out of date with the remote
|
21
21
|
* I have a cookbook named "bacon" with git support
|
22
22
|
* the remote repository has additional commits
|
23
|
-
* I run `
|
23
|
+
* I run `stove -l debug`
|
24
24
|
* it should fail with "out of sync with the remote repository"
|
25
25
|
|
26
26
|
Scenario: When a git upload should be done
|
27
27
|
* I have a cookbook named "bacon" with git support
|
28
|
-
* I successfully run `
|
28
|
+
* I successfully run `stove`
|
29
29
|
* the git remote should have the tag "v0.0.0"
|
30
|
+
|
31
|
+
Scenario: When using signed tags
|
32
|
+
* I have a cookbook named "bacon" with git support
|
33
|
+
* a GPG key exists
|
34
|
+
* I successfully run `stove --sign`
|
35
|
+
* the git remote should have the signed tag "v0.0.0"
|
36
|
+
|
37
|
+
Scenario: With the git plugin disabled
|
38
|
+
* I have a cookbook named "bacon" with git support
|
39
|
+
* I successfully run `stove --no-git`
|
40
|
+
* the git remote should not have the tag "v0.0.0"
|
@@ -1,5 +1,7 @@
|
|
1
1
|
Given /^I am using the community server$/ do
|
2
|
-
set_env('
|
2
|
+
set_env('STOVE_ENDPOINT', CommunityZero::RSpec.url)
|
3
|
+
set_env('STOVE_CLIENT', 'stove')
|
4
|
+
set_env('STOVE_KEY', File.expand_path('../../support/stove.pem', __FILE__))
|
3
5
|
end
|
4
6
|
|
5
7
|
Given /^the community server has the cookbooks?:$/ do |table|
|
@@ -1,24 +1,7 @@
|
|
1
|
-
Given /^the Stove config is
|
2
|
-
|
3
|
-
|
4
|
-
write_file(path, '{}')
|
5
|
-
set_env('STOVE_CONFIG', path)
|
1
|
+
Given /^the Stove config at "(.+)" is "(.+)"/ do |variable, value|
|
2
|
+
Stove::Config.__set__(variable, value)
|
6
3
|
end
|
7
4
|
|
8
|
-
Given /^the Stove config at "(.+)" is
|
9
|
-
|
10
|
-
parents = parts[0...-1]
|
11
|
-
|
12
|
-
path = ENV['STOVE_CONFIG']
|
13
|
-
config = JSON.parse(File.read(path), symbolize_names: true)
|
14
|
-
|
15
|
-
# Vivify the hash
|
16
|
-
parent = parents.inject(config) do |config, parent|
|
17
|
-
config[parent] ||= {}
|
18
|
-
config[parent]
|
19
|
-
end
|
20
|
-
|
21
|
-
parent[parts.last] = value
|
22
|
-
|
23
|
-
File.open(path, 'w') { |f| f.write(JSON.generate(config)) }
|
5
|
+
Given /^the Stove config at "(.+)" is unset/ do |variable|
|
6
|
+
Stove::Config.__unset__(variable)
|
24
7
|
end
|
@@ -9,6 +9,42 @@ Given /^the remote repository has additional commits/ do
|
|
9
9
|
%x|#{cmd}|
|
10
10
|
end
|
11
11
|
|
12
|
+
Given /^a GPG key exists/ do
|
13
|
+
gpg_home = File.join(scratch_dir, '.gnupg')
|
14
|
+
set_env('GNUPGHOME', gpg_home)
|
15
|
+
Dir.mkdir(gpg_home)
|
16
|
+
File.chmod(0700, gpg_home)
|
17
|
+
batch_path = File.join(gpg_home, 'batch')
|
18
|
+
File.write(batch_path, <<-EOH)
|
19
|
+
%pubring #{File.join(gpg_home, 'keyring')}
|
20
|
+
%secring #{File.join(gpg_home, 'keyring.sec')}
|
21
|
+
Key-Type: DSA
|
22
|
+
Key-Length: 832
|
23
|
+
Subkey-Type: ELG-E
|
24
|
+
Subkey-Length: 800
|
25
|
+
Name-Real: Alan Smithee
|
26
|
+
Name-Email: asmithee@example.com
|
27
|
+
Expire-Date: 0
|
28
|
+
%commit
|
29
|
+
EOH
|
30
|
+
gpg_wrapper = File.join(gpg_home, 'gpg_wrapper')
|
31
|
+
File.write(gpg_wrapper, <<-EOH)
|
32
|
+
#!/bin/sh
|
33
|
+
gpg "--keyring=#{File.join(gpg_home, 'keyring')}" "--secret-keyring=#{File.join(gpg_home, 'keyring.sec')}" "$@"
|
34
|
+
EOH
|
35
|
+
File.chmod(0755, gpg_wrapper)
|
36
|
+
|
37
|
+
cmd = [
|
38
|
+
"cd \"#{current_dir}\"",
|
39
|
+
"git config gpg.program #{gpg_wrapper}",
|
40
|
+
'git config user.signingkey asmithee@example.com',
|
41
|
+
"gpg --quiet --batch --gen-key #{batch_path}",
|
42
|
+
].join(' && ')
|
43
|
+
|
44
|
+
%x|#{cmd}|
|
45
|
+
end
|
46
|
+
|
47
|
+
|
12
48
|
Then /^the git remote should( not)? have the commit "(.+)"$/ do |negate, message|
|
13
49
|
commits = git_commits(fake_git_remote)
|
14
50
|
|
@@ -19,12 +55,13 @@ Then /^the git remote should( not)? have the commit "(.+)"$/ do |negate, message
|
|
19
55
|
end
|
20
56
|
end
|
21
57
|
|
22
|
-
Then /^the git remote should( not)? have the tag "(.+)"$/ do |negate, tag|
|
58
|
+
Then /^the git remote should( not)? have the( signed)? tag "(.+)"$/ do |negate, signed, tag|
|
23
59
|
tags = git_tags(fake_git_remote)
|
24
60
|
|
25
61
|
if negate
|
26
62
|
expect(tags).to_not include(tag)
|
27
63
|
else
|
28
64
|
expect(tags).to include(tag)
|
65
|
+
expect(git_tag_signature?(fake_git_remote, tag)).to be_truthy if signed
|
29
66
|
end
|
30
67
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,27 +1,33 @@
|
|
1
|
-
require '
|
1
|
+
require 'stove'
|
2
2
|
|
3
|
-
require 'aruba
|
3
|
+
require 'aruba'
|
4
4
|
require 'aruba/cucumber'
|
5
|
-
require '
|
6
|
-
|
5
|
+
require 'aruba/in_process'
|
6
|
+
|
7
|
+
Aruba::InProcess.main_class = Stove::Cli
|
8
|
+
Aruba.process = Aruba::InProcess
|
7
9
|
|
8
10
|
require 'community_zero/rspec'
|
9
11
|
CommunityZero::RSpec.start
|
10
12
|
Before { CommunityZero::RSpec.reset! }
|
11
13
|
|
12
|
-
require 'stove'
|
13
|
-
|
14
14
|
require File.expand_path('../stove/git', __FILE__)
|
15
15
|
|
16
16
|
World(Aruba::Api)
|
17
17
|
World(Stove::Git)
|
18
18
|
|
19
19
|
Before do
|
20
|
-
|
21
|
-
|
20
|
+
Stove::Config.endpoint = CommunityZero::RSpec.url
|
21
|
+
Stove::Config.username = 'stove'
|
22
|
+
Stove::Config.key = File.expand_path('../stove.pem', __FILE__)
|
23
|
+
end
|
24
|
+
|
25
|
+
Before do
|
26
|
+
FileUtils.rm_rf(scratch_dir)
|
27
|
+
FileUtils.mkdir_p(scratch_dir)
|
22
28
|
end
|
23
29
|
|
24
|
-
# The
|
25
|
-
def
|
26
|
-
File.expand_path(
|
30
|
+
# The scratch directory
|
31
|
+
def scratch_dir
|
32
|
+
@scratch_dir ||= File.expand_path('tmp/aruba/scratch')
|
27
33
|
end
|
@@ -4,7 +4,6 @@ module Stove
|
|
4
4
|
module Git
|
5
5
|
def git_init(path = Dir.pwd)
|
6
6
|
cmd = [
|
7
|
-
'cd "' + path + '"',
|
8
7
|
'git init .',
|
9
8
|
'git add --all',
|
10
9
|
'git commit --message "Initial commit"',
|
@@ -12,37 +11,58 @@ module Stove
|
|
12
11
|
'git push --quiet --force origin master',
|
13
12
|
].join(' && ')
|
14
13
|
|
15
|
-
|
14
|
+
Dir.chdir(path) do
|
15
|
+
%x|#{cmd}|
|
16
|
+
end
|
16
17
|
end
|
17
18
|
|
18
19
|
def fake_git_remote
|
19
|
-
path = File.expand_path(File.join(
|
20
|
+
path = File.expand_path(File.join(remotes_path, 'remote.git'))
|
20
21
|
return path if File.exists?(path)
|
21
22
|
|
22
23
|
FileUtils.mkdir_p(path)
|
23
24
|
cmd = [
|
24
|
-
'cd "' + path + '"',
|
25
25
|
'git init .',
|
26
26
|
'git config receive.denyCurrentBranch ignore',
|
27
27
|
'git config receive.denyNonFastforwards true',
|
28
28
|
'git config core.sharedrepository 1',
|
29
29
|
].join(' && ')
|
30
30
|
|
31
|
-
|
31
|
+
Dir.chdir(path) do
|
32
|
+
%x|#{cmd}|
|
33
|
+
end
|
32
34
|
|
33
35
|
path
|
34
36
|
end
|
35
37
|
|
36
38
|
def git_shas(path)
|
37
|
-
|
39
|
+
Dir.chdir(path) do
|
40
|
+
%x|git log --oneline|.split("\n").map { |line| line.split(/\s+/, 2).first.strip } rescue []
|
41
|
+
end
|
38
42
|
end
|
39
43
|
|
40
44
|
def git_commits(path)
|
41
|
-
|
45
|
+
Dir.chdir(path) do
|
46
|
+
%x|git log --oneline|.split("\n").map { |line| line.split(/\s+/, 2).last.strip } rescue []
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
def git_tags(path)
|
45
|
-
|
51
|
+
Dir.chdir(path) do
|
52
|
+
%x|git tag --list|.split("\n").map(&:strip) rescue []
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def git_tag_signature?(path, tag)
|
57
|
+
Dir.chdir(path) do
|
58
|
+
%x|git show --show-signature #{tag}|.include?('BEGIN PGP SIGNATURE') rescue false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def remotes_path
|
65
|
+
@remotes_path ||= File.join(scratch_dir, 'remotes')
|
46
66
|
end
|
47
67
|
end
|
48
68
|
end
|