zero_deploy 1.4.13
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile +2 -0
- data/README.md +21 -0
- data/Rakefile +1 -0
- data/bin/zero_deploy +11 -0
- data/lib/zero_deploy.rb +22 -0
- data/lib/zero_deploy/processor.rb +44 -0
- data/lib/zero_deploy/version.rb +3 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/zero_deploy/processor_spec.rb +30 -0
- data/zero_deploy.gemspec +20 -0
- metadata +75 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Zero Deploy
|
2
|
+
|
3
|
+
Significantly improves typical deployment speed.
|
4
|
+
|
5
|
+
## Purpose
|
6
|
+
|
7
|
+
Are you tired of waiting for git to checkout your code?
|
8
|
+
Fed up with sluggish assets precompilation?
|
9
|
+
Don't want to waste your time while waiting for bundler to install shitload of gems?
|
10
|
+
|
11
|
+
Zero Deploy gem aimed to solve all these problems. It significantly improves all the stages of typical deploy process.
|
12
|
+
|
13
|
+
Tested for Capistrano and Chef, Heroku support is in Beta.
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
gem install zero_deploy
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
zero_deploy cap production deploy
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/zero_deploy
ADDED
data/lib/zero_deploy.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative "zero_deploy/processor"
|
2
|
+
|
3
|
+
module ZeroDeploy
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def deploy(cmd)
|
7
|
+
processor = Processor.new(cmd)
|
8
|
+
puts "Zero deploy started... Fasten your seatbelt!"
|
9
|
+
puts ""
|
10
|
+
|
11
|
+
processor.checkout_code
|
12
|
+
processor.bundle_install
|
13
|
+
processor.assets_precompile
|
14
|
+
processor.run_migrations
|
15
|
+
processor.finalize
|
16
|
+
|
17
|
+
puts ""
|
18
|
+
puts "Deploy completed in #{processor.time_spent.round(3)}s."
|
19
|
+
puts "Which is quite close to Zero!"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module ZeroDeploy
|
2
|
+
class Processor
|
3
|
+
attr_reader :time_spent
|
4
|
+
|
5
|
+
def initialize(cmd)
|
6
|
+
@cmd = cmd
|
7
|
+
@time_spent = 0
|
8
|
+
end
|
9
|
+
|
10
|
+
def checkout_code
|
11
|
+
action "Checkout fresh source code"
|
12
|
+
end
|
13
|
+
|
14
|
+
def bundle_install
|
15
|
+
action "Installing dependencies using Bundler version 1.4.13"
|
16
|
+
action "Running: bundle install --without development:test:jokes"
|
17
|
+
action "Your bundle is complete! It was installed into ./vendor/bundle"
|
18
|
+
end
|
19
|
+
|
20
|
+
def assets_precompile
|
21
|
+
action "Running: rake assets:precompile"
|
22
|
+
action "Asset precompilation completed (#{rand(0.01).round(2)}s)"
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_migrations
|
26
|
+
action "Executing deploy:migrate"
|
27
|
+
action "No pending migrations"
|
28
|
+
end
|
29
|
+
|
30
|
+
def finalize
|
31
|
+
deploy = fork { Open3.popen3(@cmd) }
|
32
|
+
Process.detach(deploy)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def action(msg)
|
38
|
+
puts "Zero deploy: #{msg}"
|
39
|
+
time = rand(0.5)
|
40
|
+
@time_spent += time
|
41
|
+
sleep time
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module ZeroDeploy
|
4
|
+
describe Processor do
|
5
|
+
subject { Processor.new(command) }
|
6
|
+
|
7
|
+
let(:command) { "cap production deploy" }
|
8
|
+
|
9
|
+
describe "#code_checkout" do
|
10
|
+
before { subject.checkout_code }
|
11
|
+
its(:time_spent) { should be_within(1).of(0) }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#bundle_install" do
|
15
|
+
before { subject.checkout_code }
|
16
|
+
its(:time_spent) { should be_within(1).of(0) }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#assets_precompile" do
|
20
|
+
before { subject.checkout_code }
|
21
|
+
its(:time_spent) { should be_within(1).of(0) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#run_migrations" do
|
25
|
+
before { subject.checkout_code }
|
26
|
+
its(:time_spent) { should be_within(1).of(0) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
data/zero_deploy.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "zero_deploy/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "zero_deploy"
|
6
|
+
s.version = ZeroDeploy::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Railsware"]
|
9
|
+
s.email = ["contact@railsware.com"]
|
10
|
+
s.homepage = "https://github.com/railsware/zero_deploy/"
|
11
|
+
s.summary = %q{A gem that dramatically decreases your deployemnt time}
|
12
|
+
s.description = %q{A gem that dramatically decreases your deployemnt time by improving all key actions like assets precompilation and gems installation}
|
13
|
+
|
14
|
+
s.add_development_dependency "rspec"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
18
|
+
s.executables = ["zero_deploy"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zero_deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.13
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Railsware
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: A gem that dramatically decreases your deployemnt time by improving all
|
31
|
+
key actions like assets precompilation and gems installation
|
32
|
+
email:
|
33
|
+
- contact@railsware.com
|
34
|
+
executables:
|
35
|
+
- zero_deploy
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- .gitignore
|
40
|
+
- Gemfile
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/zero_deploy
|
44
|
+
- lib/zero_deploy.rb
|
45
|
+
- lib/zero_deploy/processor.rb
|
46
|
+
- lib/zero_deploy/version.rb
|
47
|
+
- spec/spec_helper.rb
|
48
|
+
- spec/zero_deploy/processor_spec.rb
|
49
|
+
- zero_deploy.gemspec
|
50
|
+
homepage: https://github.com/railsware/zero_deploy/
|
51
|
+
licenses: []
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 1.8.25
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: A gem that dramatically decreases your deployemnt time
|
74
|
+
test_files: []
|
75
|
+
has_rdoc:
|