-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from pearkes/add_config_cli_method
Add config cli method
- Loading branch information
Showing
12 changed files
with
112 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ coverage | |
doc/* | ||
log/* | ||
pkg/* | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
sudo: false | ||
language: ruby | ||
rvm: | ||
- 1.9.2 | ||
- 1.9.3 | ||
- 2.0.0 | ||
- 2.1.0 | ||
script: | ||
- "bundle exec rake spec" | ||
- "bundle exec rake features:run" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
require "bundler/gem_tasks" | ||
require 'bundler/gem_tasks' | ||
require 'rspec/core/rake_task' | ||
|
||
require 'cucumber/rake/task' | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
|
||
namespace :features do | ||
Cucumber::Rake::Task.new(:run) do |t| | ||
t.cucumber_opts = %w(--format pretty --order random) | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'aruba/cucumber' | ||
|
||
Before do | ||
|
||
end | ||
|
||
After do | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Feature: config | ||
In order to easily load DigitalOcean config | ||
As a user | ||
I should be able to load tugboat config from a .tugboat in the current directory | ||
|
||
Scenario: | ||
Given a file named ".tugboat" with: | ||
""" | ||
--- | ||
authentication: | ||
client_key: FOO | ||
api_key: BAR | ||
ssh: | ||
ssh_user: janedoe | ||
ssh_key_path: "/Users/janedoe/.ssh/id_rsa" | ||
ssh_port: '22' | ||
defaults: | ||
region: '8' | ||
image: '9801950' | ||
size: '66' | ||
ssh_key: '' | ||
private_networking: 'false' | ||
backups_enabled: 'false' | ||
""" | ||
When I run `tugboat config` | ||
Then the exit status should not be 1 | ||
And the output should contain "ssh_user: janedoe" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Tugboat | ||
module Middleware | ||
# Check if the droplet in the environment is inactive, or "off" | ||
class Config < Base | ||
def call(env) | ||
|
||
config = Tugboat::Configuration.instance | ||
|
||
keys_retracted = '' | ||
|
||
config_data = config.data.to_yaml | ||
|
||
if env["user_hide_keys"] | ||
keys_retracted = '(Keys Redacted)' | ||
config_data = config_data.gsub(/(client_key: )([a-zA-Z0-9]+)/,'\1 [REDACTED]') | ||
config_data = config_data.gsub(/(api_key: )([a-zA-Z0-9]+)/,'\1 [REDACTED]') | ||
end | ||
|
||
say "Current Config #{keys_retracted}", :green | ||
|
||
say "Path: #{config.path}" | ||
say config_data | ||
|
||
@app.call(env) | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters