pkgr 1.0.1.pre → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -60,18 +60,18 @@ Full command line options are given below:
60
60
 
61
61
  ## Why?
62
62
 
63
- [Capistrano](http://capify.org/) is great for deploying Rails/Ruby
63
+ Tools such as [Capistrano](http://capify.org/) are great for deploying
64
64
  applications, but the deployment recipe can quickly become a mess, and scaling
65
65
  the deployment to more than a few servers can prove to be difficult. Plus, if
66
66
  you're already using automation tools such as
67
67
  [Puppet](http://www.puppetlabs.com/) to configure your servers, you have to
68
68
  run two different processes to configure your infrastructure.
69
69
 
70
- Also, once you built your DEB package and you tested that it
71
- works once, you can deploy it on any number of servers at any time and you're
72
- sure that it will install the required package dependencies, run the hooks,
73
- and put the files in the directories you specified, creating them as needed.
74
- Then, you can downgrade or uninstall the whole application in one command.
70
+ `pkgr` builds on top of the Heroku tools to provide you with an easy way to package you app as a debian package. The great advantage is that once you've built it and you tested that it
71
+ works once, you can deploy on any number of servers at any time and you're
72
+ sure that it will just work. Then, you can upgrade/downgrade or uninstall the whole application in one command.
73
+
74
+ Finally, it's a great way to share your open source software with your users and clients. Much easier than asking them to install all the dependencies manually! I'm in the process of making sure `pkgr` is feature complete by trying to package as many successful open-source projects as I can. Don't hesitate to test it on your app and report your findings!
75
75
 
76
76
  ## What this does
77
77
 
@@ -81,7 +81,7 @@ Then, you can downgrade or uninstall the whole application in one command.
81
81
 
82
82
  my-app config:set VAR=value
83
83
  my-app config:get VAR
84
- my-app run [procfile process]
84
+ my-app run [procfile process] # e.g. my-app run rake db:migrate, my-app run console, etc.
85
85
  my-app scale web=1 worker=1
86
86
  ...
87
87
 
data/lib/pkgr/config.rb CHANGED
@@ -26,6 +26,10 @@ module Pkgr
26
26
  @table[:homepage] || "http://example.com/no-uri-given"
27
27
  end
28
28
 
29
+ def description
30
+ @table[:description] || "No description given"
31
+ end
32
+
29
33
  def valid?
30
34
  @errors = []
31
35
  @errors.push("name can't be blank") if name.nil? || name.empty?
@@ -34,62 +34,57 @@ while : ; do
34
34
 
35
35
  scale)
36
36
  shift
37
- while : ; do
38
- case "$1" in
39
- *)
40
- [ "$1" = "" ] && usage
41
-
42
- PROCESS=(${1//=/ })
43
-
44
- PROCESS_NAME=${PROCESS[0]}
45
- NEW_SCALE=${PROCESS[1]}
46
- CURRENT_SCALE=$(ls -rv1 /etc/init/${APP_NAME}-${PROCESS_NAME}-*.conf 2>/dev/null | head -1 | sed -r 's/.*\-([0-9]+)\.conf/\1/g')
47
- CURRENT_SCALE=${CURRENT_SCALE:="0"}
48
- SCALE_DELTA=$(expr ${NEW_SCALE} - ${CURRENT_SCALE})
49
-
50
- if [ $NEW_SCALE -eq 0 ]; then
51
- echo "Stopping all ${PROCESS_NAME} processes... "
52
- for file in `ls -1 /etc/init/${APP_NAME}-${PROCESS_NAME}-*.conf`; do
53
- service "$(basename ${file} .conf)" stop || true
54
- rm "${file}"
55
- done
56
- # Finally, remove master process
57
- rm "/etc/init/${APP_NAME}-${PROCESS_NAME}.conf"
58
- echo "--> done."
59
- exit 0
60
- fi
61
-
62
- if [ $SCALE_DELTA -gt 0 ]; then
63
- echo "Scaling up..."
64
- cp "${HOME}/vendor/pkgr/scaling/${APP_NAME}-${PROCESS_NAME}.conf" /etc/init/
65
- for i in $(seq ${SCALE_DELTA}); do
66
- PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${i}"
67
- i=$(expr ${i} + ${CURRENT_SCALE})
68
- cp "${HOME}/vendor/pkgr/scaling/${APP_NAME}-${PROCESS_NAME}-PROCESS_NUM.conf" "/etc/init/${PROCESS_ID}.conf"
69
- sed -i "s/PROCESS_NUM/${i}/g" "/etc/init/${PROCESS_ID}.conf"
70
- if [ "${PROCESS_NAME}" = "web" ]; then
71
- port=$(expr ${PORT} + ${i} - 1)
72
- sed -i "s/PORT_NUM/${port}/g" "/etc/init/${PROCESS_ID}.conf"
73
- else
74
- sed -i "s/^env .*PORT_NUM.*$//g" "/etc/init/${PROCESS_ID}.conf"
75
- fi
76
- service "${PROCESS_ID}" start
77
- done
78
- echo "--> done."
79
- elif [ $SCALE_DELTA -lt 0 ]; then
80
- echo "Scaling down..."
81
- for i in $(seq $(expr $SCALE_DELTA \* -1)); do
82
- PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${i}"
83
- i=$(expr ${i} + ${NEW_SCALE})
84
- service "${PROCESS_ID}" stop || true
85
- rm -f "/etc/init/${PROCESS_ID}.conf"
86
- done
87
- echo "--> done."
37
+ for arg in "$@"; do
38
+ [ "$arg" = "" ] && usage
39
+
40
+ PROCESS=(${arg//=/ })
41
+
42
+ set +e
43
+ PROCESS_NAME=${PROCESS[0]}
44
+ NEW_SCALE=${PROCESS[1]}
45
+ CURRENT_SCALE=$(ls -rv1 /etc/init/${APP_NAME}-${PROCESS_NAME}-*.conf 2>/dev/null | head -1 | sed -r 's/.*\-([0-9]+)\.conf/\1/g')
46
+ CURRENT_SCALE=${CURRENT_SCALE:="0"}
47
+ SCALE_DELTA=$(expr ${NEW_SCALE} - ${CURRENT_SCALE})
48
+ set -e
49
+
50
+ if [ $NEW_SCALE -eq 0 ]; then
51
+ echo "Stopping all ${PROCESS_NAME} processes... "
52
+ for file in `ls -1 /etc/init/${APP_NAME}-${PROCESS_NAME}-*.conf 2>/dev/null`; do
53
+ service "$(basename ${file} .conf)" stop || true
54
+ rm "${file}"
55
+ done
56
+ # Finally, remove master process
57
+ rm -f "/etc/init/${APP_NAME}-${PROCESS_NAME}.conf"
58
+ echo "--> done."
59
+ elif [ $SCALE_DELTA -gt 0 ]; then
60
+ echo "Scaling up..."
61
+ cp "${HOME}/vendor/pkgr/scaling/${APP_NAME}-${PROCESS_NAME}.conf" /etc/init/
62
+ for i in $(seq ${SCALE_DELTA}); do
63
+ PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${i}"
64
+ i=$(expr ${i} + ${CURRENT_SCALE})
65
+ cp "${HOME}/vendor/pkgr/scaling/${APP_NAME}-${PROCESS_NAME}-PROCESS_NUM.conf" "/etc/init/${PROCESS_ID}.conf"
66
+ sed -i "s/PROCESS_NUM/${i}/g" "/etc/init/${PROCESS_ID}.conf"
67
+ if [ "${PROCESS_NAME}" = "web" ]; then
68
+ port=$(expr ${PORT} + ${i} - 1)
69
+ sed -i "s/PORT_NUM/${port}/g" "/etc/init/${PROCESS_ID}.conf"
88
70
  else
89
- echo "Nothing to do."
71
+ sed -i "s/^env .*PORT_NUM.*$//g" "/etc/init/${PROCESS_ID}.conf"
90
72
  fi
91
- break ;;
92
- esac
73
+ service "${PROCESS_ID}" start
74
+ done
75
+ echo "--> done."
76
+ elif [ $SCALE_DELTA -lt 0 ]; then
77
+ echo "Scaling down..."
78
+ for i in $(seq $(expr $SCALE_DELTA \* -1)); do
79
+ PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${i}"
80
+ i=$(expr ${i} + ${NEW_SCALE})
81
+ service "${PROCESS_ID}" stop || true
82
+ rm -f "/etc/init/${PROCESS_ID}.conf"
83
+ done
84
+ echo "--> done."
85
+ else
86
+ echo "Nothing to do."
87
+ fi
93
88
  done
94
89
  break ;;
95
90
 
@@ -82,6 +82,7 @@ module Pkgr
82
82
  --deb-user "root" \
83
83
  --deb-group "root" \
84
84
  -a "#{config.architecture}" \
85
+ --description "#{config.description}" \
85
86
  --template-scripts \
86
87
  --before-install #{preinstall_file(config)} \
87
88
  --after-install #{postinstall_file(config)} \
data/lib/pkgr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pkgr
2
- VERSION = "1.0.1.pre"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1.pre
5
- prerelease: 6
4
+ version: 1.0.1
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Cyril Rohr
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-07 00:00:00.000000000 Z
12
+ date: 2013-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake