Skip to content

Commit

Permalink
Initial upgrade of 2.0.0 and new DSL methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Dec 28, 2013
1 parent 673bfee commit 47ad0d6
Show file tree
Hide file tree
Showing 71 changed files with 2,209 additions and 1,275 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
before_script:
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI"
script:
- bundle exec cucumber --color --format progress --strict
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ Stove CHANGELOG
===============
This is the Changelog for the Stove gem.

v2.0.0 (unreleased)
-------------------
- Completely refactor the runner for speed optimizations
- Introduce a new configuration file format
- Add i18n support
- Add Filters and validations that execute before any commands are run
- Autoload plugins and actions
- Improve help output by grouping options
- Trap Signal interrupts cleanly
- Remove formatters
- Switch to log4r
- Introduce significantly more logging and log levels
- Remove HTTParty & Jiralicious in favor or Faraday
- Improve rake task to automatically perfom a minor bump when no version if given
- Persist data across the cookbook object
- Use singleton classes to save memory and loadtime

v1.1.0
------
Expand Down
70 changes: 41 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,56 +33,68 @@ Alternatively, you may install it as a gem:

$ gem install stove

Create a special JIRA credentials file at '~/.stove' that has the following JSON:
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:

```javascript
{
"jira_username": "JIRA_USERNAME",
"jira_password": "JIRA_PASSWORD",
"opscode_username": "OPSCODE_USERNAME",
"opscode_pem_file": "OPSCODE_PEM_FILE",
"github_access_token": "PERSONAL_API_TOKEN"
"field": {
"option": "value"
}
}
```

- `jira_username` - The username used to login to Opscode's JIRA
- `jira_password` - The password used to login to Opscode's JIRA
- `opscode_username` - The username used to login to Opscode's Community Site
- `opscode_password` - The password used to login to Opscode's Community Site
- `github_access_token` - Your personal access token for the GitHub API

For example:
For example, my local Stove configuration looks like this:

```javascript
{
"jira_username": "sethvargo",
"jira_password": "bAc0ñ",
"opscode_username": "sethvargo",
"opscode_pem_file": "~/.chef/sethvargo.pem",
"github_access_token": "abcdefg1234567"
"community": {
"username": "sethvargo",
"key": "~/.chef/sethvargo.pem"
},
"github": {
"access_token": "..."
},
"jira": {
"username": "sethvargo",
"password": "..."
}
}
```

If you are using Stove 1.0, you need to update your configuration file syntax.

**It is recommended that the permissions on this file be 0600 to prevent unauthorized reading!**


Usage
-----
The gem is packaged as a binary. It should be run from _inside the cookbook to release_:

(~/cookbooks/bacon) $ bake 1.2.3

You can always use the `--help` flag to get information:

```text
Usage: bake x.y.z
-l, --log-level [LEVEL] Ruby log level
-c, --category [CATEGORY] The category for the cookbook (optional for existing cookbooks)
-p, --path [PATH] The path to the cookbook to release (default: PWD)
--[no-]git Automatically tag and push to git (default: true)
--[no-]github Automatically release to GitHub (default: true)
-r, --remote The name of the git remote to push to
-b, --branch The name of the git branch to push to
--[no-]devodd Automatically bump the metadata for devodd releases
--[no-]jira Automatically populate the CHANGELOG from JIRA tickets and close them (default: false)
--[no-]upload Upload the cookbook to the Opscode Community Site (default: true)
--[no-]changelog Automatically generate a CHANGELOG (default: true)
Actions:
--no-bump Perform a version bump the local version automatically
--no-changelog Generate and prompt for a CHANGELOG
--no-dev Bump a minor version release for development purposes
--no-upload Upload the cookbook to the community site
Plugins:
--no-git Tag and push to a git remote
--no-github Publish the release to GitHub
--no-jira Resolve JIRA issues
Global Options:
--locale [LANGUAGE] Change the language to output messages
--log-level [LEVEL] Set the log verbosity
--category [CATEGORY] Set category for the cookbook
--path [PATH] Change the path to a cookbook
--remote [REMOTE] The name of the git remote to push to
--branch [BRANCH] The name of the git branch to push to
-h, --help Show this message
-v, --version Show version
```
Expand Down
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
require 'bundler/gem_tasks'

require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:acceptance) do |t|
t.cucumber_opts = [].tap do |a|
a.push('--color')
a.push('--format progress')
a.push('--strict')
a.push('--tags ~@wip')
end.join(' ')
end

desc 'Run all tests'
task :test => [:acceptance]

task :default => [:test]
3 changes: 1 addition & 2 deletions bin/bake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby

$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
require 'stove/cli'
require 'stove'
Stove::Cli.new(ARGV.dup).execute!
22 changes: 22 additions & 0 deletions features/actions/bump.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: Bump
Background:
* the Stove config is empty
* the CLI options are all off
* I have a cookbook named "bacon" at version "1.0.0"

Scenario: When the version has not changed
* I run `bake 1.0.0 --bump`
* it should fail with "version you are trying to bump already exists"

Scenario: When the version is not greater than the current
* I run `bake 0.1.0 --bump`
* it should fail with "bump to is less than the existing version"

Scenario: In isolation
* I successfully run `bake 2.0.0 --bump`
* the file "metadata.rb" should contain "2.0.0"

Scenario: With the git plugin
* I have a cookbook named "bacon" with git support
* I successfully run `bake 1.0.0 --bump --git`
* the git remote should have the commit "Version bump to 1.0.0"
45 changes: 45 additions & 0 deletions features/actions/changelog.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Feature: Changelog
Background:
* the Stove config is empty
* the CLI options are all off
* I have a cookbook named "bacon"

Scenario: When the Changelog does not exist
* I remove the file "CHANGELOG.md"
* I run `bake --changelog`
* it should fail with "There is no `CHANGELOG.md' found"

Scenario: When the Changelog is not a proper format
* I write to "CHANGELOG.md" with:
"""
This can't possibly be a valid Changelog
"""
* I run `bake --changelog`
* it should fail with "does not appear to be a valid format"

Scenario: When the $EDITOR is not set
* the environment variable "EDITOR" is unset
* I run `bake --changelog`
* it should fail with "The `$EDITOR' environment variable is not set"

Scenario: In isolation
* the environment variable "EDITOR" is "cat"
* I successfully run `bake --changelog`
* the file "CHANGELOG.md" should contain "v0.0.0"

Scenario: With bump
* the environment variable "EDITOR" is "cat"
* I successfully run `bake 1.0.0 --changelog --bump`
* the file "CHANGELOG.md" should contain "v1.0.0"

Scenario: With the git plugin
* I have a cookbook named "bacon" with git support
* the environment variable "EDITOR" is "cat"
* I successfully run `bake --changelog --git`
* the git remote should have the commit "Publish 0.0.0 Changelog"

@wip
Scenario: With the GitHub plugin

@wip
Scenario: With the JIRA plugin
18 changes: 18 additions & 0 deletions features/actions/dev.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: Dev
Background:
* the Stove config is empty
* the CLI options are all off
* I have a cookbook named "bacon" at version "1.0.0"

Scenario: In isolation
* I successfully run `bake --dev`
* the file "metadata.rb" should contain "1.0.1"

Scenario: With bump
* I successfully run `bake 2.0.0 --bump --dev`
* the file "metadata.rb" should contain "2.0.1"

Scenario: With the git plugin
* I have a cookbook named "bacon" with git support
* I successfully run `bake --dev --git`
* the git remote should have the commit "Version bump to 0.0.1 (for development)"
48 changes: 48 additions & 0 deletions features/actions/upload.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Feature: Upload
Background:
* the Stove config is empty
* the CLI options are all off
* I have a cookbook named "bacon"
* I am using the community server

Scenario: When the configuration does not exist
* I run `bake --upload`
* it should fail with "configuration for the Chef community site does not exist"

Scenario: When the username does not exist
* the Stove config at "community._" is ""
* I run `bake --upload`
* it should fail with "does not contain a username"

Scenario: When the key does not exist
* the Stove config at "community.username" is "bobo"
* I run `bake --upload`
* it should fail with "does not contain a key"

Scenario: When the category does not exist
* the Stove config at "community.username" is "bobo"
* the Stove config at "community.key" is "../../features/support/stove.pem"
* I run `bake --upload`
* it should fail with "You did not specify a category"

Scenario: In isolation
* the Stove config at "community.username" is "bobo"
* the Stove config at "community.key" is "../../features/support/stove.pem"
* the community server has the cookbook:
| bacon | 1.2.3 | Application |
* I successfully run `bake --upload`

Scenario: With the git plugin
* I have a cookbook named "bacon" with git support
* the Stove config at "community.username" is "bobo"
* the Stove config at "community.key" is "../../features/support/stove.pem"
* the community server has the cookbook:
| bacon | 1.2.3 | Application |
* I successfully run `bake --git --upload`
* the git remote should have the tag "v0.0.0"

@wip
Scenario: With the GitHub plugin

@wip
Scenario: With the JIRA plugin
22 changes: 0 additions & 22 deletions features/changelog.feature

This file was deleted.

11 changes: 0 additions & 11 deletions features/cli.feature

This file was deleted.

19 changes: 0 additions & 19 deletions features/devodd.feature

This file was deleted.

34 changes: 0 additions & 34 deletions features/git.feature

This file was deleted.

Loading

0 comments on commit 47ad0d6

Please sign in to comment.