ronary 1.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.
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ronary.gemspec
4
+ gemspec
@@ -0,0 +1,9 @@
1
+ # ronary
2
+
3
+ ronary is a simple gem that provides a single executable, 'ronary.' ronary is just a thin wrapper around the conary command, and should bet treated exactly as you would treat conary.
4
+
5
+ See [http://docs.rpath.com](http://docs.rpath.com) for more information about conary.
6
+
7
+ ## WTF, why did you do this?
8
+
9
+ The conary command is fond of exiting with non-zero exit codes in the event of minor failures. This makes robustly using conary with some tools (capistrano specifically) quite difficult.
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "open4"
4
+ require "stringio"
5
+
6
+ TAIL_LENGTH = 20
7
+ CONARY_SUBCOMMAND = ARGV[0]
8
+
9
+ pid, stdin, stdout, stderr = Open4.popen4('conary ' + ARGV.join(' '))
10
+
11
+ DESTINATION_STREAMS = {
12
+ stdout => $stdout,
13
+ stderr => $stderr
14
+ }
15
+
16
+ subproc_output = [stdout, stderr]
17
+
18
+ stream_tails = {
19
+ stdout => StringIO.new,
20
+ stderr => StringIO.new
21
+ }
22
+
23
+ while true
24
+ to_read, to_write = IO.select(subproc_output)
25
+
26
+ # ignoring to_write for now.
27
+ to_read.each do |stream|
28
+ next if stream.closed? || stream.eof?
29
+
30
+ data_read = stream.read
31
+
32
+ stream_tails[stream] << data_read
33
+
34
+ lines = stream_tails[stream].string.split('\n')
35
+ stream_tails[stream] = StringIO.new(lines[-TAIL_LENGTH, TAIL_LENGTH].join('\n')) if lines.length > TAIL_LENGTH
36
+
37
+ dest_stream = DESTINATION_STREAMS[stream]
38
+ dest_stream.write(data_read)
39
+ end
40
+
41
+ break if subproc_output.all? {|stream| stream.closed? || stream.eof? }
42
+
43
+ end
44
+
45
+
46
+
47
+ stream_tails.keys.each { |key| stream_tails[key] = stream_tails[key].string }
48
+
49
+ pid, exit_status = Process.wait2(pid)
50
+ conary_exit_status = exit_status.exitstatus
51
+
52
+ ronary_exit_status = case CONARY_SUBCOMMAND
53
+
54
+ when /update/, /updateall/
55
+ 0 if conary_exit_status == 1 && stream_tails[stderr] =~ /^no new troves were found$/
56
+
57
+ end || conary_exit_status
58
+
59
+ exit(ronary_exit_status)
@@ -0,0 +1,3 @@
1
+ module Ronary
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ module Ronary
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "ronary/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ronary"
7
+ s.version = Ronary::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Mitch Williams"]
10
+ s.email = ["mitch@socialcast.com"]
11
+ s.homepage = "http://rubygems.org/gems/ronary"
12
+ s.summary = %q{a simple conary proxy that masks poor exit codes}
13
+ s.description = %q{a simple conary proxy that masks poor exit codes. See http://docs.rpath.com for more information about conary.}
14
+
15
+ s.rubyforge_project = "ronary"
16
+
17
+ s.add_dependency "open4", ">= 1.0.1"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ronary
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Mitch Williams
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-25 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: open4
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 1
34
+ version: 1.0.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: a simple conary proxy that masks poor exit codes. See http://docs.rpath.com for more information about conary.
38
+ email:
39
+ - mitch@socialcast.com
40
+ executables:
41
+ - ronary
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - Gemfile
49
+ - README.markdown
50
+ - Rakefile
51
+ - bin/ronary
52
+ - lib/ronary.rb
53
+ - lib/ronary/version.rb
54
+ - ronary.gemspec
55
+ has_rdoc: true
56
+ homepage: http://rubygems.org/gems/ronary
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options: []
61
+
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ requirements: []
83
+
84
+ rubyforge_project: ronary
85
+ rubygems_version: 1.3.7
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: a simple conary proxy that masks poor exit codes
89
+ test_files: []
90
+