dolphin 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -2
- data/lib/dolphin/base.rb +2 -1
- data/lib/dolphin/deploy.rb +13 -0
- data/lib/dolphin/setup.rb +14 -0
- data/lib/dolphin/version.rb +1 -1
- data/lib/generators/dolphin/templates/dolphin +11 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aac3d20cc20468e892bc507f3d9ea5ed5299fb0c
|
4
|
+
data.tar.gz: 34571054862171bcb5c5b2a07cb139ad50e1a318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba8dca1fa842d00e46e5df3737906b17ef06ea60a2f18117868c1b93516a6d4e93577fb4ac6ddab6cce9efb9c0bb4fe8252748ac11dee693e006f1a35b628a7c
|
7
|
+
data.tar.gz: 9b7812bfa96f1a0f87b29809b2b3b533865e495995f543192e333cf32e237a5f5fc501464b2c44a2b45c2be421474f5fc74adbec2190fbc3ac906d94485f2308
|
data/README.md
CHANGED
@@ -47,8 +47,6 @@ Edit the bin/dolphin script generated as above to adjust settings. Please refer
|
|
47
47
|
@user = 'deploy'
|
48
48
|
# location of git repository
|
49
49
|
@github = "git@github.com:nengxu/dolphin.git"
|
50
|
-
# which ruby, for chruby
|
51
|
-
@ruby_version = 'ruby-2.0.0-p195'
|
52
50
|
|
53
51
|
case @env
|
54
52
|
when 'qa'
|
@@ -182,6 +180,25 @@ In this section, the outputs from current command group are printed out again. H
|
|
182
180
|
[output]: The Gemfile's dependencies are satisfied
|
183
181
|
[exit]: 0
|
184
182
|
|
183
|
+
### Local mode
|
184
|
+
|
185
|
+
Dolphin can also be used to deploy to developer's local machine. Just pass the --local (or -l for short) option when issue command. By default, dolphin will log into localhost as yourself. You may also specify another user to log in as.
|
186
|
+
|
187
|
+
# running in local mode
|
188
|
+
if options[:local]
|
189
|
+
# by default, log in as yourself
|
190
|
+
@user = `whoami`.strip
|
191
|
+
# may log in as another user
|
192
|
+
# @user = 'neng'
|
193
|
+
@servers = [
|
194
|
+
'localhost',
|
195
|
+
]
|
196
|
+
end
|
197
|
+
|
198
|
+
For example, you can start puma in production mode on your local machine:
|
199
|
+
|
200
|
+
bin/dolphin puma start -e production -l
|
201
|
+
|
185
202
|
## Extend with custom modules
|
186
203
|
|
187
204
|
To extend dolphin's functionality with your custom modules is easy. It is Ruby anyway. For example, to add Centos related functions:
|
data/lib/dolphin/base.rb
CHANGED
@@ -11,6 +11,7 @@ class Dolphin::Base < Thor
|
|
11
11
|
# =============================================================================
|
12
12
|
|
13
13
|
class_option :env, :aliases => '-e', :type => :string, :default => 'alpha'
|
14
|
+
class_option :local, :aliases => '-l', :type => :boolean, :default => false
|
14
15
|
|
15
16
|
def initialize(args=[], options={}, config={})
|
16
17
|
super(args, options, config)
|
@@ -137,7 +138,7 @@ class Dolphin::Base < Thor
|
|
137
138
|
ch.send_data "source ~/.bash_profile\n"
|
138
139
|
|
139
140
|
# pick up ruby
|
140
|
-
ch.send_data "chruby
|
141
|
+
ch.send_data "chruby >& /dev/null\n"
|
141
142
|
|
142
143
|
# Output each command as if they were entered on the command line
|
143
144
|
commands.each do |command|
|
data/lib/dolphin/deploy.rb
CHANGED
@@ -56,6 +56,8 @@ class Dolphin::Deploy < Dolphin::Base
|
|
56
56
|
"
|
57
57
|
cd #{@deploy_dir}
|
58
58
|
pwd
|
59
|
+
chruby
|
60
|
+
which bundle
|
59
61
|
bundle check
|
60
62
|
",
|
61
63
|
]
|
@@ -63,4 +65,15 @@ class Dolphin::Deploy < Dolphin::Base
|
|
63
65
|
execute menu
|
64
66
|
end
|
65
67
|
|
68
|
+
desc "newrelic", "start newrelic"
|
69
|
+
def newrelic
|
70
|
+
menu = [
|
71
|
+
"
|
72
|
+
sudo /etc/init.d/newrelic-sysmond start
|
73
|
+
",
|
74
|
+
]
|
75
|
+
|
76
|
+
execute menu
|
77
|
+
end
|
78
|
+
|
66
79
|
end
|
data/lib/dolphin/setup.rb
CHANGED
@@ -95,5 +95,19 @@ class Dolphin::Setup < Dolphin::Base
|
|
95
95
|
execute menu
|
96
96
|
end
|
97
97
|
|
98
|
+
desc "newrelic", "install newrelic agent"
|
99
|
+
def newrelic
|
100
|
+
menu = [
|
101
|
+
"
|
102
|
+
# install bundler
|
103
|
+
sudo rpm -Uvh http://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm
|
104
|
+
sudo yum -y install newrelic-sysmond
|
105
|
+
sudo nrsysmond-config --set license_key=c55d35d552a49f06d5183c95d41de60cd9754237
|
106
|
+
",
|
107
|
+
]
|
108
|
+
|
109
|
+
execute menu
|
110
|
+
end
|
111
|
+
|
98
112
|
end
|
99
113
|
|
data/lib/dolphin/version.rb
CHANGED
@@ -19,8 +19,6 @@ class Dolphin::Base
|
|
19
19
|
@user = 'deploy'
|
20
20
|
# location of git repository
|
21
21
|
@github = "git@github.com:nengxu/dolphin.git"
|
22
|
-
# which ruby, for chruby
|
23
|
-
@ruby_version = 'ruby-2.0.0-p195'
|
24
22
|
|
25
23
|
# settings with default values
|
26
24
|
# -----------------------------
|
@@ -74,6 +72,17 @@ class Dolphin::Base
|
|
74
72
|
@branch = 'master'
|
75
73
|
end
|
76
74
|
|
75
|
+
# running in local mode
|
76
|
+
if options[:local]
|
77
|
+
# by default, log in as yourself
|
78
|
+
@user = `whoami`.strip
|
79
|
+
# may log in as another user
|
80
|
+
# @user = 'neng'
|
81
|
+
@servers = [
|
82
|
+
'localhost',
|
83
|
+
]
|
84
|
+
end
|
85
|
+
|
77
86
|
# ===================================
|
78
87
|
# settings to avoid simultaneous deployments
|
79
88
|
# ===================================
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolphin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neng Xu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|