mina-multistage2 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: eb4213e1d70da1e92c3936a5346759f58500533e9c7b8bba63fe30f8050ce0ed
4
+ data.tar.gz: e7ae69c8ab8a99fd1fbeff891f78f650bdce97aebac92124ef7940bf635c9c38
5
+ SHA512:
6
+ metadata.gz: 497d35baf477c7dc0b86111c51496239c5aaa7c552adb68cefd13ce9111ec6a44add616ac9c38911a3d9cbca6d7a7285c3e28f68ed9d1a4bbacff58ef4bd2848
7
+ data.tar.gz: 1aeb2df951a3969c29923a8416700e4a8792d20dcc55f07d3cbf50a37964a0691bb38f3693ccca2bdbab66fe819a3c7e83cc7858264ee67182111b9486d9e68b
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at d4be4st@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-whenever-env.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Stjepan Hadjic
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,126 @@
1
+ # Mina::Multistage2
2
+
3
+ Plugin for Mina that adds support for multiple stages.
4
+ Code from (https://github.com/endoze/mina-multistage)
5
+
6
+ ## Installation & Usage
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```rb
11
+ gem 'mina-multistage2', require: false
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ ```shell
17
+ $ bundle
18
+ ```
19
+
20
+ Or install it yourself as:
21
+
22
+ ```shell
23
+ $ gem install mina-multistage2
24
+ ```
25
+
26
+ Require `mina/multistage2` in your `config/deploy.rb`:
27
+
28
+ ```rb
29
+ require 'mina/multistage2'
30
+ require 'mina/bundler'
31
+ require 'mina/rails'
32
+ require 'mina/git'
33
+
34
+ ...
35
+
36
+ task setup: :remote_environment do
37
+ ...
38
+ end
39
+
40
+ desc 'Deploys the current version to the server.'
41
+ task deploy: :remote_environment do
42
+ ...
43
+ end
44
+ ```
45
+
46
+ Then run:
47
+
48
+ ```shell
49
+ $ bundle exec mina multistage2:init
50
+ ```
51
+
52
+ This will create `config/deploy/staging.rb` and `config/deploy/production.rb` stage files.
53
+ Use them to define stage specific configuration.
54
+
55
+ ```rb
56
+ # config/deploy/staging.rb
57
+ set :domain, 'example.com'
58
+ set :deploy_to, '/var/www/my_app'
59
+ set :repository, 'https://github.com/user/repo'
60
+ set :branch, 'master'
61
+ set :user, 'www'
62
+ set :rails_env, 'staging'
63
+ ```
64
+
65
+ If you receive the following error, make sure that you've required 'mina/multistage2' in
66
+ your `config/deploy.rb`
67
+
68
+ ```shell
69
+ $ bundle exec mina multistage2:init
70
+ mina aborted!
71
+ Don't know how to build task 'multistage2:init'
72
+ ```
73
+
74
+ Now you can deploy the default stage with:
75
+
76
+ ```shell
77
+ $ mina deploy # this deploys staging by default
78
+ ```
79
+
80
+ Or specify a stage explicitly:
81
+
82
+ ```shell
83
+ $ mina staging deploy
84
+ $ mina production deploy
85
+ ```
86
+
87
+
88
+ ## Configuration
89
+
90
+ * `stages` - array of stages names, the default is the name of all `*.rb` files from `stages_dir`
91
+ * `stages_dir` - stages files directory, the default is `config/deploy`
92
+ * `default_stage` - default stage, the default is `staging`
93
+
94
+ If you want to override the default values for any of these options, they should be set before requiring `mina/multistage2`.
95
+
96
+ ```rb
97
+ # config/deploy.rb
98
+
99
+ set :stages, %w(development test staging production)
100
+ set :stages_dir, 'config/deploy_stages'
101
+ set :default_stage, 'development'
102
+
103
+ require 'mina/multistage2'
104
+ require 'mina/bundler'
105
+ require 'mina/rails'
106
+ require 'mina/git'
107
+
108
+ ...
109
+
110
+ task setup: :remote_environment do
111
+ ...
112
+ end
113
+
114
+ desc 'Deploys the current version to the server.'
115
+ task deploy: :remote_environment do
116
+ ...
117
+ end
118
+ ```
119
+
120
+ ## Contributing
121
+
122
+ 1. Fork it
123
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
124
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
125
+ 4. Push to the branch (`git push origin my-new-feature`)
126
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ require 'mina/multistage2/tasks'
2
+ require 'mina/multistage2/version'
3
+
4
+ module Mina
5
+ module Multistage2
6
+ end
7
+ end
@@ -0,0 +1,72 @@
1
+ def _default_stage
2
+ fetch(:default_stage, 'staging')
3
+ end
4
+
5
+ def _default_stages
6
+ fetch(:stages, %w(staging production))
7
+ end
8
+
9
+ def _stages_dir
10
+ fetch(:stages_dir, 'config/deploy')
11
+ end
12
+
13
+ def _all_stages_empty?
14
+ !fetch(:all_stages, nil)
15
+ end
16
+
17
+ def _file_for_stage(stage_name)
18
+ File.join(_stages_dir, "#{stage_name}.rb")
19
+ end
20
+
21
+ def _stage_file_exists?(stage_name)
22
+ File.exists?(File.expand_path(_file_for_stage(stage_name)))
23
+ end
24
+
25
+ def _get_all_stages
26
+ Dir["#{_stages_dir}/*.rb"].reduce([]) { |all_stages, file| all_stages << File.basename(file, '.rb') }
27
+ end
28
+
29
+ def _argument_included_in_stages?(arg)
30
+ fetch(:all_stages).include?(arg)
31
+ end
32
+
33
+ set :all_stages, _get_all_stages if _all_stages_empty?
34
+
35
+ fetch(:all_stages).each do |name|
36
+ desc "Set the target stage to '#{name}'."
37
+ task(name) do
38
+ set :stage, name
39
+ file = "#{_stages_dir}/#{fetch(:stage)}.rb"
40
+ load file
41
+ end
42
+ end
43
+
44
+ # _potential_stage = ARGV.first
45
+
46
+ # if _stage_file_exists?(_potential_stage) && _argument_included_in_stages?(_potential_stage)
47
+ # invoke _potential_stage
48
+ # elsif _stage_file_exists?(_default_stage)
49
+ # invoke _default_stage
50
+ # end
51
+
52
+ namespace :multistage2 do
53
+ desc 'Create stage files'
54
+ task :init do
55
+ FileUtils.mkdir_p _stages_dir if !File.exists? _stages_dir
56
+ _default_stages.each do |stage|
57
+ stagefile = _file_for_stage(stage)
58
+ if !_stage_file_exists?(stage)
59
+ puts "Creating #{stagefile}"
60
+ File.open(stagefile, 'w') do |f|
61
+ f.puts "set :domain, ''"
62
+ f.puts "set :deploy_to, ''"
63
+ f.puts "set :repository, ''"
64
+ f.puts "set :branch, ''"
65
+ f.puts "set :user, ''"
66
+ end
67
+ else
68
+ puts "Skipping #{stagefile}, it already exists"
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Multistage2
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina/multistage2/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mina-multistage2"
8
+ spec.version = Mina::Multistage2::VERSION
9
+ spec.authors = ["Ray Rao"]
10
+ spec.email = ["raofeng@live.com"]
11
+
12
+ spec.summary = %q{Mina plugin for multistage}
13
+ spec.description = %q{Mina plugin for multistage}
14
+ spec.homepage = "https://github.com/raofeng/mina-multistage2"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.11"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec", "~> 3.0"
33
+ spec.add_dependency "mina", "~> 1.0"
34
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-multistage2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ray Rao
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-01-12 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.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
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
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mina
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description: Mina plugin for multistage
70
+ email:
71
+ - raofeng@live.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - CODE_OF_CONDUCT.md
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/mina/multistage2.rb
83
+ - lib/mina/multistage2/tasks.rb
84
+ - lib/mina/multistage2/version.rb
85
+ - mina-multistage2.gemspec
86
+ homepage: https://github.com/raofeng/mina-multistage2
87
+ licenses:
88
+ - MIT
89
+ metadata:
90
+ allowed_push_host: https://rubygems.org
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.2.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Mina plugin for multistage
110
+ test_files: []