capistrano-multi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f63fea3e5d505ac41ee496f910d993c330c852a
4
+ data.tar.gz: 94e1f06aaa1fca0924cb0fd1b6e1509bfc169619
5
+ SHA512:
6
+ metadata.gz: 53251c0f7b2a15bffa5439cd46b3861fb1b6985022a9098b3739d5f2c3a9f266a5a84d771ab9f30c8ed86a30410e39faa3695befbaa0d0b9e443ba837a3bfa15
7
+ data.tar.gz: f7e5c12d0b04eac3fcc3ec08523c79690a1bdf126964969c6cedcd0475b4ffa4bf6408c879cc2e787c9b51ac7aa05bb950b83d8745cbd81a6ba42dc84dded5fd
data/.gitignore ADDED
@@ -0,0 +1,58 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ *.gem
12
+
13
+ ### JetBrains template
14
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
15
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
16
+
17
+ .idea/
18
+
19
+ # User-specific stuff:
20
+ .idea/**/workspace.xml
21
+ .idea/**/tasks.xml
22
+ .idea/dictionaries
23
+
24
+ # Sensitive or high-churn files:
25
+ .idea/**/dataSources/
26
+ .idea/**/dataSources.ids
27
+ .idea/**/dataSources.xml
28
+ .idea/**/dataSources.local.xml
29
+ .idea/**/sqlDataSources.xml
30
+ .idea/**/dynamic.xml
31
+ .idea/**/uiDesigner.xml
32
+
33
+ # Gradle:
34
+ .idea/**/gradle.xml
35
+ .idea/**/libraries
36
+
37
+ # Mongo Explorer plugin:
38
+ .idea/**/mongoSettings.xml
39
+
40
+ ## File-based project format:
41
+ *.iws
42
+
43
+ ## Plugin-specific files:
44
+
45
+ # IntelliJ
46
+ /out/
47
+
48
+ # mpeltonen/sbt-idea plugin
49
+ .idea_modules/
50
+
51
+ # JIRA plugin
52
+ atlassian-ide-plugin.xml
53
+
54
+ # Crashlytics plugin (for Android Studio and IntelliJ)
55
+ com_crashlytics_export_strings.xml
56
+ crashlytics.properties
57
+ crashlytics-build.properties
58
+ fabric.properties
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-multi.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Guillaume GIORDANA
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.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Capistrano::Multi::Projects
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/capistrano/multi/projects`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'capistrano-multi'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install capistrano-multi
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capistrano-multi-projects.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/multi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-multi"
8
+ spec.version = Capistrano::Multi::VERSION
9
+ spec.authors = ["Guillaume GIORDANA"]
10
+ spec.email = ["guillaume.giordana@the-oz.com"]
11
+
12
+ spec.summary = %q{Add multiple project folder to a capistrano project.}
13
+ spec.description = %q{}
14
+ spec.homepage = "https://github.com/guillaumegiordana/capistrano-multi"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Multi
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require 'capistrano/multi/version'
2
+
3
+ # Core tasks for deploying magento
4
+ load File.expand_path('../tasks/multi.rake', __FILE__)
@@ -0,0 +1,110 @@
1
+ module Capistrano
2
+ class FileNotFound < StandardError
3
+ end
4
+ end
5
+
6
+ namespace :deploy do
7
+
8
+ desc 'Choose project to deploy'
9
+ task :set_project do
10
+
11
+ if fetch(:project).nil?
12
+
13
+ found_projects = {}
14
+ nb_project = 1
15
+
16
+ # We get all the multi in the directory
17
+ projects = fetch(:projects).sort.to_h
18
+
19
+ # For each projets, we set the needed configuration
20
+ projects.each do |current_project|
21
+ found_projects[nb_project] = current_project[0].to_s
22
+ nb_project += 1
23
+ end
24
+
25
+ # If project parameter is set, we don't need to ask for it
26
+ if ENV['project']
27
+ set :project_num, ENV['project']
28
+ else
29
+
30
+ puts '================================='
31
+ puts '| N° | PROJECT'
32
+ puts '================================='
33
+ found_projects.each do |number, project|
34
+ puts '| %.2i' %number.to_s+" | #{project.to_s}"
35
+ end
36
+
37
+ begin
38
+ ask(:project_num, 'number')
39
+ fetch(:project_num)
40
+ end while !Integer(fetch(:project_num)) ||
41
+ Integer(fetch(:project_num)) <= 0 ||
42
+ Integer(fetch(:project_num)) > projects.length
43
+
44
+ end
45
+
46
+ set :project, found_projects[fetch(:project_num).to_i]
47
+
48
+ if fetch(:use_custom_deploy_to) && fetch(:deploy_to)
49
+ set :deploy_to, "#{fetch(:deploy_to).to_s}/#{fetch(:project).to_s}/#{fetch(:application)}"
50
+ end
51
+
52
+ end
53
+
54
+ end
55
+
56
+
57
+ desc 'Copy files for the project'
58
+ task :copy_files do
59
+ current_project = fetch(:project).to_s
60
+
61
+ on roles(:all) do
62
+ within "#{release_path}/#{fetch(:config_dir)}/#{fetch(:stage)}/#{current_project}" do
63
+ set :linked_files, []
64
+ files = capture :find, '.', '-type', 'f', '|', 'cut', '-b', '3-'
65
+
66
+ files = files.split("\n")
67
+ files.each do |file|
68
+ file = Pathname.new file
69
+ execute :mkdir, '-p', release_path.join(file.dirname)
70
+ execute :mv, file, release_path.join(file.dirname)
71
+ end
72
+ end
73
+
74
+ within release_path do
75
+ execute :rm, '-Rf', fetch(:config_dir)
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+
82
+ desc 'Set server group to deploy'
83
+ task :set_server_group do
84
+
85
+ server_groups = fetch(:server_groups)
86
+ if server_groups
87
+
88
+ server_group = fetch(:projects)[fetch(:project).to_sym][:server_group]
89
+ servers = server_groups[server_group.to_sym][:servers]
90
+
91
+ servers.each do |ip_addr, data|
92
+ server ip_addr, data
93
+ end
94
+
95
+ end
96
+ end
97
+
98
+ before 'deploy:set_project', 'deploy:set_server_group'
99
+ before 'deploy:starting', 'deploy:set_project'
100
+ before 'deploy:symlink:release', 'deploy:copy_files'
101
+
102
+
103
+ end
104
+
105
+ namespace :load do
106
+ task :defaults do
107
+ set :use_custom_deploy_to, true
108
+ set :config_dir, 'config'
109
+ end
110
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-multi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Guillaume GIORDANA
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: ''
42
+ email:
43
+ - guillaume.giordana@the-oz.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - capistrano-multi.gemspec
54
+ - lib/capistrano/multi.rb
55
+ - lib/capistrano/multi/version.rb
56
+ - lib/capistrano/tasks/multi.rake
57
+ homepage: https://github.com/guillaumegiordana/capistrano-multi
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.6.11
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Add multiple project folder to a capistrano project.
81
+ test_files: []