ginst 2009.11.24 → 2009.12.8

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2009.11.24
1
+ 2009.12.8
@@ -139,30 +139,49 @@ class Task < ActiveRecord::Base
139
139
 
140
140
 
141
141
  def run_shell!
142
+
143
+
142
144
  buff = ''
143
145
  logger "Running #{code}"
144
- process_status = Open4.popen4(code) do |pid, stdin, stdout, stderr|
146
+
147
+ # set_trace_func proc { |event, file, line, id, binding, classname|
148
+ # unless file =~ /rails/ || (@_last_file == file && @_last_line == line)
149
+ # @_last_file = file
150
+ # @_last_line = line
151
+ # content = File.read(file).split("\n")[line.to_i-1] rescue ' (not available) '
152
+ # file = File.basename(file) rescue file
153
+ # printf "%8s %s:%-2d %10s %8s | %s\n", event, file , line, id, classname, content
154
+ # end
155
+ # }
156
+
157
+ process_status = Open4.popen4('cat | sh 2>&1') do |pid, stdin, stdout, stderr|
158
+ stdin.write code
159
+ stdin.close
160
+
145
161
  update_attributes(:pid => pid)
146
162
 
147
163
  # Incremental update of the database
148
- inputs = [stdout,stderr]
149
- while ( !inputs.empty? ) do
150
- select(inputs).first.each do |input|
164
+ begin
165
+ loop do
151
166
  begin
152
- buff += input.read_nonblock(99999999)
167
+ buff += stdout.read_nonblock(99999999)
153
168
  update_attribute(:output, buff) if output != buff && Time.now.to_i > updated_at.to_i + DATABASE_UPDATE_INTERVAL
154
- rescue EOFError
155
- logger "EOFError. removing #{stdout == input ? 'stdout' : 'stderr'} input"
156
- inputs.delete input
157
- end
169
+ rescue Errno::EAGAIN
170
+ sleep 0.5
171
+ end
158
172
  end
173
+ rescue EOFError
174
+
159
175
  end
160
176
  update_attribute(:output, buff) if output != buff
161
177
 
162
178
 
163
179
  end
180
+
181
+ set_trace_func nil
164
182
  process_status.exitstatus
165
183
  ensure
184
+ set_trace_func nil
166
185
  self.update_attributes(:output => buff,:pid => nil, :exit_code => (process_status && process_status.exitstatus))
167
186
  end
168
187
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ginst}
8
- s.version = "2009.11.24"
8
+ s.version = "2009.12.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Guillermo \303\201lvarez Fern\303\241ndez"]
12
- s.date = %q{2009-11-24}
12
+ s.date = %q{2009-12-10}
13
13
  s.default_executable = %q{ginst}
14
14
  s.description = %q{GINST is the new integration system}
15
15
  s.email = %q{guillermo@cientifico.net}
@@ -3,10 +3,7 @@
3
3
  class Ginst::Logger
4
4
 
5
5
  def initialize(file)
6
- @filename = file
7
- @file = File.open(file,'a')
8
- @file.sync = true
9
-
6
+ @filename = file
10
7
  ObjectSpace.define_finalizer(self) do
11
8
  puts self.class.to_s
12
9
  puts 'Cerrando log file'
@@ -17,7 +14,7 @@ class Ginst::Logger
17
14
  def log(msg,acaller = nil)
18
15
  acaller ||= caller
19
16
  msg = format_msg(msg,acaller)
20
- @file.write(msg)
17
+ write(msg)
21
18
  msg
22
19
  end
23
20
 
@@ -26,6 +23,12 @@ class Ginst::Logger
26
23
  call = File.basename(caller.first).split(":")[0..1].join(":")
27
24
  "[%s %s] %s\n" % [Time.now.to_s, call, msg]
28
25
  end
26
+ private
27
+ def write(msg)
28
+ File.open(@filename,'a') do |f|
29
+ f.write msg
30
+ end
31
+ end
29
32
  end
30
33
 
31
34
 
@@ -481,4 +481,48 @@ p.status.fail {
481
481
  color: #ccc;
482
482
  }
483
483
 
484
- /* @end */
484
+ /* @end */
485
+
486
+ /* @group SimpleBuild */
487
+
488
+ .new_simple_build input {
489
+ border: 0.1em outset rgb(190, 220, 231);
490
+ -moz-border-radius: 0.5em;
491
+ -webkit-border-radius: 0.5em;
492
+ background-color:darksalmon ;
493
+ float: right;
494
+ padding: 0.5em 0.8em;
495
+ margin-top: -1.9em;
496
+ margin-bottom: -2em;
497
+ }
498
+
499
+
500
+ /* @end */
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ginst
3
3
  version: !ruby/object:Gem::Version
4
- version: 2009.11.24
4
+ version: 2009.12.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Guillermo \xC3\x81lvarez Fern\xC3\xA1ndez"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-24 00:00:00 +01:00
12
+ date: 2009-12-10 00:00:00 +01:00
13
13
  default_executable: ginst
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency