Skip to content

Commit

Permalink
Implement dotnet tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaandegeus committed Sep 29, 2016
0 parents commit f87db3a
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in capistrano-bundler.gemspec
gemspec
37 changes: 37 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PATH
remote: .
specs:
capistrano-dotnet (0.1.0)
capistrano (>= 3.0.0)

GEM
remote: https://rubygems.org/
specs:
airbrussh (1.1.1)
sshkit (>= 1.6.1, != 1.7.0)
capistrano (3.6.1)
airbrussh (>= 1.0.0)
capistrano-harrow
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-harrow (0.5.3)
i18n (0.7.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.2.0)
rake (11.3.0)
sshkit (1.11.3)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.3)
capistrano-dotnet!
rake

BUNDLED WITH
1.11.2
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Sebastiaan de Geus, Hoppinger B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Capistrano::dotnet

dotnet support for Capistrano 3.x

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'capistrano', '~> 3.1.0'
gem 'capistrano-dotnet'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-dotnet

## Usage

Require in `Capfile` to use the default task:

```ruby
require 'capistrano/dotnet'
```

The task will run before `deploy:updated` as part of Capistrano's default deploy,
or can be run in isolation with `cap production dotnet:install`

Configurable options:

```ruby
set :dotnet_target_path, -> { release_path.join('subdir') } # default not set
set :dotnet_flags, '--production --silent --no-progress' # default
set :dotnet_roles, :all # default
set :dotnet_env_variables, {} # default
```

### Dependencies

dotnet allows for normal `dependencies` and `devDependencies`. By default this gem uses `'--production --silent --no-progress'` as the install flags which will **only** install `dependencies` and skip `devDependencies`. If you want your `devDependencies` installed as well, then remove `--production`.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'bundler/gem_tasks'
24 changes: 24 additions & 0 deletions capistrano-dotnet.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = 'capistrano-dotnet'
spec.version = '0.1.0'
spec.authors = ['Sebastiaan de Geus']
spec.email = ['[email protected]']
spec.description = %q{.NET Core support for Capistrano 3.x}
spec.summary = %q{.NET Core support for Capistrano 3.x}
spec.homepage = 'https://github.com/hoppinger/capistrano-dotnet'
spec.license = 'MIT'

spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_dependency 'capistrano', '>= 3.0.0'

spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
end
1 change: 1 addition & 0 deletions lib/capistrano-dotnet.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# See capistrano/tasks/dotnet.rake for the capistrano tasks.
1 change: 1 addition & 0 deletions lib/capistrano/dotnet.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
load File.expand_path('../tasks/dotnet.rake', __FILE__)
42 changes: 42 additions & 0 deletions lib/capistrano/tasks/dotnet.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace :dotnet do
desc <<-DESC
Restores the dependencies and tools of a project
Read more on:
https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-restore
DESC
task :restore do
on roles fetch(:dotnet_roles) do
within fetch(:dotnet_target_path, release_path) do
with fetch(:dotnet_env_variables, {}) do
execute :dotnet, 'restore', fetch(:dotnet_flags)
end
end
end
end

desc <<-DESC
Packs the application and all of its dependencies into a folder getting it ready for publishing.
Read more on:
https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-publish
DESC
task :publish do
on roles fetch(:dotnet_roles) do
within fetch(:dotnet_target_path, release_path) do
with fetch(:dotnet_env_variables, {}) do
execute :dotnet, 'publish --output=build --configuration=Release'
end
end
end
end
end

namespace :load do
task :defaults do
set :dotnet_roles, :all
end
end

before 'deploy:updated', 'dotnet:restore'
before 'deploy:updated', 'dotnet:publish'

0 comments on commit f87db3a

Please sign in to comment.