capistrano-load_variables 0.1.3

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f5b2ee82a6ded599a8fecebfa5f1a0a237a58871
4
+ data.tar.gz: 4018886133b49e658e19f5ab9d31f07e996da808
5
+ SHA512:
6
+ metadata.gz: 3b88b0f27405cc31a3838494d4479e3df9ba4c1ea6b170aa8f9b8a5873c5c6613954dbaba4233cd4babe456c49ab9631628bfa919517253a0d5a9c87a3f3b801
7
+ data.tar.gz: 35eeb1d2587433828a8db661a0b892052938028ee675f5f9f16788ac6b0039f8d2301c335f1e9b97f0cd7ee2f653ff3fbf080f136b0a753e965e0158ce856e6d
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in capistrano-load_variables.gemspec
6
+ gemspec
@@ -0,0 +1,40 @@
1
+ # Capistrano::LoadVariables
2
+
3
+ Load configuration variables from YAML file.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano-load_variables'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install capistrano-load_variables
20
+
21
+ ## Usage
22
+
23
+ Add this line to your Capfile after ```require "capistrano/setup"```.
24
+
25
+ ```ruby
26
+ require 'capistrano/load_variables'
27
+ ```
28
+
29
+ Put ```cap_variables.yml``` in ```config``` directory.
30
+
31
+ ```yaml
32
+ staging:
33
+ url: http://staging.example.com/
34
+ port: 3000
35
+ production:
36
+ url: http://www.example.com/
37
+ port: 80
38
+ ```
39
+
40
+ In staging and production stage, ```url``` and ```port``` will be set.
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,36 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "capistrano/load_variables/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-load_variables"
8
+ spec.version = Capistrano::LoadVariables::VERSION
9
+ spec.authors = ["QIU, Xue"]
10
+ spec.email = ["qiu.xue@xiaotuanzi.com"]
11
+
12
+ spec.summary = %q{Load configuration variables from YAML file for Capsitrano 3}
13
+ spec.description = %q{Load configuration variables from YAML file for Capsitrano 3}
14
+ spec.homepage = "https://github.com/xiaotuanzi/capistrano-load_variables"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "capistrano", "~> 3.7"
33
+
34
+ spec.add_development_dependency "bundler"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ require 'capistrano/load_variables/version'
2
+ load File.expand_path('tasks/load_variables.cap', __dir__)
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module LoadVariables
3
+ VERSION = "0.1.3"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require 'yaml'
2
+
3
+ namespace :load do
4
+ desc 'load variables from file'
5
+ task :variables do
6
+ varfile = File.join(File.dirname(deploy_config_path), 'cap_variables.yml')
7
+ next unless File.exist?(varfile)
8
+
9
+ vars = YAML.load_file(varfile)
10
+ next if !vars.is_a?(Hash) || !vars[ARGV[0]].is_a?(Hash)
11
+
12
+ vars[ARGV[0]].each do |name, value|
13
+ set_if_empty name.to_sym, value
14
+ end
15
+ end
16
+ end
17
+
18
+ after 'load:defaults', 'load:variables'
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-load_variables
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - QIU, Xue
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-18 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.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Load configuration variables from YAML file for Capsitrano 3
56
+ email:
57
+ - qiu.xue@xiaotuanzi.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - capistrano-load_variables.gemspec
67
+ - lib/capistrano-load_variables.rb
68
+ - lib/capistrano/load_variables.rb
69
+ - lib/capistrano/load_variables/version.rb
70
+ - lib/capistrano/tasks/load_variables.cap
71
+ homepage: https://github.com/xiaotuanzi/capistrano-load_variables
72
+ licenses: []
73
+ metadata:
74
+ allowed_push_host: https://rubygems.org
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.6.14
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Load configuration variables from YAML file for Capsitrano 3
95
+ test_files: []