deploy-code 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: 59f1f2a521043ef4efb00c18bf66e9237fe83cf2
4
+ data.tar.gz: 7e991a43ef8ff9210e3fada12f759866de4dba74
5
+ SHA512:
6
+ metadata.gz: b763bd8ce420bc1dea5f3494af78478853669b07dd776e94b8af0ebf1291eb667197ac97b65e041d5bd5b845e49ca6e4d414d230d5fd466b23ea4e8fd6c56fd3
7
+ data.tar.gz: f2ef45f1f03b4a5c485ab5f7565bc303486201b055690e3c1f72f748d81597abbb3b2da08187fcfe28465d61775b8302395aaa347cf6117237ad6654fb7dd83b
data/.gitignore ADDED
@@ -0,0 +1,22 @@
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
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in deploy-code.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Alexey Fedorov
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Deploy::Code
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'deploy-code'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install deploy-code
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/deploy-code/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/deploy-code ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "yaml"
4
+ require "deploy/code/version"
5
+
6
+ puts "deploy-code version #{Deploy::Code::VERSION}"
7
+
8
+ task = ARGV[0] || "deploy"
9
+
10
+ if task == "deploy"
11
+
12
+ require "capistrano"
13
+ require "capistrano/cli"
14
+ require "deploy/code"
15
+
16
+ name = ARGV[1] || raise("You need to specify ID of application")
17
+
18
+ puts "Loading configuration for #{name}"
19
+ defaults = YAML::load_file "config/defaults.yml"
20
+ config = YAML::load_file "config/#{name}.yml"
21
+
22
+ config.each { |k, v| defaults[k] = v if v }
23
+ defaults.each { |k, v| ENV["#{k}"] = v if v }
24
+
25
+ puts "Setting up cap"
26
+ cap = Capistrano::Configuration.new
27
+ cap.logger = Capistrano::Logger.new level: Capistrano::Logger::TRACE
28
+ cap.load "deploy"
29
+ cap.require "deploy/code/tasks"
30
+
31
+ puts "Run cap deploy"
32
+ cap.find_and_execute_task(:deploy)
33
+
34
+ elsif task == "init"
35
+
36
+ Dir.mkdir("config") unless File.directory?("config")
37
+
38
+ defaults = {
39
+ SCM_SERVER: "github.com",
40
+ SCM_NAMESPACE: nil,
41
+ BRANCH: nil,
42
+ RAILS_ENV: nil,
43
+ DEPLOY_HOME: nil,
44
+ CUSTOM_FOLDER: nil,
45
+ SERVERS: nil,
46
+ MODULES: ""
47
+ }
48
+
49
+ puts "Writing defaults configuration file"
50
+ File.open("config/defaults.yml", "w") { |f| f.write defaults.to_yaml }
51
+
52
+ puts "You are free to edit config/defaults.yml as you wish"
53
+
54
+ elsif task == "new"
55
+
56
+ name = ARGV[1] || raise("You need to specify ID of application")
57
+
58
+ config = {
59
+ APPLICATION: nil,
60
+ SCM_SERVER: nil,
61
+ SCM_NAMESPACE: nil,
62
+ BRANCH: nil,
63
+ RAILS_ENV: nil,
64
+ DEPLOY_HOME: nil,
65
+ CUSTOM_FOLDER: nil,
66
+ SERVERS: nil,
67
+ MODULES: nil
68
+ }
69
+
70
+ puts "Writing empty configuration to #{name} file"
71
+ File.open("config/#{name}.yml", "w") { |f| f.write config.to_yaml }
72
+
73
+ puts "You are free to edit config/#{name}.yml as you wish"
74
+
75
+ end
76
+
@@ -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 'deploy/code/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "deploy-code"
8
+ spec.version = Deploy::Code::VERSION
9
+ spec.authors = ["Alexey Fedorov"]
10
+ spec.email = ["waterlink000@gmail.com"]
11
+ spec.summary = %q{Used to deploy your apps from git easily. Highly customizable.}
12
+ spec.description = %q{}
13
+ spec.homepage = "https://github.com/waterlink/deploy-code"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_runtime_dependency "capistrano", "= 2.15.5"
25
+ end
@@ -0,0 +1,44 @@
1
+ # Parameters:
2
+ # APPLICATION - app name
3
+ # SCM_SERVER - git server domain name or ip
4
+ # SCM_NAMESPACE - git namespace
5
+ # BRANCH - branch to deploy from
6
+ # RAILS_ENV - environment (staging, production, etc)
7
+ # DEPLOY_HOME - where deploy folder will be placed (suffixed by RAILS_ENV)
8
+ # CUSTOM_FOLDER - custom folder to deploy to
9
+ # SERVERS - servers to deploy to, separated by com
10
+ # MODULES - additional modules to load for deploy
11
+
12
+ Deploy::Code.within_capistrano do
13
+
14
+ puts "Loading standard Deploy::Code tasks"
15
+
16
+ raise 'APPLICATION is not specified' unless ENV['APPLICATION']
17
+ raise 'SCM_SERVER is not specified' unless ENV['SCM_SERVER']
18
+ raise 'SCM_NAMESPACE is not specified' unless ENV['SCM_NAMESPACE']
19
+ raise 'SERVERS is not specified' unless ENV['SERVERS']
20
+
21
+ set :application, ENV['APPLICATION']
22
+
23
+ set :scm, :git
24
+ set :repository, "git@#{ENV['SCM_SERVER']}:#{ENV['SCM_NAMESPACE']}#{application}"
25
+ set :branch, ENV['BRANCH'] || 'master'
26
+
27
+ set :deploy_to, "#{ENV['DEPLOY_HOME'] || '/home/user/projects'}-#{ENV['RAILS_ENV'] || 'staging'}/#{ENV['CUSTOM_FOLDER'] || application}"
28
+
29
+ set :use_sudo, false
30
+ default_run_options[:pty] = true
31
+ set :ssh_options, { forward_agent: true }
32
+ set :normalize_asset_timestamps, false
33
+ set :git_shallow_clone, 1
34
+
35
+ ENV['SERVERS'].split(',').each do |server|
36
+ role :app, server
37
+ end
38
+
39
+ end
40
+
41
+ (ENV['MODULES'] || '').split(',').each do |name|
42
+ require "deploy/code/modules/#{name}"
43
+ end
44
+
@@ -0,0 +1,5 @@
1
+ module Deploy
2
+ module Code
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require "deploy/code/version"
2
+
3
+ module Deploy
4
+ module Code
5
+ # Your code goes here...
6
+
7
+ def self.within_capistrano(&block)
8
+ Capistrano::Configuration.instance(:must_exist).load(&block)
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deploy-code
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexey Fedorov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-15 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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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: capistrano
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.15.5
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.15.5
55
+ description: ''
56
+ email:
57
+ - waterlink000@gmail.com
58
+ executables:
59
+ - deploy-code
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/deploy-code
69
+ - deploy-code.gemspec
70
+ - lib/deploy/code.rb
71
+ - lib/deploy/code/tasks.rb
72
+ - lib/deploy/code/version.rb
73
+ homepage: https://github.com/waterlink/deploy-code
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.2.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Used to deploy your apps from git easily. Highly customizable.
97
+ test_files: []