Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit aab40ab21d5ac326e3bec19fbc44c1a30ec5bd19 @swalkinshaw swalkinshaw committed Jun 5, 2013
Showing with 96 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +4 −0 Gemfile
  3. +41 −0 README.md
  4. +1 −0 Rakefile
  5. +20 −0 capistrano-composer.gemspec
  6. +21 −0 lib/capistrano/composer.rb
  7. +5 −0 lib/capistrano/composer/version.rb
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in capistrano-composer.gemspec
+gemspec
@@ -0,0 +1,41 @@
+# capistrano-composer
+
+capistrano-composer is a [capistrano](https://github.com/capistrano/capistrano) extension that will let you use [Composer](http://getcomposer.org/) to manage your dependencies during your deploy process.
+
+## Installation
+
+1. Install the Gem
+
+ gem install capistrano-composer
+
+Or if you're using Bundler, add it to your `Gemfile`:
+
+```ruby
+gem 'capistrano-composer', github: 'swalkinshaw/composer'
+```
+
+2. Add to `Capfile` or `config/deploy.rb`:
+
+```ruby
+require 'capistrano/composer'
+```
+
+## Usage
+
+Add the task to your `deploy.rb`:
+
+```ruby
+after 'deploy:finalize_update', 'composer:install'
+```
+
+### Tasks
+
+* `composer:install`: Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
+* `composer:update`: Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.
+* `composer:dump_autoload`: Dumps an optimized autoloader.
+
+## Configuration
+
+* `composer_path`: Path to the Composer bin (defaults to `/usr/local/bin/composer`)
+* `composer_options`: Options passed to composer command (defaults to `--no-scripts --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress`)
+
@@ -0,0 +1 @@
+require 'bundler/gem_tasks'
@@ -0,0 +1,20 @@
+# coding: utf-8
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+
+require 'capistrano/composer/version'
+
+Gem::Specification.new do |s|
+ s.name = 'capistrano-composer'
+ s.version = Capistrano::Composer::VERSION
+ s.authors = ['Scott Walkinshaw']
+ s.email = ['scott.walkinshaw@gmail.com']
+ s.homepage = 'https://github.com/swalkinshaw/capistrano-composer'
+ s.summary = %q{Capistrano extension that adds Composer tasks}
+ s.license = 'MIT'
+
+ s.files = `git ls-files`.split($/)
+ s.require_paths = %w(lib)
+
+ s.add_dependency 'capistrano', '>= 2.5.5'
+end
@@ -0,0 +1,21 @@
+Capistrano::Configuration.instance(true).load do
+ set :composer_path, '/usr/local/bin/composer'
+ set :composer_options, '--no-scripts --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress'
+
+ namespace :composer do
+ desc 'Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.'
+ task :install, :roles => :app, :except => { :no_release => true } do
+ try_sudo "cd #{latest_release} && #{composer_path} install #{composer_options}"
+ end
+
+ desc 'Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.'
+ task :update, :roles => :app, :except => { :no_release => true } do
+ try_sudo "cd #{latest_release} && #{composer_path} update #{composer_options}"
+ end
+
+ desc 'Dumps an optimized autoloader.'
+ task :dump_autoload, :roles => :app, :except => { :no_release => true } do
+ try_sudo "cd #{latest_release} && #{composer_path} dump-autoload --optimize"
+ end
+ end
+end
@@ -0,0 +1,5 @@
+module Capistrano
+ module Composer
+ VERSION = '0.0.1'
+ end
+end

0 comments on commit aab40ab

Please sign in to comment.