pwpush 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Capfile +8 -0
- data/Gemfile +51 -0
- data/Gemfile.lock +224 -0
- data/LICENSE.txt +674 -0
- data/Procfile +3 -0
- data/README.md +91 -0
- data/Rakefile +8 -0
- data/TODO +21 -0
- data/app.json +21 -0
- data/app/assets/flash/clippy.swf +0 -0
- data/app/assets/flash/github-clippy.swf +0 -0
- data/app/assets/images/apple-touch-icon-ipad.png +0 -0
- data/app/assets/images/apple-touch-icon-ipad3.png +0 -0
- data/app/assets/images/apple-touch-icon-iphone.png +0 -0
- data/app/assets/images/apple-touch-icon-iphone4.png +0 -0
- data/app/assets/images/black_wood.jpg +0 -0
- data/app/assets/images/broken_noise.png +0 -0
- data/app/assets/images/button_down.png +0 -0
- data/app/assets/images/button_over.png +0 -0
- data/app/assets/images/button_up.png +0 -0
- data/app/assets/images/concrete_wall_3.png +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/forkme.png +0 -0
- data/app/assets/images/outlets.png +0 -0
- data/app/assets/images/pwpush_favicon.jpg +0 -0
- data/app/assets/images/pwpush_logo.png +0 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/api.js.coffee +4 -0
- data/app/assets/javascripts/application.js +52 -0
- data/app/assets/javascripts/errors.js.coffee +3 -0
- data/app/assets/javascripts/fd-slider.js +1299 -0
- data/app/assets/javascripts/jquery-cookie.js +117 -0
- data/app/assets/javascripts/jquery.noty.js +520 -0
- data/app/assets/javascripts/layouts/top.js +34 -0
- data/app/assets/javascripts/passwords.js +62 -0
- data/app/assets/javascripts/spoiler.js +101 -0
- data/app/assets/javascripts/themes/default.js +156 -0
- data/app/assets/stylesheets/api.css.scss +3 -0
- data/app/assets/stylesheets/application.css +7 -0
- data/app/assets/stylesheets/errors.css.scss +3 -0
- data/app/assets/stylesheets/fd-slider.css +650 -0
- data/app/assets/stylesheets/global.css.scss +52 -0
- data/app/assets/stylesheets/passwords.css.scss +114 -0
- data/app/assets/stylesheets/users.css.scss +11 -0
- data/app/controllers/api_controller.rb +30 -0
- data/app/controllers/application_controller.rb +23 -0
- data/app/controllers/errors_controller.rb +7 -0
- data/app/controllers/passwords_controller.rb +153 -0
- data/app/controllers/users/omniauth_callbacks_controller.rb +71 -0
- data/app/controllers/views_controller.rb +11 -0
- data/app/helpers/api_helper.rb +2 -0
- data/app/helpers/application_helper.rb +31 -0
- data/app/helpers/errors_helper.rb +2 -0
- data/app/helpers/passwords_helper.rb +2 -0
- data/app/helpers/views_helper.rb +2 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/password.rb +51 -0
- data/app/models/user.rb +20 -0
- data/app/models/view.rb +4 -0
- data/app/views/api/config.html.haml +2 -0
- data/app/views/api/create.html.haml +2 -0
- data/app/views/api/generate.html.haml +2 -0
- data/app/views/api/list.html.haml +2 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.haml +50 -0
- data/app/views/devise/sessions/new.html.haml +51 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/errors/error_404.html.haml +21 -0
- data/app/views/errors/error_500.html.haml +21 -0
- data/app/views/layouts/_ga.html.erb +14 -0
- data/app/views/layouts/application.html.haml +41 -0
- data/app/views/pages/about.html.haml +159 -0
- data/app/views/passwords/edit.html.haml +7 -0
- data/app/views/passwords/index.html.haml +17 -0
- data/app/views/passwords/new.html.haml +68 -0
- data/app/views/passwords/show.html.haml +58 -0
- data/app/views/shared/_auth_providers.html.haml +9 -0
- data/app/views/shared/_messages.html.haml +4 -0
- data/app/views/views/_form.html.erb +16 -0
- data/app/views/views/edit.html.erb +8 -0
- data/app/views/views/index.html.erb +21 -0
- data/app/views/views/new.html.erb +5 -0
- data/app/views/views/show.html.erb +20 -0
- data/bin/bundle +13 -0
- data/config.ru +4 -0
- data/config/application.rb +51 -0
- data/config/boot.rb +6 -0
- data/config/capistrano_database_yml.rb +158 -0
- data/config/database.yml +19 -0
- data/config/deploy.rb +140 -0
- data/config/deploy/database.yml.erb +52 -0
- data/config/deploy/local_cap_config.rb.example +54 -0
- data/config/environment.rb +42 -0
- data/config/environments/development.rb +30 -0
- data/config/environments/engineyard.rb +60 -0
- data/config/environments/private.rb +60 -0
- data/config/environments/production.rb +60 -0
- data/config/environments/test.rb +39 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/devise.rb +211 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/devise.en.yml +58 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +16 -0
- data/config/unicorn.rb +22 -0
- data/db/migrate/20111128183630_create_passwords.rb +12 -0
- data/db/migrate/20111228183300_create_views.rb +16 -0
- data/db/migrate/20120102210558_devise_create_users.rb +54 -0
- data/db/migrate/20120102210559_create_rails_admin_histories_table.rb +18 -0
- data/db/migrate/20120102220933_add_admin_to_user.rb +9 -0
- data/db/migrate/20120129211750_add_lockable_to_users.rb +10 -0
- data/db/migrate/20120220172426_add_user_to_password.rb +11 -0
- data/db/migrate/20121105144421_add_deleted_to_password.rb +5 -0
- data/db/migrate/20150323145847_add_first_view_flag.rb +9 -0
- data/db/migrate/20160214205926_add_deletable_to_password.rb +5 -0
- data/db/schema.rb +78 -0
- data/db/seeds.rb +7 -0
- data/log/.gitkeep +0 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +3 -0
- data/script/rails +6 -0
- metadata +226 -0
data/bin/bundle
ADDED
data/config.ru
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
if defined?(Bundler)
|
|
6
|
+
# If you precompile assets before deploying to production, use this line
|
|
7
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
|
8
|
+
# If you want your assets lazily compiled in production, use this line
|
|
9
|
+
# Bundler.require(:default, :assets, Rails.env)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module PasswordPusher
|
|
13
|
+
class Application < Rails::Application
|
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
15
|
+
# Application configuration should go into files in config/initializers
|
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
17
|
+
|
|
18
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
19
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
20
|
+
|
|
21
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
22
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
23
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
24
|
+
|
|
25
|
+
# Activate observers that should always be running.
|
|
26
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
27
|
+
|
|
28
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
29
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
30
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
31
|
+
|
|
32
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
33
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
34
|
+
# config.i18n.default_locale = :de
|
|
35
|
+
|
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
37
|
+
config.encoding = "utf-8"
|
|
38
|
+
|
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
40
|
+
config.filter_parameters += [:password]
|
|
41
|
+
|
|
42
|
+
# Enable the asset pipeline
|
|
43
|
+
config.assets.enabled = true
|
|
44
|
+
|
|
45
|
+
# Version of your assets, change this if you want to expire all your assets
|
|
46
|
+
config.assets.version = '1.0'
|
|
47
|
+
|
|
48
|
+
config.assets.initialize_on_precompile = false
|
|
49
|
+
config.assets.precompile += ['fd-slider.css', 'fd-slider.js', 'rails_admin/rails_admin.css', 'rails_admin/rails_admin.js']
|
|
50
|
+
end
|
|
51
|
+
end
|
data/config/boot.rb
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#
|
|
2
|
+
# = Capistrano database.yml task
|
|
3
|
+
#
|
|
4
|
+
# Provides a couple of tasks for creating the database.yml
|
|
5
|
+
# configuration file dynamically when deploy:setup is run.
|
|
6
|
+
#
|
|
7
|
+
# Category:: Capistrano
|
|
8
|
+
# Package:: Database
|
|
9
|
+
# Author:: Simone Carletti <weppos@weppos.net>
|
|
10
|
+
# Copyright:: 2007-2010 The Authors
|
|
11
|
+
# License:: MIT License
|
|
12
|
+
# Link:: http://www.simonecarletti.com/
|
|
13
|
+
# Source:: http://gist.github.com/2769
|
|
14
|
+
#
|
|
15
|
+
#
|
|
16
|
+
# == Requirements
|
|
17
|
+
#
|
|
18
|
+
# This extension requires the original <tt>config/database.yml</tt> to be excluded
|
|
19
|
+
# from source code checkout. You can easily accomplish this by renaming
|
|
20
|
+
# the file (for example to database.example.yml) and appending <tt>database.yml</tt>
|
|
21
|
+
# value to your SCM ignore list.
|
|
22
|
+
#
|
|
23
|
+
# # Example for Subversion
|
|
24
|
+
#
|
|
25
|
+
# $ svn mv config/database.yml config/database.example.yml
|
|
26
|
+
# $ svn propset svn:ignore 'database.yml' config
|
|
27
|
+
#
|
|
28
|
+
# # Example for Git
|
|
29
|
+
#
|
|
30
|
+
# $ git mv config/database.yml config/database.example.yml
|
|
31
|
+
# $ echo 'config/database.yml' >> .gitignore
|
|
32
|
+
#
|
|
33
|
+
#
|
|
34
|
+
# == Usage
|
|
35
|
+
#
|
|
36
|
+
# Include this file in your <tt>deploy.rb</tt> configuration file.
|
|
37
|
+
# Assuming you saved this recipe as capistrano_database_yml.rb:
|
|
38
|
+
#
|
|
39
|
+
# require "capistrano_database_yml"
|
|
40
|
+
#
|
|
41
|
+
# Now, when <tt>deploy:setup</tt> is called, this script will automatically
|
|
42
|
+
# create the <tt>database.yml</tt> file in the shared folder.
|
|
43
|
+
# Each time you run a deploy, this script will also create a symlink
|
|
44
|
+
# from your application <tt>config/database.yml</tt> pointing to the shared configuration file.
|
|
45
|
+
#
|
|
46
|
+
# == Custom template
|
|
47
|
+
#
|
|
48
|
+
# By default, this script creates an exact copy of the default
|
|
49
|
+
# <tt>database.yml</tt> file shipped with a new Rails 2.x application.
|
|
50
|
+
# If you want to overwrite the default template, simply create a custom Erb template
|
|
51
|
+
# called <tt>database.yml.erb</tt> and save it into <tt>config/deploy</tt> folder.
|
|
52
|
+
#
|
|
53
|
+
# Although the name of the file can't be changed, you can customize the directory
|
|
54
|
+
# where it is stored defining a variable called <tt>:template_dir</tt>.
|
|
55
|
+
#
|
|
56
|
+
# # store your custom template at foo/bar/database.yml.erb
|
|
57
|
+
# set :template_dir, "foo/bar"
|
|
58
|
+
#
|
|
59
|
+
# # example of database template
|
|
60
|
+
#
|
|
61
|
+
# base: &base
|
|
62
|
+
# adapter: sqlite3
|
|
63
|
+
# timeout: 5000
|
|
64
|
+
# development:
|
|
65
|
+
# database: #{shared_path}/db/development.sqlite3
|
|
66
|
+
# <<: *base
|
|
67
|
+
# test:
|
|
68
|
+
# database: #{shared_path}/db/test.sqlite3
|
|
69
|
+
# <<: *base
|
|
70
|
+
# production:
|
|
71
|
+
# adapter: mysql
|
|
72
|
+
# database: #{application}_production
|
|
73
|
+
# username: #{user}
|
|
74
|
+
# password: #{Capistrano::CLI.ui.ask("Enter MySQL database password: ")}
|
|
75
|
+
# encoding: utf8
|
|
76
|
+
# timeout: 5000
|
|
77
|
+
#
|
|
78
|
+
# Because this is an Erb template, you can place variables and Ruby scripts
|
|
79
|
+
# within the file.
|
|
80
|
+
# For instance, the template above takes advantage of Capistrano CLI
|
|
81
|
+
# to ask for a MySQL database password instead of hard coding it into the template.
|
|
82
|
+
#
|
|
83
|
+
# === Password prompt
|
|
84
|
+
#
|
|
85
|
+
# For security reasons, in the example below the password is not
|
|
86
|
+
# hard coded (or stored in a variable) but asked on setup.
|
|
87
|
+
# I don't like to store passwords in files under version control
|
|
88
|
+
# because they will live forever in your history.
|
|
89
|
+
# This is why I use the Capistrano::CLI utility.
|
|
90
|
+
#
|
|
91
|
+
|
|
92
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
|
93
|
+
abort "This extension requires Capistrano 2"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
Capistrano::Configuration.instance.load do
|
|
97
|
+
|
|
98
|
+
namespace :deploy do
|
|
99
|
+
|
|
100
|
+
namespace :db do
|
|
101
|
+
|
|
102
|
+
desc <<-DESC
|
|
103
|
+
Creates the database.yml configuration file in shared path.
|
|
104
|
+
|
|
105
|
+
By default, this task uses a template unless a template \
|
|
106
|
+
called database.yml.erb is found either is :template_dir \
|
|
107
|
+
or /config/deploy folders. The default template matches \
|
|
108
|
+
the template for config/database.yml file shipped with Rails.
|
|
109
|
+
|
|
110
|
+
When this recipe is loaded, db:setup is automatically configured \
|
|
111
|
+
to be invoked after deploy:setup. You can skip this task setting \
|
|
112
|
+
the variable :skip_db_setup to true. This is especially useful \
|
|
113
|
+
if you are using this recipe in combination with \
|
|
114
|
+
capistrano-ext/multistaging to avoid multiple db:setup calls \
|
|
115
|
+
when running deploy:setup for all stages one by one.
|
|
116
|
+
DESC
|
|
117
|
+
task :setup, :except => { :no_release => true } do
|
|
118
|
+
|
|
119
|
+
default_template = <<-EOF
|
|
120
|
+
base: &base
|
|
121
|
+
adapter: sqlite3
|
|
122
|
+
timeout: 5000
|
|
123
|
+
development:
|
|
124
|
+
database: #{shared_path}/db/development.sqlite3
|
|
125
|
+
<<: *base
|
|
126
|
+
test:
|
|
127
|
+
database: #{shared_path}/db/test.sqlite3
|
|
128
|
+
<<: *base
|
|
129
|
+
production:
|
|
130
|
+
database: #{shared_path}/db/production.sqlite3
|
|
131
|
+
<<: *base
|
|
132
|
+
EOF
|
|
133
|
+
|
|
134
|
+
location = fetch(:template_dir, "config/deploy") + '/database.yml.erb'
|
|
135
|
+
template = File.file?(location) ? File.read(location) : default_template
|
|
136
|
+
|
|
137
|
+
config = ERB.new(template)
|
|
138
|
+
|
|
139
|
+
run "mkdir -p #{shared_path}/db"
|
|
140
|
+
run "mkdir -p #{shared_path}/config"
|
|
141
|
+
put config.result(binding), "#{shared_path}/config/database.yml"
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
desc <<-DESC
|
|
145
|
+
[internal] Updates the symlink for database.yml file to the just deployed release.
|
|
146
|
+
DESC
|
|
147
|
+
task :symlink, :except => { :no_release => true } do
|
|
148
|
+
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
after "deploy:setup", "deploy:db:setup" unless fetch(:skip_db_setup, false)
|
|
154
|
+
after "deploy:finalize_update", "deploy:db:symlink"
|
|
155
|
+
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
end
|
data/config/database.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
base: &base
|
|
2
|
+
adapter: sqlite3
|
|
3
|
+
timeout: 5000
|
|
4
|
+
|
|
5
|
+
development:
|
|
6
|
+
database: db/development.sqlite3
|
|
7
|
+
<<: *base
|
|
8
|
+
|
|
9
|
+
test:
|
|
10
|
+
database: db/test.sqlite3
|
|
11
|
+
<<: *base
|
|
12
|
+
|
|
13
|
+
private:
|
|
14
|
+
database: db/private.sqlite3
|
|
15
|
+
<<: *base
|
|
16
|
+
|
|
17
|
+
production:
|
|
18
|
+
database: db/production.sqlite3
|
|
19
|
+
<<: *base
|
data/config/deploy.rb
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
set :application, "PasswordPusher"
|
|
2
|
+
set :repository, "git@github.com:pglombardo/PasswordPusher.git"
|
|
3
|
+
|
|
4
|
+
local_config = './config/deploy/local_cap_config.rb'
|
|
5
|
+
abort "\e[0;31mERROR: To use capistrano with PasswordPusher, create and populate a [config/deploy/local_cap_config.rb] file. See [config/deploy/local_cap_config.rb.example]." unless File.exists?(local_config)
|
|
6
|
+
|
|
7
|
+
require local_config if File.exists?(local_config)
|
|
8
|
+
|
|
9
|
+
default_run_options[:pty] = true
|
|
10
|
+
|
|
11
|
+
set :scm, "git"
|
|
12
|
+
set :deploy_via, :remote_cache
|
|
13
|
+
set :use_sudo, false
|
|
14
|
+
ssh_options[:forward_agent] = true
|
|
15
|
+
|
|
16
|
+
# To fix the touching of assets
|
|
17
|
+
# # Bug/Fix: https://github.com/capistrano/capistrano/pull/121
|
|
18
|
+
set :normalize_asset_timestamps, false
|
|
19
|
+
|
|
20
|
+
set :stage, nil
|
|
21
|
+
|
|
22
|
+
desc "Run tasks in development environment"
|
|
23
|
+
task :development do
|
|
24
|
+
set :stage, 'development'
|
|
25
|
+
set :bundle_without, [:production, :test, :preview]
|
|
26
|
+
set :rails_env, 'development'
|
|
27
|
+
default_environment['RAILS_ENV'] = 'development'
|
|
28
|
+
|
|
29
|
+
# Development Config
|
|
30
|
+
role :web, DEVELOPMENT_WEB
|
|
31
|
+
role :app, DEVELOPMENT_APP
|
|
32
|
+
role :console, DEVELOPMENT_CONSOLE
|
|
33
|
+
role :db, DEVELOPMENT_DB, :primary => true
|
|
34
|
+
set :deploy_to, DEVELOPMENT_DEPLOY_TO
|
|
35
|
+
set :user, DEVELOPMENT_USER
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
desc "Run tasks in staging environment (kenny)"
|
|
39
|
+
task :staging do
|
|
40
|
+
set :stage, 'staging'
|
|
41
|
+
set :bundle_without, [:test, :development, :preview]
|
|
42
|
+
set :rails_env, 'staging'
|
|
43
|
+
default_environment['RAILS_ENV'] = 'staging'
|
|
44
|
+
set :rvm_ruby_string, 'ruby-1.9.3-p194'
|
|
45
|
+
|
|
46
|
+
# Staging Config
|
|
47
|
+
role :web, STAGING_WEB
|
|
48
|
+
role :app, STAGING_APP
|
|
49
|
+
role :console, STAGING_CONSOLE
|
|
50
|
+
role :db, STAGING_DB, :primary => true
|
|
51
|
+
set :deploy_to, STAGING_DEPLOY_TO
|
|
52
|
+
set :user, STAGING_USER
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
desc "Run tasks in preview environment (customer preview)"
|
|
56
|
+
task :preview do
|
|
57
|
+
set :stage, 'preview'
|
|
58
|
+
set :bundle_without, [:test, :development]
|
|
59
|
+
set :rails_env, 'preview'
|
|
60
|
+
default_environment['RAILS_ENV'] = 'preview'
|
|
61
|
+
set :rvm_ruby_string, 'ruby-1.9.3-p194'
|
|
62
|
+
|
|
63
|
+
# Preview Config
|
|
64
|
+
role :web, PREVIEW_WEB
|
|
65
|
+
role :app, PREVIEW_APP
|
|
66
|
+
role :console, PREVIEW_CONSOLE
|
|
67
|
+
role :db, PREVIEW_DB, :primary => true
|
|
68
|
+
set :deploy_to, PREVIEW_DEPLOY_TO
|
|
69
|
+
set :user, PREVIEW_USER
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
desc "Run tasks in production environment"
|
|
73
|
+
task :production do
|
|
74
|
+
set :stage, 'production'
|
|
75
|
+
set :rails_env, 'production'
|
|
76
|
+
set (:bundle_cmd) { "/usr/local/rbenv/shims/bundle" }
|
|
77
|
+
set :bundle_flags, "--deployment --quiet --binstubs"
|
|
78
|
+
set :bundle_without, [:test, :development, :preview, :engineyard]
|
|
79
|
+
set :default_environment, {
|
|
80
|
+
'RAILS_ENV' => 'production'
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Prompt to make really sure we want to deploy into prouction
|
|
84
|
+
puts "\n\e[0;31m ######################################################################"
|
|
85
|
+
puts " #\n # Are you REALLY sure you want to run this in production?"
|
|
86
|
+
puts " #\n # Enter y/N + enter to continue\n #"
|
|
87
|
+
puts " ######################################################################\e[0m\n"
|
|
88
|
+
proceed = STDIN.gets[0..0] rescue nil
|
|
89
|
+
exit unless proceed == 'y' || proceed == 'Y'
|
|
90
|
+
|
|
91
|
+
# Production Config
|
|
92
|
+
role :web, PRODUCTION_WEB
|
|
93
|
+
role :app, PRODUCTION_APP
|
|
94
|
+
role :console, PRODUCTION_CONSOLE
|
|
95
|
+
role :db, PRODUCTION_DB, :primary => true
|
|
96
|
+
set :deploy_to, PRODUCTION_DEPLOY_TO
|
|
97
|
+
set :user, PRODUCTION_USER
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
before :deploy, :no_stage_abort
|
|
101
|
+
before "db:migrate", :no_stage_abort
|
|
102
|
+
before :console, :no_stage_abort
|
|
103
|
+
|
|
104
|
+
task :no_stage_abort do
|
|
105
|
+
abort "\e[0;31mERROR: No stage specified. Please specify one of: development, staging, preview or production (e.g. 'cap development deploy')" if stage.nil?
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
set :branch do
|
|
109
|
+
# Attempt natural order search
|
|
110
|
+
default_tag = `git tag | awk -F - '{ print $2; }' | sort -t. -k 1.1n -k 3.1n -k 2.1n`.split("\n").last
|
|
111
|
+
default_tag = default_tag
|
|
112
|
+
|
|
113
|
+
tag = Capistrano::CLI.ui.ask "Tag or branch to deploy (you can even use 'master'): [#{default_tag}] "
|
|
114
|
+
tag = default_tag if tag.empty?
|
|
115
|
+
tag
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
namespace :deploy do
|
|
119
|
+
task :start do ; end
|
|
120
|
+
task :stop do ; end
|
|
121
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
|
122
|
+
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
desc "Open a remote console."
|
|
127
|
+
task :console, :roles => :console do
|
|
128
|
+
input = ''
|
|
129
|
+
run "cd #{current_path} && bundle exec rails console #{ENV['RAILS_ENV']}" do |channel, stream, data|
|
|
130
|
+
next if data.chomp == input.chomp || data.chomp == ''
|
|
131
|
+
print data
|
|
132
|
+
channel.send_data(input = $stdin.gets) if data =~ /:\d{3}:\d+(\*|>)/
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
require './config/boot'
|
|
137
|
+
require "bundler/capistrano"
|
|
138
|
+
load 'deploy/assets'
|
|
139
|
+
require "./config/capistrano_database_yml"
|
|
140
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
base: &base
|
|
3
|
+
adapter: sqlite3
|
|
4
|
+
timeout: 5000
|
|
5
|
+
|
|
6
|
+
development:
|
|
7
|
+
adapter: postgresql
|
|
8
|
+
host: <%= DEVELOPMENT_DB_HOST %>
|
|
9
|
+
database: <%= DEVELOPMENT_DB_NAME %>
|
|
10
|
+
username: <%= DEVELOPMENT_DB_USER %>
|
|
11
|
+
password: <%= DEVELOPMENT_DB_PASSWORD %>
|
|
12
|
+
pool: 5
|
|
13
|
+
timeout: 5000
|
|
14
|
+
encoding: utf8
|
|
15
|
+
reconnect: false
|
|
16
|
+
|
|
17
|
+
test: &test
|
|
18
|
+
adapter: postgresql
|
|
19
|
+
database: <%= TEST_DB_NAME %>
|
|
20
|
+
username: <%= TEST_DB_USER %>
|
|
21
|
+
password: <%= TEST_DB_PASSWORD %>
|
|
22
|
+
pool: 5
|
|
23
|
+
timeout: 5000
|
|
24
|
+
encoding: utf8
|
|
25
|
+
reconnect: false
|
|
26
|
+
|
|
27
|
+
preview:
|
|
28
|
+
adapter: postgresql
|
|
29
|
+
database: <%= PREVIEW_DB_NAME %>
|
|
30
|
+
username: <%= PREVIEW_DB_USER %>
|
|
31
|
+
password: <%= PREVIEW_DB_PASSWORD %>
|
|
32
|
+
pool: 5
|
|
33
|
+
timeout: 5000
|
|
34
|
+
encoding: utf8
|
|
35
|
+
reconnect: false
|
|
36
|
+
|
|
37
|
+
production:
|
|
38
|
+
adapter: postgresql
|
|
39
|
+
database: <%= PRODUCTION_DB_NAME %>
|
|
40
|
+
username: <%= PRODUCTION_DB_USER %>
|
|
41
|
+
password: <%= PRODUCTION_DB_PASSWORD %>
|
|
42
|
+
pool: 5
|
|
43
|
+
timeout: 5000
|
|
44
|
+
encoding: utf8
|
|
45
|
+
reconnect: false
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
database: db/private.sqlite3
|
|
49
|
+
<<: *base
|
|
50
|
+
|
|
51
|
+
cucumber:
|
|
52
|
+
<<: *test
|