vulcan 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -99,9 +99,14 @@ update the build server
99
99
 
100
100
  File.open(File.expand_path("~/.heroku/plugins/heroku-credentials/init.rb"), "w") do |file|
101
101
  file.puts <<-CONTENTS
102
+ class Heroku::Auth
103
+ def self.api_key
104
+ Heroku::Client.auth(user, password, host)["api_key"]
105
+ end
106
+ end
102
107
  class Heroku::Command::Credentials < Heroku::Command::Base
103
108
  def index
104
- puts Heroku::Auth.password
109
+ puts Heroku::Auth.api_key
105
110
  end
106
111
  end
107
112
  CONTENTS
@@ -118,9 +123,8 @@ update the build server
118
123
  file.puts ".env"
119
124
  file.puts "node_modules"
120
125
  end
121
- system "ls -la"
122
- system "git add ."
123
- system "git commit -m commit"
126
+ system "git add . >/dev/null"
127
+ system "git commit -m commit >/dev/null"
124
128
  system "git push heroku -f master"
125
129
 
126
130
  %x{ env BUNDLE_GEMFILE= heroku config:add SECRET=#{config[:secret]} SPAWN_ENV=heroku HEROKU_APP=#{config[:app]} HEROKU_API_KEY=#{api_key} 2>&1 }
@@ -1,5 +1,5 @@
1
1
  module Vulcan
2
2
 
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.0"
4
4
 
5
5
  end
@@ -6,19 +6,20 @@ ENV["GEM_PATH"] = File.expand_path("../../vendor/gems", __FILE__)
6
6
  require "rubygems"
7
7
 
8
8
  id = ARGV.shift
9
- command = ARGV.shift
10
- prefix = ARGV.shift
11
9
 
12
10
  require "couchrest"
13
11
  require "fileutils"
14
12
  require "tmpdir"
15
13
 
16
- db = CouchRest.database!(ENV["CLOUDANT_URL"] + ":5984/make")
14
+ db = CouchRest.database!(ENV["CLOUDANT_URL"] + "/make")
17
15
 
18
16
  Dir.mktmpdir do |dir|
19
17
  Dir.chdir(dir) do
20
18
  doc = db.get(id)
21
19
 
20
+ command = doc["command"]
21
+ prefix = doc["prefix"]
22
+
22
23
  File.open("input.tgz", "wb") do |file|
23
24
  file.print doc.fetch_attachment("input")
24
25
  end
@@ -34,6 +35,13 @@ Dir.mktmpdir do |dir|
34
35
  %x{ tar czf #{dir}/output.tgz * 2>&1 }
35
36
  end
36
37
 
37
- doc.put_attachment("output", File.open("#{dir}/output.tgz"))
38
+ retries = 0
39
+ begin
40
+ doc.put_attachment("output", File.open("#{dir}/output.tgz"))
41
+ rescue RestClient::Conflict
42
+ retries += 1
43
+ retry if retries < 3
44
+ end
45
+
38
46
  end
39
47
  end
@@ -17,12 +17,17 @@ var app = express.createServer(
17
17
  var couchdb_url = require('url').parse(process.env.CLOUDANT_URL);
18
18
 
19
19
  var couchdb_options = couchdb_url.auth ?
20
- { auth: { username: couchdb_url.auth.split(':')[0], password: couchdb_url.auth.split(':')[1] } } :
20
+ {
21
+ auth: { username: couchdb_url.auth.split(':')[0], password: couchdb_url.auth.split(':')[1] }
22
+ } :
21
23
  { }
22
24
 
23
- var db = new(cradle.Connection)(couchdb_url.host, couchdb_url.port || 5984, couchdb_options).database('make');
25
+ var db = new(cradle.Connection)(couchdb_url.hostname, couchdb_url.port || 5984, couchdb_options).database('make');
24
26
 
25
- db.create();
27
+ db.create(function(err, data) {
28
+ console.log('cerr: %s', err);
29
+ console.log('cdat: %s', data);
30
+ });
26
31
 
27
32
  app.post('/make', function(request, response, next) {
28
33
  if (! request.form) {
@@ -32,8 +37,11 @@ app.post('/make', function(request, response, next) {
32
37
  if (err) {
33
38
  next(err);
34
39
  } else {
35
- var id = uuid();
36
- var doc = db.save(id, {}, function(err, doc) {
40
+ var id = uuid();
41
+ var command = fields.command;
42
+ var prefix = fields.prefix;
43
+
44
+ var doc = db.save(id, { command:command, prefix:prefix }, function(err, doc) {
37
45
  console.log('err: %s', sys.inspect(err));
38
46
  console.log('doc: %s', sys.inspect(doc));
39
47
 
@@ -44,19 +52,14 @@ app.post('/make', function(request, response, next) {
44
52
  'application/octet-stream',
45
53
  fs.createReadStream(files.code.path),
46
54
  function(err, data) {
47
- var command = fields.command;
48
- var prefix = fields.prefix;
49
-
50
- var make_args = [ id, command, prefix ].map(function(arg) {
51
- return('"' + arg + '"');
52
- }).join(' ');
53
-
54
- var ls = spawner.spawn('bin/make ' + make_args, function(err) {
55
+ var ls = spawner.spawn('bin/make ' + id, function(err) {
55
56
  console.log('couldnt spawn: ' + err);
56
57
  });
57
58
 
58
59
  ls.on('error', function(error) {
60
+ response.writeHead(500);
59
61
  console.log('error: ' + error);
62
+ response.end();
60
63
  });
61
64
 
62
65
  ls.on('data', function(data) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vulcan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-21 00:00:00.000000000 Z
12
+ date: 2011-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post
16
- requirement: &70144697507540 !ruby/object:Gem::Requirement
16
+ requirement: &70149200059360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70144697507540
24
+ version_requirements: *70149200059360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rest-client
27
- requirement: &70144697506920 !ruby/object:Gem::Requirement
27
+ requirement: &70149200058680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.7
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70144697506920
35
+ version_requirements: *70149200058680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: thor
38
- requirement: &70144697506220 !ruby/object:Gem::Requirement
38
+ requirement: &70149200057980 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.14.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70144697506220
46
+ version_requirements: *70149200057980
47
47
  description: Build software in the cloud
48
48
  email: ddollar@gmail.com
49
49
  executables: