nswebgen 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .bundle
2
+ *.swp
3
+ *.gitkeep
4
+ Gemfile.lock
5
+ pkg
6
+ vendor/bundle
data/.rvmrc ADDED
@@ -0,0 +1,2 @@
1
+ rvm use 1.9.2@nsweb
2
+
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ #
2
+ # Gemfile
3
+ #
4
+
5
+ source 'http://rubygems.org'
6
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ #
2
+ # Rakefile
3
+ #
4
+
5
+ require 'bundler'
6
+ Bundler::GemHelper.install_tasks
7
+ require 'bundler/setup'
8
+
9
+ namespace :push do
10
+ desc 'Push the nswebgen gem to testing'
11
+ task :test do
12
+ inst = Bundler::GemHelper.new(Dir.pwd, 'nswebgen')
13
+ version = inst.gemspec.version.to_s
14
+ system "gem inabox --host http://gems.nssecuretesting.org:80 pkg/nswebgen-#{version}.gem"
15
+ end
16
+ end
17
+
data/bin/nswebgen ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # bin/nswebgen
4
+ #
5
+ # Authors:: John C. Burr, Josh Williams
6
+ # Copyright:: 2010, 2011 Share One, Inc.
7
+
8
+
9
+ $:.push File.expand_path('../../lib', __FILE__)
10
+
11
+ require 'nswebgen'
12
+
13
+ Nsweb::AppGenerator.start
@@ -0,0 +1,12 @@
1
+ Description:
2
+ Generates an Nsweb enabled application, ready for customization for a particular credit union.
3
+
4
+ This script will generate a standard rails application, and then perform the
5
+ following actions:
6
+ - Create initializer and configuration files
7
+ - Modify Gemfile with appropriate nsweb gem information
8
+ - Generate a session_migration
9
+ - Bundle the application
10
+ - Run nsweb:install generator
11
+ - Initialize git and perform the initial commit
12
+ - Migrate and seed the database unless using --skip-db
@@ -0,0 +1,308 @@
1
+ require 'pathname'
2
+ require 'rails/generators'
3
+ require 'rails/generators/rails/app/app_generator'
4
+ require 'rails/version'
5
+
6
+ class AppBuilder < Rails::AppBuilder
7
+ def initialize(generator)
8
+ super
9
+ @generator.class.source_paths << File.join(File.dirname(__FILE__), 'templates')
10
+ end
11
+
12
+ def app
13
+ directory 'app'
14
+ remove_file 'app/assets/images/rails.png'
15
+ inside 'app/assets/stylesheets' do
16
+ gsub_file 'application.css', /(require_tree.*)/, 'require_directory ./application'
17
+ end
18
+ git_keep 'app/mailers'
19
+ git_keep 'app/models'
20
+ end
21
+
22
+ def config
23
+ empty_directory 'config'
24
+
25
+ inside 'config' do
26
+ directory 'vhosts'
27
+ template 'routes.rb'
28
+ template 'application.rb'
29
+ template 'environment.rb'
30
+ template 'setup_load_paths.rb'
31
+ template 'memcache.yml'
32
+ template 'deploy.rb'
33
+ template 'unicorn.rb'
34
+
35
+ empty_directory 'environments'
36
+
37
+ inside 'environments' do
38
+ template 'test.rb.tt', 'test.rb'
39
+ template 'production.rb.tt', 'production.rb'
40
+ inject_into_file 'production.rb', :before => /^end/ do <<EOB
41
+
42
+ ### CUSTOM ###
43
+ config.action_mailer.smtp_settings = {
44
+ :address => 'mail.shareone.com'
45
+ }
46
+ config.action_mailer.default_url_options = {
47
+ :host => '#{app_name}.nssecurebanking.org'
48
+ }
49
+ EOB
50
+ end
51
+ template 'development.rb.tt', 'development.rb'
52
+ template 'production.rb.tt', 'customer_qa.rb'
53
+ inject_into_file 'customer_qa.rb', :before => /^end/ do <<EOB
54
+
55
+ ### CUSTOM ###
56
+ config.action_mailer.smtp_settings = {
57
+ :address => 'mail.shareone.com'
58
+ }
59
+ config.action_mailer.default_url_options = {
60
+ :host => '#{app_name}.nssecuretesting.org'
61
+ }
62
+ EOB
63
+ end
64
+ template 'development.rb.tt', 'shareone_qa.rb'
65
+ inject_into_file 'shareone_qa.rb', :before => /^end/ do <<EOB
66
+
67
+ ### CUSTOM ###
68
+ config.action_mailer.smtp_settings = {
69
+ :address => 'mail.shareone.com'
70
+ }
71
+ config.action_mailer.default_url_options = {
72
+ :host => '#{app_name}.hbtesting.org'
73
+ }
74
+ EOB
75
+ end
76
+ end
77
+
78
+ directory 'initializers'
79
+ end
80
+ end
81
+
82
+ def database_yml
83
+ template 'config/database.yml'
84
+ end
85
+
86
+ def db
87
+ empty_directory 'db'
88
+ end
89
+
90
+ def doc
91
+ end
92
+
93
+ def public_directory
94
+ empty_directory 'public'
95
+
96
+ inside 'public' do
97
+ template '404.html'
98
+ template '422.html'
99
+ template '500.html'
100
+ template '500.js'
101
+ template 'robots.txt'
102
+ end
103
+ end
104
+
105
+ def test
106
+ end
107
+ end
108
+
109
+ module Nsweb
110
+ class AppGenerator < Rails::Generators::AppBase
111
+
112
+ BACKENDS = %w(eft)
113
+ AUTH_SCHEMES = %w(eft_account eft_username)
114
+
115
+ source_root Pathname.new(File.expand_path('../templates', __FILE__))
116
+
117
+ add_shared_options_for 'Nsweb'
118
+
119
+ class_option :skip_db, :type => :boolean, :default => false,
120
+ :desc => 'Skip database creation/migration/seeding'
121
+ class_option :cuname, :group => :nsweb, :type => :string, :required => true,
122
+ :desc => 'Full name of the credit union (ex: Wepawaug Federal Credit Union)'
123
+ class_option :backend, :group => :nsweb, :type => :string,
124
+ :aliases => '-B', :default => 'eft',
125
+ :desc => "Preconfigured for the selected backend (options: #{BACKENDS.join('/')})"
126
+ class_option :auth_scheme, :group => :nsweb, :type => :string,
127
+ :aliases => '-A', :default => 'eft_account',
128
+ :desc => "Preconfigured for the selected authentication scheme (options: #{AUTH_SCHEMES.join('/')})"
129
+ class_option :administration, :group => :nsweb, :type => :boolean,
130
+ :aliases => '-S', :default => false, :desc => 'Enable administration interface'
131
+ class_option :loan_applications, :group => :nsweb, :type => :boolean,
132
+ :aliases => '-L', :default => false, :desc => 'Enable Loan Applications'
133
+ class_option :member_alerts, :group => :nsweb, :type => :boolean, :aliases => '-M', :default => false, :desc => 'Enable Member Alerts'
134
+ class_option :check_withdrawals, :group => :nsweb, :type => :boolean, :aliases => '-W', :default => true, :desc => 'Enable Check Withdrawal (Mail myself a check)'
135
+
136
+ remove_class_option :ruby, :builder, :template, :skip_gemfile, :skip_bundle, :skip_active_record, :skip_sprockets, :database, :javascript, :skip_javascript, :dev, :edge, :skip_test_unit, :old_style_hash
137
+
138
+ def run!
139
+ self.destination_root = app_path
140
+
141
+ validate_options!
142
+
143
+ generate_rails
144
+
145
+ init_bundler
146
+ init_nsweb
147
+ init_database
148
+ capify!
149
+ gsub_file 'Capfile', /^# (load 'deploy\/assets.*)/, '\1'
150
+ init_git
151
+
152
+ notes = ["\nNew Nsweb app created at '#{app_path}'.\n"]
153
+ if options.skip_git? or options.skip_db?
154
+ notes << '*******************************'
155
+ notes << '*** FURTHER ACTION REQUIRED ***'
156
+ notes << '*******************************'
157
+ notes << " * NOTE: All actions need to be performed in the new app directory. *\n"
158
+
159
+ if options.skip_git?
160
+ notes << "= GIT initialization\n"
161
+ notes << 'You chose to skip git initialization.'
162
+ notes << "In order to get proper git functionality, the following steps need to be performed:\n"
163
+ notes << ' 1. Add a .gitignore file to prevent unwanted files from sneaking into the repository.'
164
+ notes << ' 2. Initialize the local git repository:'
165
+ notes << ' $ git init .'
166
+ notes << "\n"
167
+ notes << " 3. Add all the remote repositories to git's configuration:"
168
+ notes << " $ git remote add origin git@iloathing.com:#{app_name}.git"
169
+ notes << " $ git remote add iloathing git@iloathing.com:#{app_name}.git"
170
+ notes << " $ git remote add eastwood gitosis@192.168.126.10:#{app_name}.git"
171
+ notes << " $ git remote add all git@iloathing.com:#{app_name}.git"
172
+ notes << " $ git remote set-url --add all gitosis@192.168.126.10:#{app_name}.git"
173
+ notes << "\n"
174
+ notes << " 4. Add the current codebase to the repo:"
175
+ notes << " $ git add ."
176
+ notes << "\n"
177
+ notes << " 5. Commit the current codebase:"
178
+ notes << " $ git commit -a -m 'Initial Commit'"
179
+ notes << "\n"
180
+ end
181
+
182
+ if options.skip_db?
183
+ notes << "= Database initialization\n"
184
+ notes << "You chose to skip database initialization."
185
+ notes << "You will not be able to test/run the generated application until the development"
186
+ notes << "database is created, migrated and seeded."
187
+ notes << " $ bundle exec rake db:create"
188
+ notes << " $ bundle exec rake db:migrate"
189
+ notes << " $ bundle exec rake db:seed"
190
+ notes << "\n"
191
+ end
192
+ end
193
+
194
+ say notes.join("\n")
195
+ end
196
+
197
+ protected
198
+
199
+ def app_name
200
+ @app_path ||= Pathname.new(File.expand_path(app_path)).split.last.to_s
201
+ end
202
+
203
+ def validate_options!
204
+ if options.help?
205
+ show_usage_and_exit
206
+ elsif app_path.nil?
207
+ puts "\nAPP_PATH is required\n"
208
+ show_usage_and_exit
209
+ elsif File.exist?(app_path)
210
+ puts "\n'#{app_path}' already exists!\n\n"
211
+ exit
212
+ end
213
+ end
214
+
215
+ def generate_rails
216
+ rails_options = options.dup
217
+ rails_options[:skip_test_unit] = true
218
+ #rails_options[:skip_bundle] = true
219
+ rails_options[:skip_javascript] = true
220
+
221
+ Rails::Generators::AppGenerator.new([app_path], rails_options).invoke_all
222
+ add_source "http://gems.nssecuretesting.org/"
223
+ end
224
+
225
+ def init_bundler
226
+ directory('bundler', '.bundler')
227
+ run_bundle
228
+ end
229
+
230
+ def init_nsweb
231
+ append_file 'Gemfile' do
232
+ <<-EOF.strip_heredoc
233
+ ##### NSWEB GEMS #####
234
+ #gem 'nsweb'
235
+ gem 'nsweb', :path => '../../nsweb'
236
+ ### END NSWEB GEMS ###
237
+ EOF
238
+ end
239
+ generate(:session_migration)
240
+ rake('nsweb:install:migrations')
241
+ args = []
242
+ args << "--backend #{options.backend}"
243
+ args << "--administration" if options.administration?
244
+ args << "--auth_scheme #{options.auth_scheme}"
245
+ args << "--loan_applications" if options.loan_applications?
246
+ args << "--member_alerts" if options.member_alerts?
247
+ args << "--check_withdrawals" if options.check_withdrawals?
248
+ args << "--cuname='#{options.cuname}'"
249
+ generate 'nsweb:install', args.join(' ')
250
+ end
251
+
252
+ def init_database
253
+ unless options.skip_db?
254
+ rake 'db:create'
255
+ rake 'db:migrate'
256
+ rake 'db:seed'
257
+ end
258
+ end
259
+
260
+ def init_git
261
+ unless options.skip_git?
262
+ git :init
263
+ git :remote => "add origin git@iloathing.com:#{app_name}.git"
264
+ git :remote => "add eastwood gitosis@192.168.126.10:#{app_name}.git"
265
+ git :remote => "add iloathing git@iloathing.com:#{app_name}.git"
266
+ git :remote => "add all gitosis@192.168.126.10:#{app_name}.git"
267
+ git :remote => "set-url --add all git@iloathing.com:#{app_name}.git"
268
+ git :add => '.'
269
+ git :commit => "-a -m 'Initial Commit'"
270
+ end
271
+ end
272
+
273
+ def self.banner
274
+ "nswebgen #{self.arguments.map{ |a| a.usage }.join(' ')} [options]".gsub(/\s+/, ' ')
275
+ end
276
+
277
+ def show_usage_and_exit(text = nil)
278
+ if text
279
+ puts
280
+ puts "*" * (text.length + 6)
281
+ puts "* #{" " * text.length} *"
282
+ puts "* #{text} *"
283
+ puts "* #{" " * text.length} *"
284
+ puts "*" * (text.length + 6)
285
+ puts
286
+ end
287
+ self.class.help(shell)
288
+ exit
289
+ end
290
+
291
+ end
292
+ end
293
+
294
+ module Rails
295
+ module Generators
296
+ class AppBase
297
+ def self.exit_on_failure?
298
+ true
299
+ end
300
+ end
301
+ class AppGenerator
302
+ def self.exit_on_failure?
303
+ true
304
+ end
305
+ end
306
+ end
307
+ end
308
+
@@ -0,0 +1,19 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.1.3'
4
+
5
+ <%= database_gemfile_entry %>
6
+
7
+ <%= assets_gemfile_entry %>
8
+ gem 'unicorn'
9
+ gem 'capistrano'
10
+ gem 'therubyracer'
11
+
12
+ group :development do
13
+ gem 'nsweb_deployment', :require => false
14
+ end
15
+
16
+ ##### NSWEB GEMS #####
17
+ gem 'nsweb', '1.0.0'
18
+ #gem 'nsweb', path: '../../nsweb'
19
+ ### END NSWEB GEMS ###
@@ -0,0 +1,29 @@
1
+ This is an Nsweb enabled Rails application. Very little exists in this application itself;
2
+ almost all of the functionality is tucked away in the Nsweb gem.
3
+
4
+ There are, however, a few files in this application that *SHOULD* be modified.
5
+
6
+ = app/assets/images/header.jpg
7
+ This should be replace with a credit union specific header graphic.
8
+
9
+ = app/assets/stylesheets/nsweb/style.css
10
+ Variables in this file should be swapped out for colors that match the credit union
11
+ website's scheme.
12
+
13
+ = app/assets/stylesheets/menu.css.scss
14
+ Any customization of the menu above the colors defined in the above file should be done
15
+ here.
16
+
17
+ = app/assets/stylesheets/application.css
18
+ This is where any general style customization should take place.
19
+
20
+ = config/ninja_model.yml
21
+ This file defines the hosts/ports/etc for connecting to the credit union's backend in
22
+ the various environments (customer_qa, production, etc). This will most definitely
23
+ need to be modified.
24
+
25
+ = public/[404.html, 422.html, 500.html]
26
+ These are "rescue" pages. When errors are encountered within the application, these
27
+ static pages will be rendered. Keep in mind, these pages are *static*, meaning
28
+ they can contain no erb logic AT ALL. Try to keep them as simple as possible, since
29
+ they should almost never be seen anyway.
@@ -0,0 +1,40 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ shareone_qa:
19
+ adapter: mysql
20
+ database: <%= app_name %>
21
+ host: localhost
22
+ username: nsweb
23
+ password: n5w3b
24
+ encoding: utf8
25
+
26
+ customer_qa:
27
+ adapter: mysql
28
+ database: <%= app_name %>
29
+ host: localhost
30
+ username: nsweb
31
+ password: n5w3b
32
+ encoding: utf8
33
+
34
+ production:
35
+ adapter: mysql
36
+ database: <%= app_name %>
37
+ host: localhost
38
+ username: nsweb
39
+ password: n5w3b
40
+ encoding: utf8
@@ -0,0 +1,4 @@
1
+ require 'bundler/capistrano'
2
+ require 'nsweb_deployment'
3
+
4
+ set :application, '<%= @app_name %>'
@@ -0,0 +1,2 @@
1
+ <%= app_const %>.config.session_store :active_record_store, <%= key_value :key, "'_#{app_name}_session'" %>
2
+
@@ -0,0 +1,24 @@
1
+ development:
2
+ enabled: true
3
+ host: localhost
4
+ port: 11211
5
+
6
+ test:
7
+ enabled: true
8
+ host: localhost
9
+ port: 11211
10
+
11
+ shareone_qa:
12
+ enabled: true
13
+ host: localhost
14
+ port: 11211
15
+
16
+ customer_qa:
17
+ enabled: true
18
+ host: localhost
19
+ port: 11211
20
+
21
+ production:
22
+ enabled: true
23
+ host: localhost
24
+ port: 11211
@@ -0,0 +1,2 @@
1
+ <%= app_const %>.routes.draw do
2
+ end
@@ -0,0 +1,95 @@
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
+
11
+ # Use at least one worker per core if you're on a dedicated server,
12
+ # more will usually help for _short_ waits on databases/caches.
13
+ worker_processes 2
14
+
15
+ # Since Unicorn is never exposed to outside clients, it does not need to
16
+ # run on the standard HTTP port (80), there is no reason to start Unicorn
17
+ # as root unless it's from system init scripts.
18
+ # If running the master process as root and the workers as an unprivileged
19
+ # user, do this to switch euid/egid in the workers (also chowns logs):
20
+ # user "unprivileged_user", "unprivileged_group"
21
+
22
+ # Help ensure your application will always spawn in the symlinked
23
+ # "current" directory that Capistrano sets up.
24
+ APP_PATH = "/var/www/<%= @app_name %>" # available in 0.94.0+
25
+ working_directory APP_PATH + "/current" # available in 0.94.0+
26
+
27
+ # listen on both a Unix domain socket and a TCP port,
28
+ # we use a shorter backlog for quicker failover when busy
29
+ listen "/var/tmp/<%= @app_name %>.sock", :backlog => 64
30
+ #listen 8080, :tcp_nopush => true
31
+
32
+ # nuke workers after 30 seconds instead of 60 seconds (the default)
33
+ timeout 30
34
+
35
+ # feel free to point this anywhere accessible on the filesystem
36
+ pid APP_PATH + "/shared/pids/unicorn.pid"
37
+
38
+ # By default, the Unicorn logger will write to stderr.
39
+ # Additionally, ome applications/frameworks log to stderr or stdout,
40
+ # so prevent them from going to /dev/null when daemonized here:
41
+ stderr_path APP_PATH + "/shared/log/unicorn.stderr.log"
42
+ stdout_path APP_PATH + "/shared/log/unicorn.stdout.log"
43
+
44
+ # combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings
45
+ # http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
46
+ preload_app true
47
+ GC.respond_to?(:copy_on_write_friendly=) and
48
+ GC.copy_on_write_friendly = true
49
+
50
+ before_fork do |server, worker|
51
+ # the following is highly recomended for Rails + "preload_app true"
52
+ # as there's no need for the master process to hold a connection
53
+ defined?(ActiveRecord::Base) and
54
+ ActiveRecord::Base.connection.disconnect!
55
+
56
+ # The following is only recommended for memory/DB-constrained
57
+ # installations. It is not needed if your system can house
58
+ # twice as many worker_processes as you have configured.
59
+ #
60
+ # # This allows a new master process to incrementally
61
+ # # phase out the old master process with SIGTTOU to avoid a
62
+ # # thundering herd (especially in the "preload_app false" case)
63
+ # # when doing a transparent upgrade. The last worker spawned
64
+ # # will then kill off the old master process with a SIGQUIT.
65
+ # old_pid = "#{server.config[:pid]}.oldbin"
66
+ # if old_pid != server.pid
67
+ # begin
68
+ # sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
69
+ # Process.kill(sig, File.read(old_pid).to_i)
70
+ # rescue Errno::ENOENT, Errno::ESRCH
71
+ # end
72
+ # end
73
+ #
74
+ # Throttle the master from forking too quickly by sleeping. Due
75
+ # to the implementation of standard Unix signal handlers, this
76
+ # helps (but does not completely) prevent identical, repeated signals
77
+ # from being lost when the receiving process is busy.
78
+ # sleep 1
79
+ end
80
+
81
+ after_fork do |server, worker|
82
+ # per-process listener ports for debugging/admin/migrations
83
+ # addr = "127.0.0.1:#{9293 + worker.nr}"
84
+ # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
85
+
86
+ # the following is *required* for Rails + "preload_app true",
87
+ defined?(ActiveRecord::Base) and
88
+ ActiveRecord::Base.establish_connection
89
+
90
+ # if preload_app is true, then you may also want to check and
91
+ # restart any other shared sockets/descriptors such as Memcached,
92
+ # and Redis. TokyoCabinet file handles are safe to reuse
93
+ # between any number of forked children (assuming your kernel
94
+ # correctly implements pread()/pwrite() system calls)
95
+ end
@@ -0,0 +1,52 @@
1
+ upstream <%= @app_name %>-unicorn {
2
+ server unix:/var/tmp/<%= @app_name %>.sock fail_timeout=0;
3
+ }
4
+
5
+ server {
6
+ listen 80;
7
+ listen 443;
8
+
9
+ server_name <%= @app_name %>.nssecuretesting.org;
10
+
11
+ ssl on;
12
+ ssl_certificate /etc/ssl/certs/STAR.NSSECURETESTING.ORG.crt;
13
+ ssl_certificate_key /etc/ssl/certs/nssecuretesting.key;
14
+
15
+ access_log /var/www/<%= @app_name %>/shared/log/nginx.log;
16
+
17
+ root /var/www/<%= @app_name %>/current/public;
18
+
19
+ location ~ ^/(assets)/ {
20
+ gzip on;
21
+ expires max;
22
+ add_header Cache-Control public;
23
+ gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
24
+ }
25
+
26
+ if (-f $document_root/system/maintenance.html) {
27
+ return 503;
28
+ }
29
+
30
+ error_page 503 @maintenance;
31
+ location @maintenance {
32
+ rewrite ^(.*)$ /system/maintenance.html last;
33
+ break;
34
+ }
35
+
36
+ location / {
37
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
38
+ proxy_set_header Host $http_host;
39
+ proxy_set_header X-Forwarded-Proto $scheme;
40
+ proxy_redirect off;
41
+
42
+ if (!-f $request_filename) {
43
+ proxy_pass http://<%= @app_name %>-unicorn;
44
+ break;
45
+ }
46
+ }
47
+
48
+ error_page 500 502 503 504 /500.html;
49
+ location = /500.html {
50
+ root /var/www/<%= @app_name %>/current/public;
51
+ }
52
+ }
@@ -0,0 +1,52 @@
1
+ upstream <%= @app_name %>-unicorn {
2
+ server unix:/var/tmp/<%= @app_name %>.sock fail_timeout=0;
3
+ }
4
+
5
+ server {
6
+ listen 80;
7
+ listen 443;
8
+
9
+ server_name <%= @app_name %>.nssecurebanking.org;
10
+
11
+ ssl on;
12
+ ssl_certificate /etc/ssl/certs/STAR.NSSECUREBANKING.ORG.crt;
13
+ ssl_certificate_key /etc/ssl/certs/nssecurebanking.key;
14
+
15
+ access_log /var/www/<%= @app_name %>/shared/log/nginx.log;
16
+
17
+ root /var/www/<%= @app_name %>/current/public;
18
+
19
+ location ~ ^/(assets)/ {
20
+ gzip on;
21
+ expires max;
22
+ add_header Cache-Control public;
23
+ gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
24
+ }
25
+
26
+ if (-f $document_root/system/maintenance.html) {
27
+ return 503;
28
+ }
29
+
30
+ error_page 503 @maintenance;
31
+ location @maintenance {
32
+ rewrite ^(.*)$ /system/maintenance.html last;
33
+ break;
34
+ }
35
+
36
+ location / {
37
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
38
+ proxy_set_header Host $http_host;
39
+ proxy_set_header X-Forwarded-Proto $scheme;
40
+ proxy_redirect off;
41
+
42
+ if (!-f $request_filename) {
43
+ proxy_pass http://<%= @app_name %>-unicorn;
44
+ break;
45
+ }
46
+ }
47
+
48
+ error_page 500 502 503 504 /500.html;
49
+ location = /500.html {
50
+ root /var/www/<%= @app_name %>/current/public;
51
+ }
52
+ }
@@ -0,0 +1,15 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/
5
+ db/schema.rb
6
+ .yardoc
7
+ *~
8
+ *.cache
9
+ *.pid
10
+ *.sw?
11
+ .DS_Store
12
+ coverage/
13
+ doc/
14
+ pkg/
15
+ public/**/nsweb
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>General Error (500)</title>
5
+ <style type="text/css">
6
+ body {
7
+ margin: 0;
8
+ padding: 2em;
9
+ font-size: 80%;
10
+ background-color: #e0e0e0;
11
+ color: #333;
12
+ font-family: verdana, helvetica, arial, sans-serif;
13
+ }
14
+
15
+ body {
16
+ line-height: 1.2em;
17
+ width: 900px;
18
+ }
19
+
20
+ div.dialog {
21
+ border: 1px solid #a62f00;
22
+ background-color: #fa7080;
23
+ color: #b72e3e;
24
+ margin: 1em auto 1em 0;
25
+ text-align: center;
26
+ width: 35em;
27
+ }
28
+
29
+ div#header {
30
+ border-right: 1px solid #c0c0c0;
31
+ border-left: 1px solid #c0c0c0;
32
+ background-color: #ffffff;
33
+ background-image: url('/images/header.jpg');
34
+ padding: 0;
35
+ height: 120px;}
36
+
37
+ h1 {
38
+ font-size: 1.6em;
39
+ font-weight: bold;
40
+ line-height: 1.8em;
41
+ }
42
+ </style>
43
+ </head>
44
+
45
+ <body>
46
+ <div id="header">
47
+ </div>
48
+ <div class="dialog">
49
+ <h1>An unexpected error has occurred.</h1>
50
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
51
+ </div>
52
+ <div>
53
+ <a href="/">Return to v-Branch</a>
54
+ <div>
55
+ </body>
56
+ </html>
@@ -0,0 +1,3 @@
1
+ $("#overlay").hide();
2
+ $("#popup_form").hide();
3
+ alert("An unexpected error has occurred. We've been notified about this issue and we'll take a look at it shortly.");
@@ -0,0 +1,7 @@
1
+ #
2
+ # lib/nswebgen/version.rb
3
+ #
4
+
5
+ module Nswebgen
6
+ VERSION = '0.5.4' # Current Nswebgen version
7
+ end
data/lib/nswebgen.rb ADDED
@@ -0,0 +1,8 @@
1
+ #
2
+ # lib/nswebgen.rb
3
+ #
4
+
5
+ module Nswebgen
6
+ end
7
+
8
+ require 'nsweb/generators/nsweb/app/app_generator'
data/nswebgen.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # nswebgen.gemspec
4
+ #
5
+
6
+ $:.push File.expand_path('../lib/', __FILE__)
7
+ require 'nswebgen/version'
8
+
9
+ Gem::Specification.new do |s|
10
+ s.name = "nswebgen"
11
+ s.version = Nswebgen::VERSION
12
+ s.platform = Gem::Platform::RUBY
13
+ s.authors = ["John C. Burr", "Josh Williams"]
14
+ s.email = "web_services@shareone.com"
15
+
16
+ s.summary = "Nsweb application generator gem"
17
+ s.description = "Generates a new Nsweb-based Rails application and configures it for deployment."
18
+
19
+ s.required_rubygems_version = ">= 1.7.2"
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.require_paths = ['lib']
24
+ s.executables = ['nswebgen']
25
+
26
+ s.add_dependency 'railties', '3.1.3'
27
+ s.add_dependency 'sqlite3', '~> 1.3.5'
28
+
29
+ s.add_development_dependency 'geminabox'
30
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nswebgen
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.5.4
6
+ platform: ruby
7
+ authors:
8
+ - John C. Burr
9
+ - Josh Williams
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2012-03-27 00:00:00 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: railties
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 3.1.3
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 1.3.5
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: geminabox
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ description: Generates a new Nsweb-based Rails application and configures it for deployment.
50
+ email: web_services@shareone.com
51
+ executables:
52
+ - nswebgen
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - .gitignore
59
+ - .rvmrc
60
+ - Gemfile
61
+ - Rakefile
62
+ - bin/nswebgen
63
+ - lib/nsweb/generators/nsweb/app/USAGE
64
+ - lib/nsweb/generators/nsweb/app/app_generator.rb
65
+ - lib/nsweb/generators/nsweb/app/templates/Gemfile
66
+ - lib/nsweb/generators/nsweb/app/templates/README
67
+ - lib/nsweb/generators/nsweb/app/templates/config/database.yml
68
+ - lib/nsweb/generators/nsweb/app/templates/config/deploy.rb
69
+ - lib/nsweb/generators/nsweb/app/templates/config/initializers/session_store.rb.tt
70
+ - lib/nsweb/generators/nsweb/app/templates/config/memcache.yml
71
+ - lib/nsweb/generators/nsweb/app/templates/config/routes.rb
72
+ - lib/nsweb/generators/nsweb/app/templates/config/unicorn.rb
73
+ - lib/nsweb/generators/nsweb/app/templates/config/vhosts/customer_qa.vhost.tt
74
+ - lib/nsweb/generators/nsweb/app/templates/config/vhosts/production.vhost.tt
75
+ - lib/nsweb/generators/nsweb/app/templates/gitignore
76
+ - lib/nsweb/generators/nsweb/app/templates/public/500.html
77
+ - lib/nsweb/generators/nsweb/app/templates/public/500.js
78
+ - lib/nswebgen.rb
79
+ - lib/nswebgen/version.rb
80
+ - nswebgen.gemspec
81
+ homepage:
82
+ licenses: []
83
+
84
+ post_install_message:
85
+ rdoc_options: []
86
+
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 634307279
95
+ segments:
96
+ - 0
97
+ version: "0"
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.7.2
104
+ requirements: []
105
+
106
+ rubyforge_project:
107
+ rubygems_version: 1.8.17
108
+ signing_key:
109
+ specification_version: 3
110
+ summary: Nsweb application generator gem
111
+ test_files: []
112
+