Skip to content

Commit

Permalink
#1 build is clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Sep 29, 2014
1 parent f9e42e6 commit 88337f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@
require 'simplecov'
require 'rultor'

Rultor.log.info 'logging to stdout'
Rultor.log = Logger.new(STDOUT)
4 changes: 2 additions & 2 deletions lib/rultor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ module Rultor
def self.log
unless @log
@log = Logger.new(STDOUT)
@log.formatter = proc { |severity, _, _, msg|
puts "#{severity}: #{msg.dump}"
@log.formatter = proc { |_, _, _, msg|
puts "#{msg.dump}"
}
end
@log
Expand Down
19 changes: 12 additions & 7 deletions lib/rultor/encrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,34 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.

require 'English'

# Rultor main module.
# Author:: Yegor Bugayenko (yegor@teamed.io)
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
# License:: BSD
module Rultor
# Encrypting command
class Encrypt
def initialize(name, file)
@name = name
@file = file
@dest = "#{@file}.asc"
end

def run
%x{
system(
"
set -x
set -e
gpg --keyserver hkp://pool.sks-keyservers.net \
--verbose --recv-keys 9AF0FA4C
gpg --trust-model always --output "#{@dest}" \
--batch --armor --encrypt --verbose --recipient 9AF0FA4C "#{@file}"
}
if $?.exitstatus != 0
raise 'Failed to PGP encrypt'
end
gpg --trust-model always --output '#{@dest}' \
--batch --armor --encrypt --verbose --recipient 9AF0FA4C '#{@file}'
"
)
fail 'Failed to PGP encrypt' unless $CHILD_STATUS.exitstatus == 0
Rultor.log.info "#{@file} encrypted"
end
end
end
2 changes: 1 addition & 1 deletion test/test_rultor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
# License:: BSD
class TestRultor < Minitest::Test
def test_basic
# later
Rultor.log.info 'log works'
end
end

0 comments on commit 88337f8

Please sign in to comment.