rail_pass 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.md +20 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/rail_pass/application.js +15 -0
- data/app/assets/stylesheets/rail_pass/application.css +13 -0
- data/app/controllers/rail_pass/application_controller.rb +4 -0
- data/app/controllers/rail_pass/styleguide_controller.rb +7 -0
- data/app/helpers/rail_pass/application_helper.rb +4 -0
- data/app/views/rail_pass/styleguide/index.html.haml +104 -0
- data/config/routes.rb +3 -0
- data/lib/generators/rail_pass/install_generator.rb +220 -0
- data/lib/generators/templates/Procfile +1 -0
- data/lib/generators/templates/app/assets/javascripts/application.js +17 -0
- data/lib/generators/templates/app/assets/javascripts/html5.js +14 -0
- data/lib/generators/templates/app/assets/javascripts/polyfills.js +14 -0
- data/lib/generators/templates/app/assets/javascripts/responsive.js +14 -0
- data/lib/generators/templates/app/assets/javascripts/scripts.js.coffee +0 -0
- data/lib/generators/templates/app/assets/stylesheets/application.css.scss +26 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_colors.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_defaults.scss +27 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_forms.scss +0 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_settings.scss +0 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_typography.scss +3 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_containers.scss +18 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_footer.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_header.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_settings.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/modules/_buttons.scss +15 -0
- data/lib/generators/templates/app/controllers/pages_controller.rb +2 -0
- data/lib/generators/templates/app/helpers/application_helper.rb +87 -0
- data/lib/generators/templates/app/views/errors/404.html.haml +3 -0
- data/lib/generators/templates/app/views/layouts/application.html.haml +124 -0
- data/lib/generators/templates/app/views/pages/index.html.haml +0 -0
- data/lib/generators/templates/config/deploy.rb +34 -0
- data/lib/generators/templates/config/initializers/dev_environment.rb +6 -0
- data/lib/generators/templates/config/initializers/new_relic.rb +5 -0
- data/lib/generators/templates/config/mongoid.yml +68 -0
- data/lib/generators/templates/config/newrelic.yml +255 -0
- data/lib/generators/templates/config/recipes/base.rb +86 -0
- data/lib/generators/templates/config/recipes/check.rb +13 -0
- data/lib/generators/templates/config/recipes/mongodb/install-outdated.rb +41 -0
- data/lib/generators/templates/config/recipes/mongodb/install.rb +45 -0
- data/lib/generators/templates/config/recipes/mongodb/manage.rb +27 -0
- data/lib/generators/templates/config/recipes/mongodb.rb +73 -0
- data/lib/generators/templates/config/recipes/mysql.rb +152 -0
- data/lib/generators/templates/config/recipes/nginx.rb +25 -0
- data/lib/generators/templates/config/recipes/nodejs.rb +9 -0
- data/lib/generators/templates/config/recipes/postgresql.rb +34 -0
- data/lib/generators/templates/config/recipes/rbenv.rb +29 -0
- data/lib/generators/templates/config/recipes/redis.rb +18 -0
- data/lib/generators/templates/config/recipes/ruby.rb +93 -0
- data/lib/generators/templates/config/recipes/templates/foreman.erb +2 -0
- data/lib/generators/templates/config/recipes/templates/gitlab.yml.erb +29 -0
- data/lib/generators/templates/config/recipes/templates/mongoid.yml.erb +10 -0
- data/lib/generators/templates/config/recipes/templates/mysql.yml.erb +7 -0
- data/lib/generators/templates/config/recipes/templates/nginx_unicorn.erb +27 -0
- data/lib/generators/templates/config/recipes/templates/postgresql.yml.erb +8 -0
- data/lib/generators/templates/config/recipes/templates/unicorn.rb.erb +8 -0
- data/lib/generators/templates/config/recipes/templates/unicorn_init.erb +84 -0
- data/lib/generators/templates/config/recipes/unicorn.rb +28 -0
- data/lib/generators/templates/config/recipes/utilities.rb +144 -0
- data/lib/generators/templates/config/unicorn.rb +2 -0
- data/lib/generators/templates/public/422.html +54 -0
- data/lib/generators/templates/public/500.html +54 -0
- data/lib/generators/templates/spec/spec_helper.rb +41 -0
- data/lib/generators/templates/vendor/assets/fonts/fontawesome/fontawesome-webfont.eot +0 -0
- data/lib/generators/templates/vendor/assets/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
- data/lib/generators/templates/vendor/assets/fonts/fontawesome/fontawesome-webfont.woff +0 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.eot +0 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.svg +36 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.ttf +0 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.woff +0 -0
- data/lib/generators/templates/vendor/assets/javascripts/jquery.ui.touch-punch.min.js +11 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/html5shim.js +3 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/modernizr.js +4 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/respond.js +15 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/selectivizr.js +560 -0
- data/lib/generators/templates/vendor/assets/stylesheets/font-awesome.scss +493 -0
- data/lib/generators/templates/vendor/assets/stylesheets/icomoon.scss +22 -0
- data/lib/rail_pass/engine.rb +5 -0
- data/lib/rail_pass/version.rb +3 -0
- data/lib/rail_pass.rb +4 -0
- data/lib/tasks/rail_pass_tasks.rake +4 -0
- metadata +146 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
### BEGIN INIT INFO
|
3
|
+
# Provides: unicorn
|
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
|
9
|
+
# Description: Start, stop, restart unicorn server for a specific application.
|
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_ROOT=<%= current_path %>
|
16
|
+
PID=<%= unicorn_pid %>
|
17
|
+
CMD="cd <%= current_path %>; bundle exec unicorn -D -c <%= unicorn_config %> -E production"
|
18
|
+
AS_USER=<%= unicorn_user %>
|
19
|
+
set -u
|
20
|
+
|
21
|
+
OLD_PIN="$PID.oldbin"
|
22
|
+
|
23
|
+
sig () {
|
24
|
+
test -s "$PID" && kill -$1 `cat $PID`
|
25
|
+
}
|
26
|
+
|
27
|
+
oldsig () {
|
28
|
+
test -s $OLD_PIN && kill -$1 `cat $OLD_PIN`
|
29
|
+
}
|
30
|
+
|
31
|
+
run () {
|
32
|
+
if [ "$(id -un)" = "$AS_USER" ]; then
|
33
|
+
eval $1
|
34
|
+
else
|
35
|
+
su -c "$1" - $AS_USER
|
36
|
+
fi
|
37
|
+
}
|
38
|
+
|
39
|
+
case "$1" in
|
40
|
+
start)
|
41
|
+
sig 0 && echo >&2 "Already running" && exit 0
|
42
|
+
run "$CMD"
|
43
|
+
;;
|
44
|
+
stop)
|
45
|
+
sig QUIT && exit 0
|
46
|
+
echo >&2 "Not running"
|
47
|
+
;;
|
48
|
+
force-stop)
|
49
|
+
sig TERM && exit 0
|
50
|
+
echo >&2 "Not running"
|
51
|
+
;;
|
52
|
+
restart|reload)
|
53
|
+
sig HUP && echo reloaded OK && exit 0
|
54
|
+
echo >&2 "Couldn't reload, starting '$CMD' instead"
|
55
|
+
run "$CMD"
|
56
|
+
;;
|
57
|
+
upgrade)
|
58
|
+
if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
|
59
|
+
then
|
60
|
+
n=$TIMEOUT
|
61
|
+
while test -s $OLD_PIN && test $n -ge 0
|
62
|
+
do
|
63
|
+
printf '.' && sleep 1 && n=$(( $n - 1 ))
|
64
|
+
done
|
65
|
+
echo
|
66
|
+
|
67
|
+
if test $n -lt 0 && test -s $OLD_PIN
|
68
|
+
then
|
69
|
+
echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds"
|
70
|
+
exit 1
|
71
|
+
fi
|
72
|
+
exit 0
|
73
|
+
fi
|
74
|
+
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
|
75
|
+
run "$CMD"
|
76
|
+
;;
|
77
|
+
reopen-logs)
|
78
|
+
sig USR1
|
79
|
+
;;
|
80
|
+
*)
|
81
|
+
echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
|
82
|
+
exit 1
|
83
|
+
;;
|
84
|
+
esac
|
@@ -0,0 +1,28 @@
|
|
1
|
+
set_default(:unicorn_user) { user }
|
2
|
+
set_default(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
|
3
|
+
set_default(:unicorn_config) { "#{shared_path}/config/unicorn.rb" }
|
4
|
+
set_default(:unicorn_log) { "#{shared_path}/log/unicorn.log" }
|
5
|
+
set_default(:unicorn_workers, 2)
|
6
|
+
|
7
|
+
namespace :unicorn do
|
8
|
+
desc "Setup Unicorn initializer and app configuration"
|
9
|
+
task :setup, roles: :app do
|
10
|
+
run "mkdir -p #{shared_path}/config"
|
11
|
+
template "unicorn.rb.erb", unicorn_config
|
12
|
+
template "unicorn_init.erb", "/tmp/unicorn_init"
|
13
|
+
run "chmod +x /tmp/unicorn_init"
|
14
|
+
run "#{sudo} mv /tmp/unicorn_init /etc/init.d/unicorn_#{application}"
|
15
|
+
run "#{sudo} update-rc.d -f unicorn_#{application} defaults"
|
16
|
+
end
|
17
|
+
##### Disable the following line if using Foreman #####
|
18
|
+
# after "deploy:setup", "unicorn:setup"
|
19
|
+
|
20
|
+
%w[start stop restart].each do |command|
|
21
|
+
desc "#{command} unicorn"
|
22
|
+
task command, roles: :app do
|
23
|
+
run "service unicorn_#{application} #{command}"
|
24
|
+
end
|
25
|
+
##### Disable the following line if using Foreman #####
|
26
|
+
# after "deploy:#{command}", "unicorn:#{command}"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Utilities
|
4
|
+
# utilities.config_gsub('/etc/example', /(.*)/im, "\\1")
|
5
|
+
def config_gsub(file, find, replace)
|
6
|
+
tmp="/tmp/#{File.basename(file)}"
|
7
|
+
get file, tmp
|
8
|
+
content=File.open(tmp).read
|
9
|
+
content.gsub!(find,replace)
|
10
|
+
put content, tmp
|
11
|
+
sudo "mv #{tmp} #{file}"
|
12
|
+
end
|
13
|
+
|
14
|
+
# utilities.ask('What is your name?', 'John')
|
15
|
+
def ask(question, default='')
|
16
|
+
question = "\n" + question.join("\n") if question.respond_to?(:uniq)
|
17
|
+
answer = Capistrano::CLI.ui.ask(space(question)).strip
|
18
|
+
answer.empty? ? default : answer
|
19
|
+
end
|
20
|
+
|
21
|
+
# utilities.yes?('Proceed with install?')
|
22
|
+
def yes?(question)
|
23
|
+
question = "\n" + question.join("\n") if question.respond_to?(:uniq)
|
24
|
+
question += ' (y/n)'
|
25
|
+
ask(question).downcase.include? 'y'
|
26
|
+
end
|
27
|
+
|
28
|
+
# utilities.apt_install %w[package1 package2]
|
29
|
+
# utilities.apt_install "package1 package2"
|
30
|
+
def apt_install(packages)
|
31
|
+
packages = packages.split(/\s+/) if packages.respond_to?(:split)
|
32
|
+
packages = Array(packages)
|
33
|
+
apt_get="DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get"
|
34
|
+
sudo "#{apt_get} -qyu --force-yes install #{packages.join(" ")}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def apt_upgrade
|
38
|
+
apt_get="DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get"
|
39
|
+
sudo "#{apt_get} -qy update"
|
40
|
+
sudo "#{apt_get} -qyu --force-yes upgrade"
|
41
|
+
end
|
42
|
+
|
43
|
+
# utilities.sudo_upload('/local/path/to/file', '/remote/path/to/destination', options)
|
44
|
+
def sudo_upload(from, to, options={}, &block)
|
45
|
+
top.upload from, "/tmp/#{File.basename(to)}", options, &block
|
46
|
+
sudo "mv /tmp/#{File.basename(to)} #{to}"
|
47
|
+
sudo "chmod #{options[:mode]} #{to}" if options[:mode]
|
48
|
+
sudo "chown #{options[:owner]} #{to}" if options[:owner]
|
49
|
+
end
|
50
|
+
|
51
|
+
# utilities.adduser('deploy')
|
52
|
+
def adduser(user, options={})
|
53
|
+
options[:shell] ||= '/bin/bash' # new accounts on ubuntu 6.06.1 have been getting /bin/sh
|
54
|
+
switches = '--disabled-password --gecos ""'
|
55
|
+
switches += " --shell=#{options[:shell]} " if options[:shell]
|
56
|
+
switches += ' --no-create-home ' if options[:nohome]
|
57
|
+
switches += " --ingroup #{options[:group]} " unless options[:group].nil?
|
58
|
+
invoke_command "grep '^#{user}:' /etc/passwd || sudo /usr/sbin/adduser #{user} #{switches}",
|
59
|
+
:via => run_method
|
60
|
+
end
|
61
|
+
|
62
|
+
# role = :app
|
63
|
+
def with_role(role, &block)
|
64
|
+
original, ENV['HOSTS'] = ENV['HOSTS'], find_servers(:roles => role).map{|d| d.host}.join(",")
|
65
|
+
begin
|
66
|
+
yield
|
67
|
+
ensure
|
68
|
+
ENV['HOSTS'] = original
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# utilities.with_credentials(:user => 'xxxx', :password => 'secret')
|
73
|
+
# options = { :user => 'xxxxx', :password => 'xxxxx' }
|
74
|
+
def with_credentials(options={}, &block)
|
75
|
+
original_username, original_password = user, password
|
76
|
+
begin
|
77
|
+
set :user, options[:user] || original_username
|
78
|
+
set :password, options[:password] || original_password
|
79
|
+
yield
|
80
|
+
ensure
|
81
|
+
set :user, original_username
|
82
|
+
set :password, original_password
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def space(str)
|
87
|
+
"\n#{'=' * 80}\n#{str}"
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# Run a command and ask for input when input_query is seen.
|
92
|
+
# Sends the response back to the server.
|
93
|
+
#
|
94
|
+
# +input_query+ is a regular expression that defaults to /^Password/.
|
95
|
+
# Can be used where +run+ would otherwise be used.
|
96
|
+
# run_with_input 'ssh-keygen ...', /^Are you sure you want to overwrite\?/
|
97
|
+
def run_with_input(shell_command, input_query=/^Password/, response=nil)
|
98
|
+
handle_command_with_input(:run, shell_command, input_query, response)
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Run a command using sudo and ask for input when a regular expression is seen.
|
103
|
+
# Sends the response back to the server.
|
104
|
+
#
|
105
|
+
# See also +run_with_input+
|
106
|
+
# +input_query+ is a regular expression
|
107
|
+
def sudo_with_input(shell_command, input_query=/^Password/, response=nil)
|
108
|
+
handle_command_with_input(:sudo, shell_command, input_query, response)
|
109
|
+
end
|
110
|
+
|
111
|
+
def invoke_with_input(shell_command, input_query=/^Password/, response=nil)
|
112
|
+
handle_command_with_input(run_method, shell_command, input_query, response)
|
113
|
+
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
##
|
118
|
+
# Does the actual capturing of the input and streaming of the output.
|
119
|
+
#
|
120
|
+
# local_run_method: run or sudo
|
121
|
+
# shell_command: The command to run
|
122
|
+
# input_query: A regular expression matching a request for input: /^Please enter your password/
|
123
|
+
def handle_command_with_input(local_run_method, shell_command, input_query, response=nil)
|
124
|
+
send(local_run_method, shell_command, {:pty => true}) do |channel, stream, data|
|
125
|
+
|
126
|
+
if data =~ input_query
|
127
|
+
if response
|
128
|
+
logger.info "#{data} #{"*"*(rand(10)+5)}", channel[:host]
|
129
|
+
channel.send_data "#{response}\n"
|
130
|
+
else
|
131
|
+
logger.info data, channel[:host]
|
132
|
+
response = ::Capistrano::CLI.password_prompt "#{data}"
|
133
|
+
channel.send_data "#{response}\n"
|
134
|
+
end
|
135
|
+
else
|
136
|
+
logger.info data, channel[:host]
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
Capistrano.plugin :utilities, Utilities
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta content='initial-scale=1.0, width=device-width, user-scalable=no, maximum-scale=1.0' name='viewport'>
|
6
|
+
|
7
|
+
<style type="text/css">
|
8
|
+
|
9
|
+
html body{
|
10
|
+
/* <<< For IE >>> */
|
11
|
+
padding-left: 0;
|
12
|
+
padding-right: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
body {
|
16
|
+
color: #999;
|
17
|
+
background-color: #EFF0F2;
|
18
|
+
font-size: 100%;
|
19
|
+
text-align: center;
|
20
|
+
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
21
|
+
text-shadow: 1px 1px 1px white;
|
22
|
+
-webkit-font-smoothing: antialiased !important;
|
23
|
+
}
|
24
|
+
|
25
|
+
div.dialog {
|
26
|
+
max-width: 25em;
|
27
|
+
padding: 0.5em 2em;
|
28
|
+
margin: 4em auto 0 auto;
|
29
|
+
background: #F8F8F8;
|
30
|
+
border: 1px solid #E9E9E9;
|
31
|
+
border-bottom-color: #D5D5D5;
|
32
|
+
}
|
33
|
+
h1 {
|
34
|
+
color: #F27390;
|
35
|
+
font-size: 1em;
|
36
|
+
font-weight: normal;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
p {
|
41
|
+
font-size: 0.8125em;
|
42
|
+
line-height: 1.3;
|
43
|
+
}
|
44
|
+
</style>
|
45
|
+
</head>
|
46
|
+
|
47
|
+
<body>
|
48
|
+
<!-- This file lives in public/422.html -->
|
49
|
+
<div class="dialog">
|
50
|
+
<h1>The change you wanted was rejected.</h1>
|
51
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
52
|
+
</div>
|
53
|
+
</body>
|
54
|
+
</html>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta content='initial-scale=1.0, width=device-width, user-scalable=no, maximum-scale=1.0' name='viewport'>
|
6
|
+
|
7
|
+
<style type="text/css">
|
8
|
+
|
9
|
+
html body{
|
10
|
+
/* <<< For IE >>> */
|
11
|
+
padding-left: 0;
|
12
|
+
padding-right: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
body {
|
16
|
+
color: #999;
|
17
|
+
background-color: #EFF0F2;
|
18
|
+
font-size: 100%;
|
19
|
+
text-align: center;
|
20
|
+
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
21
|
+
text-shadow: 1px 1px 1px white;
|
22
|
+
-webkit-font-smoothing: antialiased !important;
|
23
|
+
}
|
24
|
+
|
25
|
+
div.dialog {
|
26
|
+
max-width: 25em;
|
27
|
+
padding: 0.5em 2em;
|
28
|
+
margin: 4em auto 0 auto;
|
29
|
+
background: #F8F8F8;
|
30
|
+
border: 1px solid #E9E9E9;
|
31
|
+
border-bottom-color: #D5D5D5;
|
32
|
+
}
|
33
|
+
h1 {
|
34
|
+
color: #F27390;
|
35
|
+
font-size: 1em;
|
36
|
+
font-weight: normal;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
p {
|
41
|
+
font-size: 0.8125em;
|
42
|
+
line-height: 1.3;
|
43
|
+
}
|
44
|
+
</style>
|
45
|
+
</head>
|
46
|
+
|
47
|
+
<body>
|
48
|
+
<!-- This file lives in public/500.html -->
|
49
|
+
<div class="dialog">
|
50
|
+
<h1>We're sorry, but something went wrong.</h1>
|
51
|
+
<p>We have been notified of the issue. Please try refreshing the browser in a moment.</p>
|
52
|
+
</div>
|
53
|
+
</body>
|
54
|
+
</html>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spork'
|
3
|
+
|
4
|
+
# Load with Spork server
|
5
|
+
#
|
6
|
+
Spork.prefork do
|
7
|
+
ENV["RAILS_ENV"] ||= 'test'
|
8
|
+
require File.expand_path("../../config/environment", __FILE__)
|
9
|
+
require 'rspec/rails'
|
10
|
+
require 'rspec/autorun'
|
11
|
+
require 'capybara/rspec'
|
12
|
+
require 'shoulda-matchers'
|
13
|
+
require 'shoulda/matchers/integrations/rspec'
|
14
|
+
|
15
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
16
|
+
# Capybara.javascript_driver = :poltergeist
|
17
|
+
# Capybara.default_driver = :selenium
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.infer_base_class_for_anonymous_controllers = false
|
21
|
+
config.order = "random"
|
22
|
+
|
23
|
+
# Database Cleaner
|
24
|
+
#
|
25
|
+
config.before(:suite) do
|
26
|
+
DatabaseCleaner.strategy = :truncation
|
27
|
+
end
|
28
|
+
config.before(:each) do
|
29
|
+
DatabaseCleaner.start
|
30
|
+
end
|
31
|
+
config.after(:each) do
|
32
|
+
DatabaseCleaner.clean
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
# Run each time you run your specs.
|
39
|
+
#
|
40
|
+
Spork.each_run do
|
41
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4
|
+
<metadata>
|
5
|
+
This is a custom SVG font generated by IcoMoon.
|
6
|
+
<iconset grid="16"></iconset>
|
7
|
+
</metadata>
|
8
|
+
<defs>
|
9
|
+
<font id="icomoon" horiz-adv-x="512" >
|
10
|
+
<font-face units-per-em="512" ascent="480" descent="-32" />
|
11
|
+
<missing-glyph horiz-adv-x="512" />
|
12
|
+
<glyph unicode="" d="M 512.00,382.791c-18.838-8.354-39.082-14.001-60.33-16.54c 21.686,13.00, 38.343,33.585, 46.186,58.115
|
13
|
+
c-20.298-12.039-42.778-20.78-66.705-25.49c-19.16,20.415-46.461,33.17-76.673,33.17c-58.011,0.00-105.044-47.029-105.044-105.039
|
14
|
+
c0.00-8.233, 0.929-16.25, 2.72-23.939c-87.30,4.382-164.701,46.20-216.509,109.753c-9.042-15.514-14.223-33.558-14.223-52.809
|
15
|
+
c0.00-36.444, 18.544-68.596, 46.73-87.433c-17.219,0.546-33.416,5.271-47.577,13.139c-0.01-0.438-0.01-0.878-0.01-1.321
|
16
|
+
c0.00-50.894, 36.209-93.348, 84.261-103.00c-8.813-2.40-18.094-3.686-27.674-3.686c-6.769,0.00-13.349,0.66-19.764,1.886
|
17
|
+
c 13.368-41.73, 52.16-72.103, 98.126-72.948c-35.95-28.175-81.243-44.967-130.458-44.967c-8.479,0.00-16.84,0.497-25.058,1.47
|
18
|
+
c 46.486-29.805, 101.701-47.197, 161.021-47.197c 193.211,0.00, 298.868,160.062, 298.868,298.872c0.00,4.554-0.103,9.084-0.305,13.59
|
19
|
+
C 480.11,343.227, 497.918,361.727, 512.00,382.791z" />
|
20
|
+
<glyph unicode="" d="M 287.935-32.00L 192.00-32.00 L 192.00,224.00 l-64.00,0.00 l0.00,88.225 l 64.00,0.029l-0.104,51.976C 191.896,436.206, 211.413,480.00, 296.195,480.00l 70.588,0.00 l0.00-88.242 l-44.115,0.00
|
21
|
+
c-33.016,0.00-34.603-12.328-34.603-35.342l-0.131-44.162l 79.345,0.00 l-9.352-88.225L 288.00,224.00L 287.935-32.00z" />
|
22
|
+
<glyph unicode="" d="M 279.533,448.00c0.00,0.00-100.478,0.00-133.97,0.00C 85.503,448.00, 28.978,402.497, 28.978,349.789c0.00-53.863, 40.941-97.333, 102.044-97.333
|
23
|
+
c 4.249,0.00, 8.378,0.085, 12.421,0.376c-3.965-7.593-6.801-16.144-6.801-25.021c0.00-14.969, 8.052-27.105, 18.234-37.012
|
24
|
+
c-7.693,0.00-15.121-0.224-23.226-0.224C 57.259,190.576,0.00,143.196,0.00,94.065c0.00-48.389, 62.771-78.657, 137.167-78.657
|
25
|
+
c 84.812,0.00, 131.653,48.122, 131.653,96.514c0.00,38.80-11.448,62.036-46.843,87.067c-12.108,8.572-35.265,29.418-35.265,41.672
|
26
|
+
c0.00,14.36, 4.098,21.434, 25.714,38.323c 22.156,17.312, 37.836,41.651, 37.836,69.958c0.00,33.703-15.01,66.549-43.186,77.386l 42.477,0.00
|
27
|
+
L 279.533,448.00z M 232.74,120.271c 1.063-4.486, 1.642-9.103, 1.642-13.814c0.00-39.10-25.196-69.655-97.487-69.655
|
28
|
+
c-51.421,0.00-88.558,32.552-88.558,71.65c0.00,38.321, 46.063,70.222, 97.482,69.666c 12.00-0.127, 23.184-2.058, 33.335-5.345
|
29
|
+
C 207.067,153.36, 227.092,142.392, 232.74,120.271z M 150.409,266.112c-34.519,1.032-67.318,38.613-73.276,83.93
|
30
|
+
c-5.958,45.333, 17.185,80.021, 51.694,78.995c 34.505-1.037, 67.319-37.407, 73.279-82.729
|
31
|
+
C 208.059,300.978, 184.911,265.079, 150.409,266.112zM 416.00,352.00L 416.00,448.00L 384.00,448.00L 384.00,352.00L 288.00,352.00L 288.00,320.00L 384.00,320.00L 384.00,224.00L 416.00,224.00L 416.00,320.00L 512.00,320.00L 512.00,352.00 z" />
|
32
|
+
<glyph unicode="" d="M 325.608,214.818L 512.00,86.264L 512.00,382.211 zM0.00,382.211L0.00,86.264L 186.388,214.836 zM 256.00,152.309L 211.499,192.264L0.00,64.00L 512.00,64.00L 300.495,192.264 zM 496.64,384.00L 15.36,384.00L 256.00,203.074 z" />
|
33
|
+
<glyph unicode="" d="M 236.928,38.421 L 431.744,399.957 L 365.515,399.957 L 170.667,38.421 ZM 324.00,38.421L 519.328,399.957L 585.579,399.957L 390.251,38.421 zM 760.939,38.421c-99.691,0.00-180.789,81.099-180.789,180.843C 580.16,318.912, 661.259,399.957, 760.939,399.957
|
34
|
+
c 99.659,0.00, 180.715-81.045, 180.715-180.704C 941.653,119.52, 860.597,38.421, 760.939,38.421z" horiz-adv-x="1109.3333333333333" />
|
35
|
+
<glyph class="hidden" unicode="" d="M0,480L 512 -32L0 -32 z" horiz-adv-x="0" />
|
36
|
+
</font></defs></svg>
|
Binary file
|
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery UI Touch Punch 0.2.2
|
3
|
+
*
|
4
|
+
* Copyright 2011, Dave Furfero
|
5
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6
|
+
*
|
7
|
+
* Depends:
|
8
|
+
* jquery.ui.widget.js
|
9
|
+
* jquery.ui.mouse.js
|
10
|
+
*/
|
11
|
+
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
|
@@ -0,0 +1,3 @@
|
|
1
|
+
/*! HTML5 Shiv pre3.5 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
2
|
+
Uncompressed source: https://github.com/aFarkas/html5shiv */
|
3
|
+
(function(a,b){function h(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function i(){var a=l.elements;return typeof a=="string"?a.split(" "):a}function j(a){var b={},c=a.createElement,f=a.createDocumentFragment,g=f();a.createElement=function(a){l.shivMethods||c(a);var f;return b[a]?f=b[a].cloneNode():e.test(a)?f=(b[a]=c(a)).cloneNode():f=c(a),f.canHaveChildren&&!d.test(a)?g.appendChild(f):f},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(a){return b[a]=c(a),g.createElement(a),'c("'+a+'")'})+");return n}")(l,g)}function k(a){var b;return a.documentShived?a:(l.shivCSS&&!f&&(b=!!h(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),g||(b=!j(a)),b&&(a.documentShived=b),a)}function p(a){var b,c=a.getElementsByTagName("*"),d=c.length,e=RegExp("^(?:"+i().join("|")+")$","i"),f=[];while(d--)b=c[d],e.test(b.nodeName)&&f.push(b.applyElement(q(b)));return f}function q(a){var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(n+":"+a.nodeName);while(d--)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function r(a){var b,c=a.split("{"),d=c.length,e=RegExp("(^|[\\s,>+~])("+i().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),f="$1"+n+"\\:$2";while(d--)b=c[d]=c[d].split("}"),b[b.length-1]=b[b.length-1].replace(e,f),c[d]=b.join("}");return c.join("{")}function s(a){var b=a.length;while(b--)a[b].removeNode()}function t(a){var b,c,d=a.namespaces,e=a.parentWindow;return!o||a.printShived?a:(typeof d[n]=="undefined"&&d.add(n),e.attachEvent("onbeforeprint",function(){var d,e,f,g=a.styleSheets,i=[],j=g.length,k=Array(j);while(j--)k[j]=g[j];while(f=k.pop())if(!f.disabled&&m.test(f.media)){for(d=f.imports,j=0,e=d.length;j<e;j++)k.push(d[j]);try{i.push(f.cssText)}catch(l){}}i=r(i.reverse().join("")),c=p(a),b=h(a,i)}),e.attachEvent("onafterprint",function(){s(c),b.removeNode(!0)}),a.printShived=!0,a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea|object|iframe)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g;(function(){var c=b.createElement("a");c.innerHTML="<xyz></xyz>",f="hidden"in c,f&&typeof injectElementWithStyles=="function"&&injectElementWithStyles("#modernizr{}",function(b){b.hidden=!0,f=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).display=="none"}),g=c.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var l={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:k};a.html5=l,k(b);var m=/^$|\b(?:all|print)\b/,n="html5shiv",o=!g&&function(){var c=b.documentElement;return typeof b.namespaces!="undefined"&&typeof b.parentWindow!="undefined"&&typeof c.applyElement!="undefined"&&typeof c.removeNode!="undefined"&&typeof a.attachEvent!="undefined"}();l.type+=" print",l.shivPrint=t,t(b)})(this,document)
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
|
2
|
+
* Build: http://www.modernizr.com/download/#-canvas-iepp-mq-cssclasses-addtest-teststyles-load
|
3
|
+
*/
|
4
|
+
;window.Modernizr=function(a,b,c){function z(a,b){return!!~(""+a).indexOf(b)}function y(a,b){return typeof a===b}function x(a,b){return w(prefixes.join(a+";")+(b||""))}function w(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n={},o={},p={},q=[],r=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["­","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},s=function(b){if(a.matchMedia)return matchMedia(b).matches;var c;r("@media "+b+" { #"+i+" { position: absolute; } }",function(b){c=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).position=="absolute"});return c},t,u={}.hasOwnProperty,v;!y(u,c)&&!y(u.call,c)?v=function(a,b){return u.call(a,b)}:v=function(a,b){return b in a&&y(a.constructor.prototype[b],c)},n.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")};for(var A in n)v(n,A)&&(t=A.toLowerCase(),e[t]=n[A](),q.push((e[t]?"":"no-")+t));e.addTest=function(a,b){if(typeof a=="object")for(var d in a)v(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return;b=typeof b=="boolean"?b:!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b}return e},w(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e.mq=s,e.testStyles=r,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+q.join(" "):"");return e}(this,this.document),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into respond.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
14
|
+
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
15
|
+
window.matchMedia=window.matchMedia||function(a,b){var c,d=a.documentElement,e=d.firstElementChild||d.firstChild,f=a.createElement("body"),g=a.createElement("div");return g.id="mq-test-1",g.style.cssText="position:absolute;top:-100em",f.style.background="none",f.appendChild(g),function(a){return g.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',d.insertBefore(f,e),c=g.offsetWidth==42,d.removeChild(f),{matches:c,media:a}}}(document),function(a){function w(){t(!0)}a.respond={},respond.update=function(){},respond.mediaQueriesSupported=a.matchMedia&&a.matchMedia("only all").matches;if(respond.mediaQueriesSupported)return;var b=a.document,c=b.documentElement,d=[],e=[],f=[],g={},h=30,i=b.getElementsByTagName("head")[0]||c,j=b.getElementsByTagName("base")[0],k=i.getElementsByTagName("link"),l=[],m=function(){var b=k,c=b.length,d=0,e,f,h,i;for(;d<c;d++)e=b[d],f=e.href,h=e.media,i=e.rel&&e.rel.toLowerCase()==="stylesheet",!!f&&i&&!g[f]&&(e.styleSheet&&e.styleSheet.rawCssText?(o(e.styleSheet.rawCssText,f,h),g[f]=!0):(!/^([a-zA-Z:]*\/\/)/.test(f)&&!j||f.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&l.push({href:f,media:h}));n()},n=function(){if(l.length){var a=l.shift();u(a.href,function(b){o(b,a.href,a.media),g[a.href]=!0,n()})}},o=function(a,b,c){var f=a.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),g=f&&f.length||0,b=b.substring(0,b.lastIndexOf("/")),h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c,j=0,k,l,m,n,o;b.length&&(b+="/"),i&&(g=1);for(;j<g;j++){k=0,i?(l=c,e.push(h(a))):(l=f[j].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,e.push(RegExp.$2&&h(RegExp.$2))),n=l.split(","),o=n.length;for(;k<o;k++)m=n[k],d.push({media:m.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:e.length-1,hasquery:m.indexOf("(")>-1,minw:m.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:m.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}t()},p,q,r=function(){var a,d=b.createElement("div"),e=b.body,f=!1;return d.style.cssText="position:absolute;font-size:1em;width:1em",e||(e=f=b.createElement("body"),e.style.background="none"),e.appendChild(d),c.insertBefore(e,c.firstChild),a=d.offsetWidth,f?c.removeChild(e):e.removeChild(d),a=s=parseFloat(a),a},s,t=function(a){var g="clientWidth",j=c[g],l=b.compatMode==="CSS1Compat"&&j||b.body[g]||j,m={},n=k[k.length-1],o=(new Date).getTime();if(a&&p&&o-p<h){clearTimeout(q),q=setTimeout(t,h);return}p=o;for(var u in d){var v=d[u],w=v.minw,x=v.maxw,y=w===null,z=x===null,A="em";!w||(w=parseFloat(w)*(w.indexOf(A)>-1?s||r():1)),!x||(x=parseFloat(x)*(x.indexOf(A)>-1?s||r():1));if(!v.hasquery||(!y||!z)&&(y||l>=w)&&(z||l<=x))m[v.media]||(m[v.media]=[]),m[v.media].push(e[v.rules])}for(var u in f)f[u]&&f[u].parentNode===i&&i.removeChild(f[u]);for(var u in m){var B=b.createElement("style"),C=m[u].join("\n");B.type="text/css",B.media=u,i.insertBefore(B,n.nextSibling),B.styleSheet?B.styleSheet.cssText=C:B.appendChild(b.createTextNode(C)),f.push(B)}},u=function(a,b){var c=v();if(!c)return;c.open("GET",a,!0),c.onreadystatechange=function(){if(c.readyState!=4||c.status!=200&&c.status!=304)return;b(c.responseText)};if(c.readyState==4)return;c.send(null)},v=function(){var a=!1;try{a=new XMLHttpRequest}catch(b){a=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return a}}();m(),respond.update=m,a.addEventListener?a.addEventListener("resize",w,!1):a.attachEvent&&a.attachEvent("onresize",w)}(this);
|