nswebgen 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,9 @@ class AppBuilder < Rails::AppBuilder
30
30
  template 'memcache.yml'
31
31
  template 'deploy.rb'
32
32
  template 'unicorn.rb'
33
+ template 'unicorn_init_customer_qa.sh'
34
+ template 'unicorn_init_production.sh'
35
+ template 'unicorn_init_shareone_qa.sh'
33
36
 
34
37
  empty_directory 'environments'
35
38
 
@@ -103,6 +106,11 @@ EOB
103
106
 
104
107
  def test
105
108
  end
109
+
110
+ def vendor
111
+ directory('bundler', '.bundle')
112
+ super
113
+ end
106
114
  end
107
115
 
108
116
  module Nsweb
@@ -136,15 +144,15 @@ module Nsweb
136
144
 
137
145
  def run!
138
146
  self.destination_root = app_path
147
+ puts "destination_root: #{self.destination_root}"
139
148
 
140
149
  validate_options!
141
150
 
142
151
  generate_rails
143
152
 
144
- init_bundler
145
153
  init_nsweb
146
154
  init_database
147
- capify!
155
+ bundle_command 'exec capify .'
148
156
  gsub_file 'Capfile', /^# (load 'deploy\/assets.*)/, '\1'
149
157
  init_git
150
158
 
@@ -214,27 +222,12 @@ module Nsweb
214
222
  def generate_rails
215
223
  rails_options = options.dup
216
224
  rails_options[:skip_test_unit] = true
217
- #rails_options[:skip_bundle] = true
218
225
  rails_options[:skip_javascript] = true
219
226
 
220
227
  Rails::Generators::AppGenerator.new([app_path], rails_options).invoke_all
221
- add_source "http://gems.nssecuretesting.org/"
222
- end
223
-
224
- def init_bundler
225
- directory('bundler', '.bundler')
226
- run_bundle
227
228
  end
228
229
 
229
230
  def init_nsweb
230
- append_file 'Gemfile' do
231
- <<-EOF.strip_heredoc
232
- ##### NSWEB GEMS #####
233
- #gem 'nsweb'
234
- gem 'nsweb', :path => '../../nsweb'
235
- ### END NSWEB GEMS ###
236
- EOF
237
- end
238
231
  generate(:session_migration)
239
232
  rake('nsweb:install:migrations')
240
233
  args = []
@@ -14,6 +14,6 @@ group :development do
14
14
  end
15
15
 
16
16
  ##### NSWEB GEMS #####
17
- gem 'nsweb', git: 'gitosis@192.168.126.10:nsweb.git'
18
- #gem 'nsweb', path: '../../nsweb'
17
+ #gem 'nsweb', git: 'gitosis@192.168.126.10:nsweb.git'
18
+ gem 'nsweb', path: '../../nsweb'
19
19
  ### END NSWEB GEMS ###
@@ -0,0 +1,3 @@
1
+ ---
2
+ BUNDLE_PATH: vendor/bundle
3
+ BUNDLE_DISABLE_SHARED_GEMS: "1"
@@ -1,12 +1,3 @@
1
- # Sample verbose configuration file for Unicorn (not Rack)
2
- #
3
- # This configuration file documents many features of Unicorn
4
- # that may not be needed for some applications. See
5
- # http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
6
- # for a much simpler configuration file.
7
- #
8
- # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
9
- # documentation.
10
1
  rack_env = ENV['RACK_ENV'] || 'development'
11
2
 
12
3
  # Use at least one worker per core if you're on a dedicated server,
@@ -19,84 +10,14 @@ else
19
10
  worker_processes 1
20
11
  end
21
12
 
22
- # Since Unicorn is never exposed to outside clients, it does not need to
23
- # run on the standard HTTP port (80), there is no reason to start Unicorn
24
- # as root unless it's from system init scripts.
25
- # If running the master process as root and the workers as an unprivileged
26
- # user, do this to switch euid/egid in the workers (also chowns logs):
27
- # user "unprivileged_user", "unprivileged_group"
13
+ APP_PATH = "/var/www/<%= @app_name %>"
14
+ working_directory APP_PATH + "/current"
28
15
 
29
- # Help ensure your application will always spawn in the symlinked
30
- # "current" directory that Capistrano sets up.
31
- APP_PATH = "/var/www/<%= @app_name %>" # available in 0.94.0+
32
- working_directory APP_PATH + "/current" # available in 0.94.0+
16
+ listen "/var/tmp/<%= @app_name %>.sock", backlog: 64
33
17
 
34
- # listen on both a Unix domain socket and a TCP port,
35
- # we use a shorter backlog for quicker failover when busy
36
- listen "/var/tmp/<%= @app_name %>.sock", :backlog => 64
37
- #listen 8080, :tcp_nopush => true
18
+ timeout 60
38
19
 
39
- # nuke workers after 30 seconds instead of 60 seconds (the default)
40
- timeout 30
41
-
42
- # feel free to point this anywhere accessible on the filesystem
43
20
  pid APP_PATH + "/shared/pids/unicorn.pid"
44
21
 
45
- # By default, the Unicorn logger will write to stderr.
46
- # Additionally, ome applications/frameworks log to stderr or stdout,
47
- # so prevent them from going to /dev/null when daemonized here:
48
22
  stderr_path APP_PATH + "/shared/log/unicorn.stderr.log"
49
23
  stdout_path APP_PATH + "/shared/log/unicorn.stdout.log"
50
-
51
- # combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings
52
- # http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
53
- preload_app true
54
- GC.respond_to?(:copy_on_write_friendly=) and
55
- GC.copy_on_write_friendly = true
56
-
57
- before_fork do |server, worker|
58
- # the following is highly recomended for Rails + "preload_app true"
59
- # as there's no need for the master process to hold a connection
60
- defined?(ActiveRecord::Base) and
61
- ActiveRecord::Base.connection.disconnect!
62
-
63
- # The following is only recommended for memory/DB-constrained
64
- # installations. It is not needed if your system can house
65
- # twice as many worker_processes as you have configured.
66
- #
67
- # # This allows a new master process to incrementally
68
- # # phase out the old master process with SIGTTOU to avoid a
69
- # # thundering herd (especially in the "preload_app false" case)
70
- # # when doing a transparent upgrade. The last worker spawned
71
- # # will then kill off the old master process with a SIGQUIT.
72
- # old_pid = "#{server.config[:pid]}.oldbin"
73
- # if old_pid != server.pid
74
- # begin
75
- # sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
76
- # Process.kill(sig, File.read(old_pid).to_i)
77
- # rescue Errno::ENOENT, Errno::ESRCH
78
- # end
79
- # end
80
- #
81
- # Throttle the master from forking too quickly by sleeping. Due
82
- # to the implementation of standard Unix signal handlers, this
83
- # helps (but does not completely) prevent identical, repeated signals
84
- # from being lost when the receiving process is busy.
85
- # sleep 1
86
- end
87
-
88
- after_fork do |server, worker|
89
- # per-process listener ports for debugging/admin/migrations
90
- # addr = "127.0.0.1:#{9293 + worker.nr}"
91
- # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
92
-
93
- # the following is *required* for Rails + "preload_app true",
94
- defined?(ActiveRecord::Base) and
95
- ActiveRecord::Base.establish_connection
96
-
97
- # if preload_app is true, then you may also want to check and
98
- # restart any other shared sockets/descriptors such as Memcached,
99
- # and Redis. TokyoCabinet file handles are safe to reuse
100
- # between any number of forked children (assuming your kernel
101
- # correctly implements pread()/pwrite() system calls)
102
- end
@@ -0,0 +1,85 @@
1
+ #!/bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: unicorn_<%= @app_name %>
4
+ # Required-Start: $remote_fs $syslog
5
+ # Required-Stop: $remote_fs $syslog
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Manage unicorn server for <%= @app_name %>
9
+ # Description: Start, stop, restart unicorn server for <%= @app_name %>
10
+ ### END INIT INFO
11
+ set -e
12
+
13
+ # Feel free to change any of the following variables for your app:
14
+ TIMEOUT=${TIMEOUT-60}
15
+ APP_PATH=/var/www/<%= @app_name %>
16
+ PID=$APP_PATH/shared/pids/unicorn.pid
17
+ APP_ROOT=$APP_PATH/current
18
+ CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E customer_qa"
19
+ AS_USER=deployer
20
+ set -u
21
+
22
+ OLD_PIN="$PID.oldbin"
23
+
24
+ sig () {
25
+ test -s "$PID" && kill -$1 `cat $PID`
26
+ }
27
+
28
+ oldsig () {
29
+ test -s $OLD_PIN && kill -$1 `cat $OLD_PIN`
30
+ }
31
+
32
+ run () {
33
+ if [ "$(id -un)" = "$AS_USER" ]; then
34
+ eval $1
35
+ else
36
+ su -c "$1" - $AS_USER
37
+ fi
38
+ }
39
+
40
+ case "$1" in
41
+ start)
42
+ sig 0 && echo >&2 "Already running" && exit 0
43
+ run "$CMD"
44
+ ;;
45
+ stop)
46
+ sig QUIT && exit 0
47
+ echo >&2 "Not running"
48
+ ;;
49
+ force-stop)
50
+ sig TERM && exit 0
51
+ echo >&2 "Not running"
52
+ ;;
53
+ restart|reload)
54
+ sig HUP && echo reloaded OK && exit 0
55
+ echo >&2 "Couldn't reload, starting '$CMD' instead"
56
+ run "$CMD"
57
+ ;;
58
+ upgrade)
59
+ if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
60
+ then
61
+ n=$TIMEOUT
62
+ while test -s $OLD_PIN && test $n -ge 0
63
+ do
64
+ printf '.' && sleep 1 && n=$(( $n - 1 ))
65
+ done
66
+ echo
67
+
68
+ if test $n -lt 0 && test -s $OLD_PIN
69
+ then
70
+ echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds"
71
+ exit 1
72
+ fi
73
+ exit 0
74
+ fi
75
+ echo >&2 "Couldn't upgrade, starting '$CMD' instead"
76
+ run "$CMD"
77
+ ;;
78
+ reopen-logs)
79
+ sig USR1
80
+ ;;
81
+ *)
82
+ echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
83
+ exit 1
84
+ ;;
85
+ esac
@@ -0,0 +1,85 @@
1
+ #!/bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: unicorn_<%= @app_name %>
4
+ # Required-Start: $remote_fs $syslog
5
+ # Required-Stop: $remote_fs $syslog
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Manage unicorn server for <%= @app_name %>
9
+ # Description: Start, stop, restart unicorn server for <%= @app_name %>
10
+ ### END INIT INFO
11
+ set -e
12
+
13
+ # Feel free to change any of the following variables for your app:
14
+ TIMEOUT=${TIMEOUT-60}
15
+ APP_PATH=/var/www/<%= @app_name %>
16
+ PID=$APP_PATH/shared/pids/unicorn.pid
17
+ APP_ROOT=$APP_PATH/current
18
+ CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"
19
+ AS_USER=deployer
20
+ set -u
21
+
22
+ OLD_PIN="$PID.oldbin"
23
+
24
+ sig () {
25
+ test -s "$PID" && kill -$1 `cat $PID`
26
+ }
27
+
28
+ oldsig () {
29
+ test -s $OLD_PIN && kill -$1 `cat $OLD_PIN`
30
+ }
31
+
32
+ run () {
33
+ if [ "$(id -un)" = "$AS_USER" ]; then
34
+ eval $1
35
+ else
36
+ su -c "$1" - $AS_USER
37
+ fi
38
+ }
39
+
40
+ case "$1" in
41
+ start)
42
+ sig 0 && echo >&2 "Already running" && exit 0
43
+ run "$CMD"
44
+ ;;
45
+ stop)
46
+ sig QUIT && exit 0
47
+ echo >&2 "Not running"
48
+ ;;
49
+ force-stop)
50
+ sig TERM && exit 0
51
+ echo >&2 "Not running"
52
+ ;;
53
+ restart|reload)
54
+ sig HUP && echo reloaded OK && exit 0
55
+ echo >&2 "Couldn't reload, starting '$CMD' instead"
56
+ run "$CMD"
57
+ ;;
58
+ upgrade)
59
+ if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
60
+ then
61
+ n=$TIMEOUT
62
+ while test -s $OLD_PIN && test $n -ge 0
63
+ do
64
+ printf '.' && sleep 1 && n=$(( $n - 1 ))
65
+ done
66
+ echo
67
+
68
+ if test $n -lt 0 && test -s $OLD_PIN
69
+ then
70
+ echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds"
71
+ exit 1
72
+ fi
73
+ exit 0
74
+ fi
75
+ echo >&2 "Couldn't upgrade, starting '$CMD' instead"
76
+ run "$CMD"
77
+ ;;
78
+ reopen-logs)
79
+ sig USR1
80
+ ;;
81
+ *)
82
+ echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
83
+ exit 1
84
+ ;;
85
+ esac
@@ -0,0 +1,85 @@
1
+ #!/bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: unicorn_<%= @app_name %>
4
+ # Required-Start: $remote_fs $syslog
5
+ # Required-Stop: $remote_fs $syslog
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Manage unicorn server for <%= @app_name %>
9
+ # Description: Start, stop, restart unicorn server for <%= @app_name %>
10
+ ### END INIT INFO
11
+ set -e
12
+
13
+ # Feel free to change any of the following variables for your app:
14
+ TIMEOUT=${TIMEOUT-60}
15
+ APP_PATH=/var/www/<%= @app_name %>
16
+ PID=$APP_PATH/shared/pids/unicorn.pid
17
+ APP_ROOT=$APP_PATH/current
18
+ CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E shareone_qa"
19
+ AS_USER=deployer
20
+ set -u
21
+
22
+ OLD_PIN="$PID.oldbin"
23
+
24
+ sig () {
25
+ test -s "$PID" && kill -$1 `cat $PID`
26
+ }
27
+
28
+ oldsig () {
29
+ test -s $OLD_PIN && kill -$1 `cat $OLD_PIN`
30
+ }
31
+
32
+ run () {
33
+ if [ "$(id -un)" = "$AS_USER" ]; then
34
+ eval $1
35
+ else
36
+ su -c "$1" - $AS_USER
37
+ fi
38
+ }
39
+
40
+ case "$1" in
41
+ start)
42
+ sig 0 && echo >&2 "Already running" && exit 0
43
+ run "$CMD"
44
+ ;;
45
+ stop)
46
+ sig QUIT && exit 0
47
+ echo >&2 "Not running"
48
+ ;;
49
+ force-stop)
50
+ sig TERM && exit 0
51
+ echo >&2 "Not running"
52
+ ;;
53
+ restart|reload)
54
+ sig HUP && echo reloaded OK && exit 0
55
+ echo >&2 "Couldn't reload, starting '$CMD' instead"
56
+ run "$CMD"
57
+ ;;
58
+ upgrade)
59
+ if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
60
+ then
61
+ n=$TIMEOUT
62
+ while test -s $OLD_PIN && test $n -ge 0
63
+ do
64
+ printf '.' && sleep 1 && n=$(( $n - 1 ))
65
+ done
66
+ echo
67
+
68
+ if test $n -lt 0 && test -s $OLD_PIN
69
+ then
70
+ echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds"
71
+ exit 1
72
+ fi
73
+ exit 0
74
+ fi
75
+ echo >&2 "Couldn't upgrade, starting '$CMD' instead"
76
+ run "$CMD"
77
+ ;;
78
+ reopen-logs)
79
+ sig USR1
80
+ ;;
81
+ *)
82
+ echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
83
+ exit 1
84
+ ;;
85
+ esac
@@ -45,7 +45,7 @@ server {
45
45
  }
46
46
  }
47
47
 
48
- error_page 500 502 503 504 /500.html;
48
+ error_page 500 502 504 /500.html;
49
49
  location = /500.html {
50
50
  root /var/www/<%= @app_name %>/current/public;
51
51
  }
@@ -12,4 +12,4 @@ db/schema.rb
12
12
  coverage/
13
13
  doc/
14
14
  pkg/
15
- public/**/nsweb
15
+ vendor/bundle
@@ -3,5 +3,5 @@
3
3
  #
4
4
 
5
5
  module Nswebgen
6
- VERSION = '0.5.6' # Current Nswebgen version
6
+ VERSION = '0.5.7' # Current Nswebgen version
7
7
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: nswebgen
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.6
5
+ version: 0.5.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - John C. Burr
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2012-03-27 00:00:00 Z
14
+ date: 2012-05-22 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: railties
@@ -64,12 +64,16 @@ files:
64
64
  - lib/nsweb/generators/nsweb/app/app_generator.rb
65
65
  - lib/nsweb/generators/nsweb/app/templates/Gemfile
66
66
  - lib/nsweb/generators/nsweb/app/templates/README
67
+ - lib/nsweb/generators/nsweb/app/templates/bundler/config.tt
67
68
  - lib/nsweb/generators/nsweb/app/templates/config/database.yml
68
69
  - lib/nsweb/generators/nsweb/app/templates/config/deploy.rb
69
70
  - lib/nsweb/generators/nsweb/app/templates/config/initializers/session_store.rb.tt
70
71
  - lib/nsweb/generators/nsweb/app/templates/config/memcache.yml
71
72
  - lib/nsweb/generators/nsweb/app/templates/config/routes.rb
72
73
  - lib/nsweb/generators/nsweb/app/templates/config/unicorn.rb
74
+ - lib/nsweb/generators/nsweb/app/templates/config/unicorn_init_customer_qa.sh
75
+ - lib/nsweb/generators/nsweb/app/templates/config/unicorn_init_production.sh
76
+ - lib/nsweb/generators/nsweb/app/templates/config/unicorn_init_shareone_qa.sh
73
77
  - lib/nsweb/generators/nsweb/app/templates/config/vhosts/customer_qa.vhost.tt
74
78
  - lib/nsweb/generators/nsweb/app/templates/config/vhosts/production.vhost.tt
75
79
  - lib/nsweb/generators/nsweb/app/templates/gitignore
@@ -91,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
95
  requirements:
92
96
  - - ">="
93
97
  - !ruby/object:Gem::Version
94
- hash: 880395521
98
+ hash: 260496689
95
99
  segments:
96
100
  - 0
97
101
  version: "0"