Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tweak readme

  • Loading branch information...
commit 00aced6407200b093de1bd1167cf30392c8b0e92 1 parent 5a98bcb
@ddollar ddollar authored
Showing with 46 additions and 41 deletions.
  1. +1 −1  README.md
  2. +4 −3 lib/vulcan/cli.rb
  3. +41 −37 server/web.js
View
2  README.md
@@ -33,7 +33,7 @@ A build server in the cloud.
$ vulcan create vulcan-david
Creating vulcan-david... done, stack is cedar
http://vulcan-david.herokuapp.com/ | git@heroku.com:vulcan-david.git
- ...REDACTED
+ ...
### Build
View
7 lib/vulcan/cli.rb
@@ -25,10 +25,10 @@ class Vulcan::CLI < Thor
def build
app = read_config[:app] || "need a server first, use vulcan create"
- name = options[:name] || File.basename(Dir.pwd)
+ source = options[:source] || Dir.pwd
+ name = options[:name] || File.basename(source)
output = options[:output] || "/tmp/#{name}.tgz"
prefix = options[:prefix] || "/app/vendor/#{name}"
- source = options[:source] || Dir.pwd
command = options[:command] || "./configure --prefix #{prefix} && make install"
server = URI.parse(ENV["MAKE_SERVER"] || "http://#{app}.herokuapp.com")
@@ -41,7 +41,8 @@ def build
request = Net::HTTP::Post::Multipart.new "/make",
"code" => UploadIO.new(input, "application/octet-stream", "input.tgz"),
"command" => command,
- "prefix" => prefix
+ "prefix" => prefix,
+ "secret" => config[:secret]
puts ">> Building with: #{command}"
response = Net::HTTP.start(server.host, server.port) do |http|
View
78 server/web.js
@@ -37,43 +37,47 @@ app.post('/make', function(request, response, next) {
if (err) {
next(err);
} else {
- var id = uuid();
- var command = fields.command;
- var prefix = fields.prefix;
-
- var doc = db.save(id, { command:command, prefix:prefix }, function(err, doc) {
- console.log('err: %s', sys.inspect(err));
- console.log('doc: %s', sys.inspect(doc));
-
- db.saveAttachment(
- doc.id,
- doc.rev,
- 'input',
- 'application/octet-stream',
- fs.createReadStream(files.code.path),
- function(err, data) {
- var ls = spawner.spawn('bin/make ' + id, function(err) {
- console.log('couldnt spawn: ' + err);
- });
-
- ls.on('error', function(error) {
- response.writeHead(500);
- console.log('error: ' + error);
- response.end();
- });
-
- ls.on('data', function(data) {
- response.write(data);
- });
-
- ls.on('exit', function(code) {
- response.end();
- });
- }
- );
-
- response.header('X-Make-Id', id);
- });
+ if (fields.secret != process.env.SECRET) {
+ response.send(500);
+ } else {
+ var id = uuid();
+ var command = fields.command;
+ var prefix = fields.prefix;
+
+ var doc = db.save(id, { command:command, prefix:prefix }, function(err, doc) {
+ console.log('err: %s', sys.inspect(err));
+ console.log('doc: %s', sys.inspect(doc));
+
+ db.saveAttachment(
+ doc.id,
+ doc.rev,
+ 'input',
+ 'application/octet-stream',
+ fs.createReadStream(files.code.path),
+ function(err, data) {
+ var ls = spawner.spawn('bin/make ' + id, function(err) {
+ console.log('couldnt spawn: ' + err);
+ });
+
+ ls.on('error', function(error) {
+ response.writeHead(500);
+ console.log('error: ' + error);
+ response.end();
+ });
+
+ ls.on('data', function(data) {
+ response.write(data);
+ });
+
+ ls.on('exit', function(code) {
+ response.end();
+ });
+ }
+ );
+
+ response.header('X-Make-Id', id);
+ });
+ }
}
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.