rake_deploy_lib 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -1
- data/etc/unittest_directories/11_includes/foodir/foo.txt +1 -0
- data/etc/unittest_directories/11_includes/foodir/foodir/foo.txt +2 -0
- data/etc/unittest_directories/11_includes/foodir/foodir/foodir/foo.txt +1 -0
- data/etc/unittest_directories/11_includes/foodir/foodir/foodir2/foo.txt +2 -0
- data/lib/rake_deploy_lib.rb +47 -2
- data/lib/rake_deploy_lib/version.rb +1 -1
- data/rake_deploy_lib-0.1.3.gem +0 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bc70a9c1d6713de920331a54c1fcc81519b16e7
|
4
|
+
data.tar.gz: f447ce7d8ebd6d6ff09f799a9222b51efc9b017c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9dd6559d4c9d54321287349c271c375476ac977ec53bf4efcfe5d55a613d254e2fb72bb6d606426fdbd82f49059c3ecb79b641b2338d1f21ecf94f4e9ab67d8
|
7
|
+
data.tar.gz: 5eb5c25b853169c240fe67865498f14f78696c1cbee0e8612dbf40dbaf3972592b35ec6c1b635858db4487984faabec38ea40088a1c79c003661e7c412bb2ef7
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ The Gem depends on rsync! The OS (Operating System) needs support for the rsync
|
|
7
7
|
|
8
8
|
## Status
|
9
9
|
This is an alpha stage version of the Gem. More methods are follow.
|
10
|
+
[![Gem Version](https://badge.fury.io/rb/rake_deploy_lib.svg)](https://badge.fury.io/rb/rake_deploy_lib)
|
10
11
|
|
11
12
|
## Installation
|
12
13
|
|
@@ -25,7 +26,7 @@ Or install it yourself as:
|
|
25
26
|
$ gem install rake_deploy_lib
|
26
27
|
|
27
28
|
## Usage
|
28
|
-
###
|
29
|
+
### .deploy
|
29
30
|
|
30
31
|
```
|
31
32
|
RakeDeployLib.deploy(@local, @user, @host, @remote, @excludes)
|
@@ -41,6 +42,47 @@ Please be aware, that files will be deleted at remote host, if they don't exist
|
|
41
42
|
* Files: e.g. "myfile.txt" or ".gitignore"
|
42
43
|
* Directories: e.g. "mydirectory/" be aware of the trailing / (slash)
|
43
44
|
|
45
|
+
### .task_delimiter
|
46
|
+
Retuns a formated title. You can use this title to output formated messages.
|
47
|
+
|
48
|
+
**Example**
|
49
|
+
```
|
50
|
+
RakeDeployLib.task_delimiter(task_title, line_break_delimiter=3, header_char = "*", footer_char = "-")
|
51
|
+
RakeDeployLib.task_delimiter("Install npm packages", 3, "*", "-")
|
52
|
+
```
|
53
|
+
|
54
|
+
Output:
|
55
|
+
```
|
56
|
+
************************
|
57
|
+
* Install npm packages *
|
58
|
+
------------------------
|
59
|
+
```
|
60
|
+
**Paramters**
|
61
|
+
* task_title (mendotory) - string "Install npm packages"
|
62
|
+
* line_break_delimiter (optional) - line breaks before output Title as integer (default is 3)
|
63
|
+
* header_char (optional) - one character as upper frame (default is *)
|
64
|
+
* footer_char (optional) - one character as bottom frame (default is -)
|
65
|
+
|
66
|
+
**Return**
|
67
|
+
Returns a string with line breaks
|
68
|
+
|
69
|
+
### .are_you_sure
|
70
|
+
Outputs a question to the user and prompst for answer with yes.
|
71
|
+
User are able to use "y", "Y", "yes", "Yes", "YES" as positiv answer.
|
72
|
+
|
73
|
+
**Example**
|
74
|
+
```
|
75
|
+
RakeDeployLib.are_you_sure("Are you sure you want to deploy? (yes|no):")
|
76
|
+
```
|
77
|
+
**Paramters**
|
78
|
+
* question (optional) - string (default is "Are you sure? (yes|no):")
|
79
|
+
|
80
|
+
**Return**
|
81
|
+
If answer is not yes, an exit command will stop the whole script.
|
82
|
+
|
83
|
+
**Dependencies**
|
84
|
+
Methode uses RakeDeployLib.task_delimiter for prompting the question
|
85
|
+
|
44
86
|
## Development
|
45
87
|
|
46
88
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -0,0 +1 @@
|
|
1
|
+
foo
|
@@ -0,0 +1 @@
|
|
1
|
+
foo
|
data/lib/rake_deploy_lib.rb
CHANGED
@@ -15,14 +15,14 @@ module RakeDeployLib
|
|
15
15
|
# * excludes (optional) - an arrey of files or directories to exclude.
|
16
16
|
# * Files: e.g. "myfile.txt" or ".gitignore"
|
17
17
|
# * Directories: e.g. "mydirectory/" be aware of the trailing / (slash)
|
18
|
-
def RakeDeployLib.deploy(local, user, host, remote, excludes)
|
18
|
+
def RakeDeployLib.deploy(local, user, host, remote, excludes = "")
|
19
19
|
if (!local || !user || !host || !remote)
|
20
20
|
return false
|
21
21
|
end
|
22
22
|
cmd_rsync = "rsync -rz --delete "
|
23
23
|
cmd_exclude = ""
|
24
24
|
|
25
|
-
if excludes
|
25
|
+
if excludes != ""
|
26
26
|
excludes.each do |to_exclude|
|
27
27
|
cmd_exclude = "#{cmd_exclude}--exclude=#{to_exclude} "
|
28
28
|
end
|
@@ -35,4 +35,49 @@ module RakeDeployLib
|
|
35
35
|
return false
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
# Retuns a formated title. You can use this title to output formated messages.
|
40
|
+
# Example call: RakeDeployLib.task_delimiter("Install npm packages", 3, "*", "-")
|
41
|
+
# Example output:
|
42
|
+
# ' ************************ '
|
43
|
+
# ' * Install npm packages * '
|
44
|
+
# ' ------------------------ '
|
45
|
+
#
|
46
|
+
# * task_title (mendotory) - string "Install npm packages"
|
47
|
+
# * line_break_delimiter (optional) - line breaks before output Title as integer (default is 3)
|
48
|
+
# * header_char (optional) - one character as upper frame (default is *)
|
49
|
+
# * footer_char (optional) - one character as bottom frame (default is -)
|
50
|
+
#
|
51
|
+
# returns a string with line breaks
|
52
|
+
def RakeDeployLib.task_delimiter(task_title, line_break_delimiter=3, header_char = "*", footer_char = "-")
|
53
|
+
raise "\n\n\nTask tile missing!" if !task_title
|
54
|
+
output = ""
|
55
|
+
line_break_delimiter.times{output += "\n"}
|
56
|
+
width_count = task_title.length + 4
|
57
|
+
width_count.times{output += "#{header_char}"}
|
58
|
+
output += "\n" + "#{header_char} #{task_title} #{header_char}" + "\n"
|
59
|
+
width_count.times{output += "#{footer_char}"}
|
60
|
+
output += "\n"
|
61
|
+
return output
|
62
|
+
end
|
63
|
+
|
64
|
+
# Outputs a question to the user and prompst for answer with yes.
|
65
|
+
# User are able to use "y", "Y", "yes", "Yes", "YES" as positiv answer.
|
66
|
+
# Example call: RakeDeployLib.are_you_sure("Are you sure you want to deploy? (yes|no):")
|
67
|
+
#
|
68
|
+
# * question (optional) - string (default is "Are you sure? (yes|no):")
|
69
|
+
#
|
70
|
+
# If answer is not yes, an exit command will stop the whole script.
|
71
|
+
# Methode uses RakeDeployLib.task_delimiter for prompting the question
|
72
|
+
def RakeDeployLib.are_you_sure(question = "Are you sure? (yes|no):")
|
73
|
+
yes_prompt = ["y", "Y", "yes", "Yes", "YES"]
|
74
|
+
puts RakeDeployLib.task_delimiter(question, 6, "-")
|
75
|
+
user_prompt = STDIN.gets.chomp
|
76
|
+
if !yes_prompt.include?(user_prompt)
|
77
|
+
puts "You answered with: #{user_prompt}"
|
78
|
+
puts "Me, my self and I will stop now."
|
79
|
+
puts ""
|
80
|
+
exit
|
81
|
+
end
|
82
|
+
end
|
38
83
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_deploy_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ulrich Lutz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,12 +82,17 @@ files:
|
|
82
82
|
- etc/unittest_directories/03_excludes_local/foodir/foo11.txt
|
83
83
|
- etc/unittest_directories/04_excludes_remote/foo01.txt
|
84
84
|
- etc/unittest_directories/04_excludes_remote/foo02.txt
|
85
|
+
- etc/unittest_directories/11_includes/foodir/foo.txt
|
86
|
+
- etc/unittest_directories/11_includes/foodir/foodir/foo.txt
|
87
|
+
- etc/unittest_directories/11_includes/foodir/foodir/foodir/foo.txt
|
88
|
+
- etc/unittest_directories/11_includes/foodir/foodir/foodir2/foo.txt
|
85
89
|
- etc/unittest_directories/test.txt
|
86
90
|
- lib/rake_deploy_lib.rb
|
87
91
|
- lib/rake_deploy_lib/version.rb
|
88
92
|
- rake_deploy_lib-0.1.0.gem
|
89
93
|
- rake_deploy_lib-0.1.1.gem
|
90
94
|
- rake_deploy_lib-0.1.2.gem
|
95
|
+
- rake_deploy_lib-0.1.3.gem
|
91
96
|
- rake_deploy_lib.gemspec
|
92
97
|
homepage: https://github.com/crowzero/rake_deploy_lib
|
93
98
|
licenses:
|