-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yegor Bugayenko
committed
Sep 29, 2014
1 parent
7509503
commit ed47569
Showing
10 changed files
with
225 additions
and
8 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
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,3 @@ | ||
default: --format pretty | ||
travis: --format progress | ||
html_report: --format progress --format html --out=features_report.html |
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,12 @@ | ||
Feature: Command Line Processing | ||
As an owner of a repository I want to have an | ||
ability to encrypt my files | ||
|
||
Scenario: Simple encrypting | ||
Given I have a "credentials" file with content: | ||
""" | ||
some secret | ||
""" | ||
When I run bin/rultor with "encrypt -p test/test credentials" | ||
Then Exit code is zero | ||
And Stdout contains "encrypted credentials into credentials.asc" |
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,8 @@ | ||
Feature: Help Banner | ||
As an owner of a repository I want to have an | ||
ability to read help | ||
|
||
Scenario: Help can be printed | ||
When I run bin/rultor with "-h" | ||
Then Exit code is zero | ||
And Stdout contains "Display this help message" |
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,8 @@ | ||
Feature: Help Banner | ||
As an owner of a repository I want to have an | ||
ability to read help | ||
|
||
Scenario: Help can be printed | ||
When I run bin/rultor with "-v" | ||
Then Exit code is zero | ||
And Stdout contains "1.0.snapshot" |
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,22 @@ | ||
Feature: Gem Package | ||
As a source code writer I want to be able to | ||
package the Gem into .gem file | ||
|
||
Scenario: Gem can be packaged | ||
Given I have a "execs.rb" file with content: | ||
""" | ||
#!/usr/bin/env ruby | ||
require 'rubygems' | ||
spec = Gem::Specification::load('./spec.rb') | ||
fail 'no executables' if spec.executables.empty? | ||
""" | ||
When I run bash with | ||
""" | ||
set -e | ||
cd rultor | ||
gem build rultor.gemspec | ||
gem specification --ruby rultor-*.gem > ../spec.rb | ||
cd .. | ||
ruby execs.rb | ||
""" | ||
Then Exit code is zero |
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,78 @@ | ||
# encoding: utf-8 | ||
# | ||
# Copyright (c) 2009-2014, rultor.com | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: 1) Redistributions of source code must retain the above | ||
# copyright notice, this list of conditions and the following | ||
# disclaimer. 2) Redistributions in binary form must reproduce the above | ||
# copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided | ||
# with the distribution. 3) Neither the name of the rultor.com nor | ||
# the names of its contributors may be used to endorse or promote | ||
# products derived from this software without specific prior written | ||
# permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT | ||
# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
# OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require 'rultor' | ||
require 'tmpdir' | ||
require 'English' | ||
|
||
Before do | ||
@cwd = Dir.pwd | ||
@dir = Dir.mktmpdir('test') | ||
FileUtils.mkdir_p(@dir) unless File.exist?(@dir) | ||
Dir.chdir(@dir) | ||
end | ||
|
||
After do | ||
Dir.chdir(@cwd) | ||
FileUtils.rm_rf(@dir) if File.exist?(@dir) | ||
end | ||
|
||
Given(/^I have a "([^"]*)" file with content:$/) do |file, text| | ||
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file) | ||
File.open(file, 'w') do |f| | ||
f.write(text) | ||
end | ||
end | ||
|
||
When(/^I run bin\/rultor with "([^"]*)"$/) do |arg| | ||
home = File.join(File.dirname(__FILE__), '../..') | ||
@stdout = `ruby -I#{home}/lib #{home}/bin/rultor #{arg} 2>&1` | ||
@exitstatus = $CHILD_STATUS.exitstatus | ||
end | ||
|
||
Then(/^Stdout contains "([^"]*)"$/) do |txt| | ||
unless @stdout.include?(txt) | ||
fail "STDOUT doesn't contain '#{txt}':\n#{@stdout}" | ||
end | ||
end | ||
|
||
Then(/^Exit code is zero$/) do | ||
fail "Non-zero exit code #{@exitstatus}:\n#{@stdout}" unless @exitstatus == 0 | ||
end | ||
|
||
Then(/^Exit code is not zero$/) do | ||
fail "Zero exit code:\n#{@stdout}" if @exitstatus == 0 | ||
end | ||
|
||
When(/^I run bash with$/) do |text| | ||
FileUtils.copy_entry(@cwd, File.join(@dir, 'rultor')) | ||
@stdout = `#{text}` | ||
@exitstatus = $CHILD_STATUS.exitstatus | ||
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,34 @@ | ||
# encoding: utf-8 | ||
# | ||
# Copyright (c) 2009-2014, rultor.com | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: 1) Redistributions of source code must retain the above | ||
# copyright notice, this list of conditions and the following | ||
# disclaimer. 2) Redistributions in binary form must reproduce the above | ||
# copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided | ||
# with the distribution. 3) Neither the name of the rultor.com nor | ||
# the names of its contributors may be used to endorse or promote | ||
# products derived from this software without specific prior written | ||
# permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT | ||
# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
# OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require 'simplecov' | ||
require 'rultor' | ||
|
||
Rultor.log = Logger.new(STDOUT) |
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,46 @@ | ||
# encoding: utf-8 | ||
# | ||
# Copyright (c) 2009-2014, rultor.com | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: 1) Redistributions of source code must retain the above | ||
# copyright notice, this list of conditions and the following | ||
# disclaimer. 2) Redistributions in binary form must reproduce the above | ||
# copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided | ||
# with the distribution. 3) Neither the name of the rultor.com nor | ||
# the names of its contributors may be used to endorse or promote | ||
# products derived from this software without specific prior written | ||
# permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT | ||
# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
# OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
# Rultor main module. | ||
# Author:: Yegor Bugayenko (yegor@teamed.io) | ||
# Copyright:: Copyright (c) 2014 Yegor Bugayenko | ||
# License:: BSD | ||
module Rultor | ||
class Encrypt | ||
def initialize(name, file) | ||
@name = name | ||
@file = file | ||
@dest = "#{@file}.asc" | ||
end | ||
def run | ||
Rultor.log.info "encrypted #{@file} into #{@dest} for project #{@name}" | ||
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