Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 72 lines (61 sloc) 2.75 kb
d6abe1b @mandubian added apache license 2.0
authored
1 # Copyright 2011 Pascal Voitot [@mandubian][pascal.voitot.dev@gmail.com]
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 #
14 # Capistano commands
0c477e9 @mandubian first commit
authored
15
16 import sys
17 import os, os.path
18 import fileinput
19 import shutil
20
21 import getopt
22 from play.utils import *
23
24 MODULE = "capistrano"
25
26 COMMANDS = ["capify"]
27
28 HELP = {
29 "capify:": "Adds the files needed to deploy/run remotely Play with capistrano"
30 }
31
32 def execute(**kargs):
33 command = kargs.get("command")
34 app = kargs.get("app")
35 args = kargs.get("args")
36 env = kargs.get("env")
37
38 if command == 'capify':
39 mf = os.path.join(app.path, 'modules')
40 for module in app.modules():
41 if("capistrano" in module):
42 print "Copying Capistrano Capfile..."
43 shutil.copyfile(os.path.join(module, "Capfile"), os.path.join(app.path, "Capfile"))
44 print "Copying Capistrano Play recipes..."
45 shutil.copyfile(os.path.join(module, "conf", "play-recipes.rb"), os.path.join(app.path, "conf", "play-recipes.rb"))
c41a2c0 implemented play:daemonize:upstart
Yamashita Yuu authored
46 shutil.copytree(os.path.join(module, "conf", "templates"), os.path.join(app.path, "conf", "templates"))
ed394bb @mandubian added cap play:status/version/pid commands
authored
47
48 if(not os.path.exists(os.path.join(app.path, "conf", "deploy.rb"))):
49 print "Copying Capistrano Play deploy config..."
50 shutil.copyfile(os.path.join(module, "conf", "deploy.rb"), os.path.join(app.path, "conf", "deploy.rb"))
51 else: print "Capistrano Play deploy config already exists so NOT copying it..."
0c477e9 @mandubian first commit
authored
52 print "Copying Play remote background launcher script..."
53 shutil.copyfile(os.path.join(module, "run.sh"), os.path.join(app.path, "run.sh"))
f96e4dd @mandubian added stop.sh to manage first deployment stop which fails when no pid…
authored
54 shutil.copyfile(os.path.join(module, "stop.sh"), os.path.join(app.path, "stop.sh"))
0c477e9 @mandubian first commit
authored
55 print "Now go edit your remote configs in conf/deploy.rb"
56 #print "~ Use: --css to override the Secure css"
57 #print "~ "
58 #return
59
60 # try:
61 # optlist, args2 = getopt.getopt(args, '', ['css', 'login', 'layout'])
62 # for o, a in optlist:
63 # if o == '--css':
64 # app.override('public/stylesheets/secure.css', 'public/stylesheets/secure.css')
65 # print "~ "
66 # return
67
68 # except getopt.GetoptError, err:
69 # print "~ %s" % str(err)
70 # print "~ "
71 # sys.exit(-1)
Something went wrong with that request. Please try again.