kikubari 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +5 -0
- data/Gemfile +1 -12
- data/Gemfile.lock +36 -17
- data/README.md +69 -0
- data/Rakefile +6 -34
- data/VERSION +1 -1
- data/bin/kikubari +1 -10
- data/kikubari.gemspec +25 -43
- data/lib/configuration/deploy_configuration.rb +19 -4
- data/lib/deploy_dir.rb +8 -8
- data/lib/deploy_logger.rb +28 -24
- data/lib/deployer/deployer.rb +41 -44
- data/lib/deployer/deployer_git.rb +1 -2
- data/lib/kikubari.rb +17 -8
- data/{test → spec}/deploy_files/databases.yml +0 -0
- data/{test → spec}/deploy_files/deploy.yml +0 -0
- data/{test → spec}/deploy_files/deploy_git.yml +5 -5
- data/{test → spec}/deploy_files/deploy_git_test_file.yml +5 -5
- data/{test → spec}/deploy_files/deploy_symlink.yml +6 -5
- data/{test → spec}/deploy_files/empty.yml +0 -0
- data/{test → spec}/deploy_files/one_file_test.yml +0 -0
- data/{test → spec}/deploy_files/one_folder.yml +0 -0
- data/spec/lib/deploy_spec.rb +146 -0
- data/spec/lib/deployers/git.rb +32 -0
- data/spec/spec_helper.rb +23 -0
- metadata +88 -126
- data/README.rdoc +0 -25
- data/lib/deployer/deployer_git_symfony.rb +0 -15
- data/test/helper.rb +0 -18
- data/test/lib/deploy_spec.rb +0 -94
- data/test/lib/deployers/git.rb +0 -29
- data/test/lib/deployers/mysql_backup.rb +0 -7
- data/test/lib/deployers/symfony_git.rb +0 -29
- data/test/spec_helper.rb +0 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 371a6f5fb3417f4522bf6cc728b110a78a7f8680
|
4
|
+
data.tar.gz: 18d561160ad2b71271cf0b8166a9c5212a7bbb12
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9c8d3fa771f5409136b799bbd766f0e4da51eedb276e55834092b7f71040f8146fe6b5ae9b5d3a8a9162f49b32b32ce1059d701954d13302fa97d53ce74f676a
|
7
|
+
data.tar.gz: e897c459fd8c151b94c3b8096427132978e6e8232d3726acb5368855f3f19b10fb578c3551726241a9ec6d9fe501f4206351e69c77f56864866a80632b97a086
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,14 +1,3 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem "rspec", "~> 1.3.1"
|
10
|
-
gem "bundler"
|
11
|
-
gem "jeweler", "~> 1.8.3"
|
12
|
-
gem "rcov", ">= 0"
|
13
|
-
gem 'git'
|
14
|
-
end
|
3
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,25 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kikubari (0.0.4)
|
5
|
+
git (~> 1.3)
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: http://rubygems.org/
|
3
9
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
coderay (1.1.1)
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
git (1.3.0)
|
13
|
+
method_source (0.8.2)
|
14
|
+
pry (0.10.3)
|
15
|
+
coderay (~> 1.1.0)
|
16
|
+
method_source (~> 0.8.1)
|
17
|
+
slop (~> 3.4)
|
18
|
+
rake (11.1.2)
|
19
|
+
rspec (3.4.0)
|
20
|
+
rspec-core (~> 3.4.0)
|
21
|
+
rspec-expectations (~> 3.4.0)
|
22
|
+
rspec-mocks (~> 3.4.0)
|
23
|
+
rspec-core (3.4.4)
|
24
|
+
rspec-support (~> 3.4.0)
|
25
|
+
rspec-expectations (3.4.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.4.0)
|
28
|
+
rspec-mocks (3.4.1)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.4.0)
|
31
|
+
rspec-support (3.4.1)
|
32
|
+
slop (3.6.0)
|
16
33
|
|
17
34
|
PLATFORMS
|
18
35
|
ruby
|
19
36
|
|
20
37
|
DEPENDENCIES
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
38
|
+
kikubari!
|
39
|
+
pry (~> 0.10)
|
40
|
+
rake (~> 11.1)
|
41
|
+
rspec (~> 3.4)
|
42
|
+
|
43
|
+
BUNDLED WITH
|
44
|
+
1.11.2
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
![Build Status](https://travis-ci.org/josetonyp/kikubari.svg?branch=master)
|
2
|
+
|
3
|
+
# kikubari
|
4
|
+
|
5
|
+
Naive deploy system for deploy agnostic code. Kikubari only take care about repository, folder structure and file configurations. It also will run before an after task from commmand line and log it to the deployment log. I created because I have to maintain a server with PHP and Ruby code with differents framworks: Ruby on Rails, Symfony 1 and 2, pure PHP and Worpress.
|
6
|
+
|
7
|
+
If you need a more complex solution maybe you want to take a look on Capistrano. If you want to deploy differents frameworks with differents languages maybe you want to stay here a colaborate.
|
8
|
+
|
9
|
+
## Usage:
|
10
|
+
|
11
|
+
Create a *deploy.yml* file in your deploy target folder
|
12
|
+
Run *kikubari*:: */path_to_folder* or ./ *"environment_name"*
|
13
|
+
Have a beer and see it work
|
14
|
+
|
15
|
+
# Examples of a deploy.yml's files
|
16
|
+
|
17
|
+
## PHP
|
18
|
+
|
19
|
+
### Wordpress
|
20
|
+
|
21
|
+
config:
|
22
|
+
framework: wordpress
|
23
|
+
system: git
|
24
|
+
origin: "git@github.com:josetonyp/iromegane.git"
|
25
|
+
branch: master
|
26
|
+
history_limit: 10
|
27
|
+
|
28
|
+
do:
|
29
|
+
folder_structure:
|
30
|
+
log: 'log/#{environment}'
|
31
|
+
uploads: 'uploads/#{environment}'
|
32
|
+
config: 'config/#{environment}'
|
33
|
+
coda_cache: 'coda_cache/#{environment}'
|
34
|
+
|
35
|
+
folder_symbolic_links:
|
36
|
+
uploads: 'wp-content/uploads'
|
37
|
+
coda_cache: 'wp-content/themes/coda/cache'
|
38
|
+
|
39
|
+
file_symbolic_link:
|
40
|
+
config: 'wp-config.php'
|
41
|
+
|
42
|
+
test_files:
|
43
|
+
config: 'config/#{environment}/wp-config.php'
|
44
|
+
|
45
|
+
|
46
|
+
### Symfony
|
47
|
+
|
48
|
+
On proccess...
|
49
|
+
|
50
|
+
## Ruby
|
51
|
+
|
52
|
+
### Rails
|
53
|
+
|
54
|
+
On proccess...
|
55
|
+
|
56
|
+
# Contributing to kikubari
|
57
|
+
|
58
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
59
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
60
|
+
* Fork the project.
|
61
|
+
* Start a feature/bugfix branch.
|
62
|
+
* Commit and push until you are happy with your contribution.
|
63
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
64
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
65
|
+
|
66
|
+
= Copyright
|
67
|
+
|
68
|
+
Copyright (c) 2012 Jose Antonio Pio Gil. See LICENSE.txt for further details.
|
69
|
+
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
2
|
require 'rubygems'
|
4
3
|
require 'bundler'
|
4
|
+
|
5
5
|
begin
|
6
6
|
Bundler.setup(:default, :development)
|
7
7
|
rescue Bundler::BundlerError => e
|
@@ -11,41 +11,13 @@ rescue Bundler::BundlerError => e
|
|
11
11
|
end
|
12
12
|
require 'rake'
|
13
13
|
|
14
|
-
require '
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
gem.homepage = "https://github.com/josetonyp/kikubari"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{ Naive multiframework deploy system }
|
21
|
-
gem.description = %Q{ Naive multiframework deployer for handle server deployments with some care about the code replacement. Also an experimental project.}
|
22
|
-
gem.email = "josetonyp@latizana.com"
|
23
|
-
gem.authors = ["Jose Antonio Pio Gil"]
|
24
|
-
|
25
|
-
gem.bindir = 'bin'
|
26
|
-
gem.executables = ['kikubari']
|
27
|
-
gem.default_executable = 'kikubari'
|
28
|
-
|
29
|
-
# dependencies defined in Gemfile
|
30
|
-
end
|
31
|
-
Jeweler::RubygemsDotOrgTasks.new
|
32
|
-
|
33
|
-
require 'rake/testtask'
|
34
|
-
Rake::TestTask.new(:test) do |test|
|
35
|
-
test.libs << 'lib' << 'test'
|
36
|
-
test.pattern = 'test/**/test_*.rb'
|
37
|
-
test.verbose = true
|
38
|
-
end
|
39
|
-
|
40
|
-
require 'rcov/rcovtask'
|
41
|
-
Rcov::RcovTask.new do |test|
|
42
|
-
test.libs << 'test'
|
43
|
-
test.pattern = 'test/**/test_*.rb'
|
44
|
-
test.verbose = true
|
45
|
-
test.rcov_opts << '--exclude "gems/*"'
|
14
|
+
require 'rspec/core'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
17
|
+
spec.pattern = FileList['spec/lib/**/*_spec.rb']
|
46
18
|
end
|
47
19
|
|
48
|
-
task :default => :
|
20
|
+
task :default => :spec
|
49
21
|
|
50
22
|
require 'rdoc/task'
|
51
23
|
Rake::RDocTask.new do |rdoc|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.2.0
|
data/bin/kikubari
CHANGED
@@ -8,16 +8,7 @@ require "stringio"
|
|
8
8
|
require 'open3'
|
9
9
|
require 'git'
|
10
10
|
|
11
|
-
|
12
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "configuration", "deploy_configuration")
|
13
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "deploy_dir" )
|
14
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "deploy_logger" )
|
15
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "kikubari" )
|
16
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "deployer", "deployer" )
|
17
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "deployer", "deployer_git" )
|
18
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "deployer", "deployer_git_symfony" )
|
19
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "deployer", "deployer_git_wordpress" )
|
20
|
-
|
11
|
+
require '../lib/kikubari'
|
21
12
|
|
22
13
|
##Globals
|
23
14
|
debug, dry_run, rollback = false, false, false
|
data/kikubari.gemspec
CHANGED
@@ -2,27 +2,30 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: kikubari 0.0.3 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "kikubari"
|
8
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.4"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Jose Antonio Pio Gil"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2016-04-15"
|
13
15
|
s.description = " Naive multiframework deployer for handle server deployments with some care about the code replacement. Also an experimental project."
|
14
16
|
s.email = "josetonyp@latizana.com"
|
15
17
|
s.executables = ["kikubari"]
|
16
18
|
s.extra_rdoc_files = [
|
17
19
|
"LICENSE.txt",
|
18
|
-
"README.
|
20
|
+
"README.md"
|
19
21
|
]
|
20
22
|
s.files = [
|
21
23
|
".document",
|
24
|
+
".travis.yml",
|
22
25
|
"Gemfile",
|
23
26
|
"Gemfile.lock",
|
24
27
|
"LICENSE.txt",
|
25
|
-
"README.
|
28
|
+
"README.md",
|
26
29
|
"Rakefile",
|
27
30
|
"VERSION",
|
28
31
|
"bin/kikubari",
|
@@ -32,52 +35,31 @@ Gem::Specification.new do |s|
|
|
32
35
|
"lib/deploy_logger.rb",
|
33
36
|
"lib/deployer/deployer.rb",
|
34
37
|
"lib/deployer/deployer_git.rb",
|
35
|
-
"lib/deployer/deployer_git_symfony.rb",
|
36
38
|
"lib/deployer/deployer_git_wordpress.rb",
|
37
39
|
"lib/kikubari.rb",
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"test/lib/deployers/mysql_backup.rb",
|
50
|
-
"test/lib/deployers/symfony_git.rb",
|
51
|
-
"test/spec_helper.rb"
|
40
|
+
"spec/deploy_files/databases.yml",
|
41
|
+
"spec/deploy_files/deploy.yml",
|
42
|
+
"spec/deploy_files/deploy_git.yml",
|
43
|
+
"spec/deploy_files/deploy_git_test_file.yml",
|
44
|
+
"spec/deploy_files/deploy_symlink.yml",
|
45
|
+
"spec/deploy_files/empty.yml",
|
46
|
+
"spec/deploy_files/one_file_test.yml",
|
47
|
+
"spec/deploy_files/one_folder.yml",
|
48
|
+
"spec/lib/deploy_spec.rb",
|
49
|
+
"spec/lib/deployers/git.rb",
|
50
|
+
"spec/spec_helper.rb"
|
52
51
|
]
|
53
52
|
s.homepage = "https://github.com/josetonyp/kikubari"
|
54
53
|
s.licenses = ["MIT"]
|
55
|
-
s.
|
56
|
-
s.rubygems_version = "1.8.17"
|
54
|
+
s.rubygems_version = "2.5.1"
|
57
55
|
s.summary = "Naive multiframework deploy system"
|
58
56
|
|
59
|
-
|
60
|
-
|
57
|
+
s.required_ruby_version = '>= 2.0.0'
|
58
|
+
|
59
|
+
s.add_development_dependency('pry', '~> 0.10')
|
60
|
+
s.add_development_dependency('rspec', '~> 3.4')
|
61
|
+
s.add_development_dependency('rake', '~> 11.1')
|
61
62
|
|
62
|
-
|
63
|
-
s.add_development_dependency(%q<rspec>, ["~> 1.3.1"])
|
64
|
-
s.add_development_dependency(%q<bundler>, [">= 0"])
|
65
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
66
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
67
|
-
s.add_development_dependency(%q<git>, [">= 0"])
|
68
|
-
else
|
69
|
-
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
70
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
71
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
72
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
73
|
-
s.add_dependency(%q<git>, [">= 0"])
|
74
|
-
end
|
75
|
-
else
|
76
|
-
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
77
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
78
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
79
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
80
|
-
s.add_dependency(%q<git>, [">= 0"])
|
81
|
-
end
|
63
|
+
s.add_dependency('git', '~> 1.3')
|
82
64
|
end
|
83
65
|
|
@@ -7,7 +7,21 @@ module Kikubari
|
|
7
7
|
class Deploy
|
8
8
|
class Configuration
|
9
9
|
|
10
|
-
attr_accessor :deploy_folder,
|
10
|
+
attr_accessor :deploy_folder,
|
11
|
+
:debug,
|
12
|
+
:dry_run,
|
13
|
+
:environment,
|
14
|
+
:rollback,
|
15
|
+
:deploy_file,
|
16
|
+
:config,
|
17
|
+
:do ,
|
18
|
+
:environment_folder,
|
19
|
+
:env_time_folder,
|
20
|
+
:current_deploy_folder,
|
21
|
+
:date_folder,
|
22
|
+
:after,
|
23
|
+
:before,
|
24
|
+
:verbose
|
11
25
|
|
12
26
|
def initialize( file , *params )
|
13
27
|
|
@@ -25,9 +39,10 @@ module Kikubari
|
|
25
39
|
raise ArgumentError, "There is no params for deploy" if params.size == 0
|
26
40
|
|
27
41
|
## verify all arguments for params are present
|
42
|
+
@verbose = false
|
28
43
|
|
29
|
-
params.first.each do |
|
30
|
-
instance_variable_set "@#{
|
44
|
+
params.first.each do |key,value|
|
45
|
+
instance_variable_set "@#{key}".strip, value
|
31
46
|
end
|
32
47
|
|
33
48
|
unless File.directory? @deploy_folder
|
@@ -100,4 +115,4 @@ module Kikubari
|
|
100
115
|
|
101
116
|
end
|
102
117
|
|
103
|
-
end
|
118
|
+
end
|
data/lib/deploy_dir.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Could be simply extend Dir class with extra functions but this class meant to be a Deploy System Directory class handler
|
4
4
|
# Author:: Jose A Pio (mailto:josetonyp@gmail.com)
|
5
|
-
# Copyright:: Copyright (c) 2011
|
5
|
+
# Copyright:: Copyright (c) 2011
|
6
6
|
# License:: Distributes under the same terms as Ruby
|
7
7
|
|
8
8
|
class DeployDir < Dir
|
@@ -10,18 +10,18 @@ class DeployDir < Dir
|
|
10
10
|
# Rotate old folders and reduce it number by the limit
|
11
11
|
# == Params:
|
12
12
|
# [+folder+] <b>String</b> A valid folder for deploys
|
13
|
-
# [+limit+] <b>Integer</b> Limit the folders left in deploy folder
|
13
|
+
# [+limit+] <b>Integer</b> Limit the folders left in deploy folder
|
14
14
|
def self.rotate_folders(folder , limit)
|
15
|
-
|
15
|
+
|
16
16
|
raise( ArgumentError, "Invalid directory #{ folder }") unless File.directory? folder
|
17
17
|
limit = Integer(limit)
|
18
|
-
|
18
|
+
|
19
19
|
list = Dir["#{folder}/*"]
|
20
20
|
folders = list.select {|v| v =~ /\d+?/ }
|
21
21
|
was = folders.length
|
22
22
|
FileUtils.rm_f folders.reverse.slice( limit , folders.length ) if folders.length > limit
|
23
|
-
return was - limit
|
24
|
-
end
|
25
|
-
|
26
|
-
|
23
|
+
return was - limit
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
27
|
end
|
data/lib/deploy_logger.rb
CHANGED
@@ -1,31 +1,35 @@
|
|
1
1
|
module Kikubari
|
2
|
-
|
3
2
|
class Deploy
|
4
|
-
|
5
3
|
class Logger
|
6
4
|
|
5
|
+
def head(message)
|
6
|
+
p "*" * 80
|
7
|
+
p "* #{message}"
|
8
|
+
p "*" * 80
|
9
|
+
p ""
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(message, folder = nil )
|
13
|
+
print( message, "Executing: " )
|
14
|
+
p " in folder: #{folder} " unless folder.nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
def error ( message )
|
18
|
+
print( message, "Error:" )
|
19
|
+
end
|
20
|
+
|
21
|
+
def result ( message )
|
22
|
+
print( message, "Out:" )
|
23
|
+
end
|
24
|
+
|
25
|
+
def info( message )
|
26
|
+
print( message )
|
27
|
+
end
|
28
|
+
|
29
|
+
def print(message, status = "")
|
30
|
+
p "[#{DateTime.now.strftime('%Y%m%d %H:%M:%S')}] #{status} #{message}"
|
31
|
+
end
|
7
32
|
|
8
|
-
def head(message)
|
9
|
-
p "****************************************************************************************************"
|
10
|
-
p "* #{message}"
|
11
|
-
p "****************************************************************************************************"
|
12
|
-
p ""
|
13
|
-
end
|
14
|
-
|
15
|
-
def run(message, folder = nil )
|
16
|
-
p "Executing: '#{message}' "
|
17
|
-
p " time #{DateTime.now}"
|
18
|
-
p " in folder: #{folder} " unless folder.nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
def error ( message )
|
22
|
-
p "Error: '#{message}' "
|
23
|
-
end
|
24
|
-
|
25
|
-
def result ( message )
|
26
|
-
p "Out: '#{message}' "
|
27
|
-
end
|
28
|
-
|
29
33
|
end
|
30
34
|
end
|
31
|
-
end
|
35
|
+
end
|