Browse files

update anvil-cli

  • Loading branch information...
1 parent a44eb45 commit 1cb56787ae94f49bd993cf7c896859dbfc1fe670 @ddollar committed Sep 8, 2013
View
6 vendor/anvil/Gemfile
@@ -1,3 +1,7 @@
-source :rubygems
+source "https://rubygems.org"
gemspec
+
+group :development do
+ gem "rake"
+end
View
8 vendor/anvil/Gemfile.lock
@@ -1,16 +1,17 @@
PATH
remote: .
specs:
- anvil-cli (0.15.0)
+ anvil-cli (0.16.1)
progress (~> 2.4.0)
rest-client (~> 1.6.7)
thor (~> 0.15.2)
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- mime-types (1.19)
+ mime-types (1.21)
progress (2.4.0)
+ rake (0.9.6)
rest-client (1.6.7)
mime-types (>= 1.16)
thor (0.15.4)
@@ -20,3 +21,4 @@ PLATFORMS
DEPENDENCIES
anvil-cli!
+ rake
View
86 vendor/anvil/README.md
@@ -0,0 +1,86 @@
+# anvil
+
+Builds as a service.
+
+## Installation
+
+ $ gem install anvil-cli
+
+## Usage
+
+#### Build an application from a local directory
+
+ $ anvil build .
+ Building ...
+ Success, slug is https://api.anvilworks.org/slugs/000.tgz
+
+#### Build from a public-accessible git repository
+
+ $ anvil build https://github.com/ddollar/anvil.git
+
+#### Specify a buildpack
+
+ # specify a buildpack url
+ $ anvil build https://github.com/ddollar/anvil.git -b https://github.com/heroku/heroku-buildpack-nodejs.git
+
+ # specify a buildpack from https://buildkits.heroku.com/
+ $ anvil build https://github.com/ddollar/anvil.git -b heroku/nodejs
+
+#### Iterate on buildpacks without pushing to Github
+
+ # test a known app against the local buildpack code
+ $ anvil build https://github.com/me/mybuildpack-testapp -b ~/mybuildpack
+
+ # can also use a local app
+ $ anvil build ~/mybuildpack/test/app -b ~/mybuildpack
+
+#### Build using a shell script from a URL
+
+You can use this combination to host build scripts in gists. [Example](https://gist.github.com/ddollar/a2ceb7b9699f05303170)
+
+ $ anvil build \
+ http://downloads.sourceforge.net/project/squashfs/squashfs/squashfs4.2/squashfs4.2.tar.gz \
+ -b https://gist.github.com/ddollar/a2ceb7b9699f05303170/raw/build-squashfs.sh
+
+#### Use the pipelining feature to build complex deploy workflows
+
+This example requires the [heroku-anvil](https://github.com/ddollar/heroku-anvil) plugin.
+
+ #!/usr/bin/env bash
+
+ # fail fast
+ set -o errexit
+ set -o pipefail
+
+ # build a slug of the app
+ slug=$(anvil build https://github.com/my/project.git -p)
+
+ # release the slug to staging
+ heroku release $slug -a myapp-staging
+
+ # run tests using `heroku run`
+ heroku run bin/tests -a myapp-staging
+
+ # test that the app responds via http
+ curl https://myapp-staging.herokuapp.com/test
+
+ # release to production
+ heroku release $slug -a myapp-production
+
+## Advanced Usage
+
+#### anvil build
+
+ Usage: anvil build [SOURCE]
+
+ build software on an anvil build server
+
+ if SOURCE is a local directory, the contents of the directory will be built
+ if SOURCE is a git URL, the contents of the repo will be built
+ if SOURCE is a tarball URL, the contents of the tarball will be built
+
+ SOURCE will default to "."
+
+ -b, --buildpack URL # use a custom buildpack
+ -p, --pipeline # pipe build output to stderr and only put the slug url on stdout
+ -r, --release # release the slug to an app
View
32 vendor/anvil/Rakefile
@@ -0,0 +1,32 @@
+def base_files
+ Dir[File.expand_path("../{bin,data,lib}/**/*", __FILE__)].select do |file|
+ File.file?(file)
+ end
+end
+
+def pkg(filename)
+ FileUtils.mkdir_p("pkg")
+ File.expand_path("../pkg/#{filename}", __FILE__)
+end
+
+def version
+ require "anvil/version"
+ Anvil::VERSION
+end
+
+file pkg("anvil-cli-#{version}.gem") => base_files do |t|
+ sh "gem build anvil-cli.gemspec"
+ sh "mv anvil-cli-#{version}.gem #{t.name}"
+end
+
+task "gem:build" => pkg("anvil-cli-#{version}.gem")
+
+task "gem:clean" do
+ clean pkg("anvil-cli-#{version}.gem")
+end
+
+task "gem:release" => "gem:build" do |t|
+ sh "gem push #{pkg("anvil-cli-#{version}.gem")}"
+ sh "git tag v#{version}"
+ sh "git push origin master --tags"
+end
View
38 vendor/anvil/lib/anvil/builder.rb
@@ -18,7 +18,19 @@ def initialize(source)
def build(options={})
uri = URI.parse("#{anvil_host}/build")
- http = Net::HTTP.new(uri.host, uri.port)
+
+ if uri.scheme == "https"
+ proxy = https_proxy
+ else
+ proxy = http_proxy
+ end
+
+ if proxy
+ proxy_uri = URI.parse(proxy)
+ http = Net::HTTP.new(uri.host, uri.port, proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
+ else
+ http = Net::HTTP.new(uri.host, uri.port)
+ end
if uri.scheme == "https"
http.use_ssl = true
@@ -78,4 +90,28 @@ def anvil_host
ENV["ANVIL_HOST"] || "https://api.anvilworks.org"
end
+ def http_proxy
+ proxy = ENV['HTTP_PROXY'] || ENV['http_proxy']
+ if proxy && !proxy.empty?
+ unless /^[^:]+:\/\// =~ proxy
+ proxy = "http://" + proxy
+ end
+ proxy
+ else
+ nil
+ end
+ end
+
+ def https_proxy
+ proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV["HTTP_PROXY"] || ENV["http_proxy"]
+ if proxy && !proxy.empty?
+ unless /^[^:]+:\/\// =~ proxy
+ proxy = "https://" + proxy
+ end
+ proxy
+ else
+ nil
+ end
+ end
+
end
View
2 vendor/anvil/lib/anvil/cli.rb
@@ -14,7 +14,7 @@ class Anvil::CLI < Thor
desc "build [SOURCE]", "Build an application"
method_option :buildpack, :type => :string, :aliases => "-b", :desc => "Use a specific buildpack"
- method_option :pipeline, :type => :boolean, :aliases => "-p", :desc => "Pipe compile output to stderr and put the slug url on stdout"
+ method_option :pipeline, :type => :boolean, :aliases => "-p", :desc => "Pipe build output to stderr and put the slug url on stdout"
method_option :type, :type => :string, :aliases => "-t", :desc => "Build a specific slug type (tgz, deb)"
def build(source=nil)
View
2 vendor/anvil/lib/anvil/engine.rb
@@ -62,7 +62,7 @@ def self.prepare_buildpack(buildpack)
elsif is_url?(buildpack)
buildpack
elsif buildpack =~ /\A\w+\/\w+\Z/
- "http://codon-buildpacks.s3.amazonaws.com/buildpacks/#{buildpack}.tgz"
+ "https://s3-external-1.amazonaws.com/codon-buildpacks/buildpacks/#{buildpack}.tgz"
elsif File.exists?(buildpack) && File.directory?(buildpack)
manifest = Anvil::Manifest.new(buildpack)
upload_missing manifest, "buildpack"
View
43 vendor/anvil/lib/anvil/manifest.rb
@@ -25,7 +25,24 @@ def initialize(dir=nil, options={})
def build(options={})
uri = URI.parse("#{anvil_host}/manifest/build")
- http = Net::HTTP.new(uri.host, uri.port)
+
+ if uri.scheme == "https"
+ proxy = https_proxy
+ else
+ proxy = http_proxy
+ end
+
+ if proxy
+ proxy_uri = URI.parse(proxy)
+ http = Net::HTTP.new(uri.host, uri.port, proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
+ else
+ http = Net::HTTP.new(uri.host, uri.port)
+ end
+
+ if uri.scheme == "https"
+ http.use_ssl = true
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ end
if uri.scheme == "https"
http.use_ssl = true
@@ -204,4 +221,28 @@ def upload_hashes(hashes, &blk)
threads.each(&:join)
end
+ def http_proxy
+ proxy = ENV['HTTP_PROXY'] || ENV['http_proxy']
+ if proxy && !proxy.empty?
+ unless /^[^:]+:\/\// =~ proxy
+ proxy = "http://" + proxy
+ end
+ proxy
+ else
+ nil
+ end
+ end
+
+ def https_proxy
+ proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV["HTTP_PROXY"] || ENV["http_proxy"]
+ if proxy && !proxy.empty?
+ unless /^[^:]+:\/\// =~ proxy
+ proxy = "https://" + proxy
+ end
+ proxy
+ else
+ nil
+ end
+ end
+
end
View
2 vendor/anvil/lib/anvil/version.rb
@@ -1,3 +1,3 @@
module Anvil
- VERSION = "0.15.0"
+ VERSION = "0.16.1"
end

0 comments on commit 1cb5678

Please sign in to comment.