rakeistrano 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e55cea24bd48e450474a390484515a1c5295c885
4
+ data.tar.gz: 6f1fe99a550792ab0069cd7bce857ac3c3cb5ae0
5
+ SHA512:
6
+ metadata.gz: c4db4e40fd2e03906a83fa235f0faefe26fd7be07fe2a9f2fd3a37bc20a9fdb018c204f46a8cbc45a80e971e61665c3e691999eff6b55ea752f4811d5b726bc2
7
+ data.tar.gz: 9a53cdb7a0d4536311c5ca7bbbf2d28b2707625e8495cded5066dc60b77820e036e3bb94215d66c765b432c6ff3efea4060764842229fce5033eab2bdd2a5f94
@@ -0,0 +1 @@
1
+ *.gem
@@ -0,0 +1,7 @@
1
+ # rakeistrano Changelog
2
+
3
+ Reverse Chronological Order:
4
+
5
+ ## `0.1.0`
6
+
7
+ Initial release.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-bundler.gemspec
4
+ gemspec
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rakeistrano (0.1.0)
5
+ capistrano (>= 3.0.0.pre)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ capistrano (3.4.0)
11
+ i18n
12
+ rake (>= 10.0.0)
13
+ sshkit (~> 1.3)
14
+ colorize (0.7.7)
15
+ i18n (0.7.0)
16
+ net-scp (1.2.1)
17
+ net-ssh (>= 2.6.5)
18
+ net-ssh (2.9.2)
19
+ rake (10.4.2)
20
+ sshkit (1.7.1)
21
+ colorize (>= 0.7.0)
22
+ net-scp (>= 1.1.2)
23
+ net-ssh (>= 2.8.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.3)
30
+ rake
31
+ rakeistrano!
32
+
33
+ BUNDLED WITH
34
+ 1.10.4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2015 PJ Kelly (Crush & Lovely)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,76 @@
1
+ # Rakeistrano
2
+
3
+ A Capistrano 3.x plugin for defining cap tasks that map to your application's Rake tasks.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano', '~> 3.0.0'
11
+ gem 'rakeistrano'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install rakeistrano
21
+
22
+ ## Setup
23
+
24
+ ``` ruby
25
+ require 'rakeistrano'
26
+ ```
27
+
28
+ Then add a file named `config/rakeistrano.yml` in your project using the following format:
29
+
30
+ ``` yaml
31
+ rake_tasks:
32
+ - task: db:seed
33
+ role: :worker # Role to run the task on (optional, defaults to :all)
34
+ primary: true # Whether the task should only be run on the primary of the role specified. (optional, defaults to false)
35
+ ```
36
+
37
+ Only `task` is required. For example, if your YAML configuration looked like this:
38
+
39
+ ``` yaml
40
+ rake_tasks:
41
+ - task: cache:sweep
42
+ - task: refresh:sitemap
43
+ role: :app
44
+ - task: db:update
45
+ role: :worker
46
+ primary: true
47
+ ```
48
+
49
+ The following tasks would be available to you in Capistrano:
50
+
51
+ ``` bash
52
+ $ cap -T
53
+ cap cache:sweep # rake task: rake cache:sweep, role: all, primary: false
54
+ cap refresh:sitemap # rake task: rake refresh:sitemap, role: app, primary: false
55
+ cap db:update # rake task: rake db:update, role: worker, primary: true
56
+ ```
57
+
58
+ You can add as many tasks to this YAML file as you like.
59
+
60
+ ## Usage
61
+
62
+ Once you've set everything up, simply call your tasks directly (`cap cache:sweep`), or add them to your deploy flow:
63
+
64
+ ``` ruby
65
+ namespace :deploy do
66
+ after :publishing, 'cache:sweep'
67
+ end
68
+ ```
69
+
70
+ ## Contributing
71
+
72
+ 1. Fork it
73
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
74
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
75
+ 4. Push to the branch (`git push origin my-new-feature`)
76
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1 @@
1
+ load File.expand_path('../rakeistrano/tasks/rakeistrano.rake', __FILE__)
@@ -0,0 +1,33 @@
1
+ class RakeistranoTask
2
+ attr_reader :name, :role, :primary
3
+
4
+ def initialize(options = {})
5
+ @name = options.fetch('task')
6
+ @role = options.fetch('role', :all).to_sym
7
+ @primary = options.fetch('primary', false)
8
+ end
9
+
10
+ def description
11
+ ["rake task: rake #{name},", "role: #{role},", "primary: #{primary}"].compact.join(' ')
12
+ end
13
+
14
+ def primary?
15
+ primary
16
+ end
17
+ end
18
+
19
+ rake_tasks = YAML.load_file('config/rakeistrano.yml')['rake_tasks'].collect { |t| RakeistranoTask.new(t) }
20
+
21
+ rake_tasks.each do |rake_task|
22
+ desc rake_task.description
23
+ task rake_task.name do
24
+ role_info = rake_task.primary? ? primary(rake_task.role) : roles(rake_task.role)
25
+ on role_info do
26
+ within release_path do
27
+ with :rails_env => fetch(:rails_env) do
28
+ execute :rake, rake_task.name
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rakeistrano'
7
+ spec.version = '0.1.0'
8
+ spec.authors = ['PJ Kelly']
9
+ spec.email = ['pj@crushlovely.com']
10
+ spec.description = %q{A Capistrano 3.x plugin for defining cap tasks that map to your application's Rake tasks.}
11
+ spec.summary = spec.description
12
+ spec.homepage = 'https://github.com/crushlovely/rakeistrano'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_dependency 'capistrano', '>= 3.0.0.pre'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'rake'
24
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rakeistrano
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - PJ Kelly
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0.pre
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0.pre
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A Capistrano 3.x plugin for defining cap tasks that map to your application's
56
+ Rake tasks.
57
+ email:
58
+ - pj@crushlovely.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - CHANGELOG.md
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE
68
+ - README.md
69
+ - Rakefile
70
+ - lib/rakeistrano.rb
71
+ - lib/rakeistrano/tasks/rakeistrano.rake
72
+ - rakeistrano.gemspec
73
+ homepage: https://github.com/crushlovely/rakeistrano
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.4.5
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: A Capistrano 3.x plugin for defining cap tasks that map to your application's
97
+ Rake tasks.
98
+ test_files: []
99
+ has_rdoc: