da-suspenders 1.0.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.
- data/.gitignore +4 -0
- data/LICENSE +21 -0
- data/README.md +62 -0
- data/Rakefile +40 -0
- data/bin/da-suspenders +23 -0
- data/da-suspenders.gemspec +26 -0
- data/features/running_cucumber.feature +18 -0
- data/features/step_definitions/shell.rb +30 -0
- data/features/support/env.rb +1 -0
- data/lib/create.rb +55 -0
- data/lib/da-suspenders/version.rb +3 -0
- data/lib/errors.rb +12 -0
- data/template/da-suspenders.rb +166 -0
- data/template/files/factory_girl_steps.rb +1 -0
- data/template/files/mysql_database.yml.erb +39 -0
- data/template/trout/Gemfile +30 -0
- data/template/trout/app/helpers/body_class_helper.rb +6 -0
- data/template/trout/app/javascripts/application.js +10 -0
- data/template/trout/app/stylesheets/application.scss +14 -0
- data/template/trout/app/stylesheets/ie.scss +2 -0
- data/template/trout/app/views/layouts/application.html.erb +16 -0
- data/template/trout/app/views/shared/_flashes.html.erb +5 -0
- data/template/trout/config/initializers/errors.rb +26 -0
- data/template/trout/config/locales/de.yml +149 -0
- data/template/trout/features/step_definitions/js_steps.rb +3 -0
- data/template/trout/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/template/trout/vendor/sprockets/jquery-ujs/src/rails.js +169 -0
- data/template/trout/vendor/sprockets/modernizr/src/modernizr.js +30 -0
- metadata +136 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010 Mike Burns
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
DA-Suspenders is a base Rails application that you can upgrade.
|
|
2
|
+
|
|
3
|
+
This is a fork of [thoughtbot's original Suspenders](https://github.com/thoughtbot/suspenders/), customized to our needs.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
First install the da-suspenders gem:
|
|
9
|
+
|
|
10
|
+
gem install da-suspenders
|
|
11
|
+
|
|
12
|
+
Then run:
|
|
13
|
+
|
|
14
|
+
da-suspenders create projectname
|
|
15
|
+
|
|
16
|
+
This will create a Rails 3 app in `projectname'. This script creates a new git repository. It is not meant to be used against an existing repo.
|
|
17
|
+
|
|
18
|
+
Suspenders uses [Trout](https://github.com/thoughtbot/trout) to make it easier to maintain a base version of special files (like Gemfile) in Suspenders.
|
|
19
|
+
|
|
20
|
+
Whenever you want to get the latest and greatest Suspenders' Gemfile, run:
|
|
21
|
+
|
|
22
|
+
trout update Gemfile
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Gemfile
|
|
26
|
+
|
|
27
|
+
To see the latest and greatest gems, look at DA-Suspenders'
|
|
28
|
+
[template/trout/Gemfile](https://github.com/die-antwort/da-suspenders/blob/master/template/trout/Gemfile), which will be copied into your projectname/Gemfile.
|
|
29
|
+
|
|
30
|
+
It includes application gems like:
|
|
31
|
+
|
|
32
|
+
* [Compass](https://github.com/chriseppstein/compass), a [Sass-based](http://sass-lang.com/) CSS Meta-Framework
|
|
33
|
+
* [Formtastic](https://github.com/justinfrench/formtastic) for better forms
|
|
34
|
+
* [Hoptoad Notifier](https://github.com/thoughtbot/hoptoad_notifier) for exception notification
|
|
35
|
+
* [Paperclip](https://github.com/thoughtbot/paperclip) for file uploads
|
|
36
|
+
* [Sprockets](https://github.com/sstephenson/sprockets) for JavaScript dependency management and concatenation
|
|
37
|
+
* Our fork of [jRails](https://github.com/die-antwort/jrails), which brings you [jQuery](https://github.com/jquery/jquery) and [jQuery UI](https://github.com/jquery/jquery-ui) via Sprockets
|
|
38
|
+
* [AppConfig](https://github.com/die-antwort/app_config) for simple application configuration
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
And testing gems like:
|
|
42
|
+
|
|
43
|
+
* [Cucumber, Capybara, and Akephalos](http://robots.thoughtbot.com/post/1658763359/thoughtbot-and-the-holy-grail) for integration testing, including Javascript behavior
|
|
44
|
+
* [RSpec](https://github.com/rspec/rspec) for awesome, readable isolation testing
|
|
45
|
+
* [Factory Girl](https://github.com/thoughtbot/factory_girl) for easier creation of test data
|
|
46
|
+
* [Timecop](https://github.com/jtrupiano/timecop) for dealing with time
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## Other goodies
|
|
50
|
+
|
|
51
|
+
DA-Suspenders also comes with:
|
|
52
|
+
|
|
53
|
+
* Additional staging environment.
|
|
54
|
+
* German localization and timezone setting.
|
|
55
|
+
* Rails' flashes set up and in application layout.
|
|
56
|
+
|
|
57
|
+
See [template/files](https://github.com/die-antwort/da-suspenders/blob/master/template/trout) to see what is installed via Trout.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Credits
|
|
61
|
+
|
|
62
|
+
DA-Suspenders is created by [DIE ANTWORT](http://www.die-antwort.eu), based on Suspenders created and funded by [thoughtbot, inc](http://thoughtbot.com/community).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require "bundler"
|
|
2
|
+
require "cucumber/rake/task"
|
|
3
|
+
|
|
4
|
+
Bundler::GemHelper.install_tasks
|
|
5
|
+
|
|
6
|
+
#############################################################################
|
|
7
|
+
#
|
|
8
|
+
# Testing functions
|
|
9
|
+
#
|
|
10
|
+
#############################################################################
|
|
11
|
+
|
|
12
|
+
Cucumber::Rake::Task.new
|
|
13
|
+
|
|
14
|
+
TEST_PROJECT = "test_project"
|
|
15
|
+
|
|
16
|
+
namespace :test do
|
|
17
|
+
desc "A full suspenders app's test suite"
|
|
18
|
+
task :full => ['test_project:generate', 'cucumber', 'test_project:destroy']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
namespace :test_project do
|
|
22
|
+
desc 'Suspend a new project. Pass REPO=... to change the Suspenders repo.'
|
|
23
|
+
task :generate do
|
|
24
|
+
FileUtils.rm_rf(TEST_PROJECT)
|
|
25
|
+
sh 'ruby', 'bin/da-suspenders', 'create', TEST_PROJECT, ENV['REPO'].to_s
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
desc 'Remove a suspended project'
|
|
29
|
+
task :destroy do
|
|
30
|
+
FileUtils.cd TEST_PROJECT
|
|
31
|
+
sh "rake db:drop RAILS_ENV=development"
|
|
32
|
+
sh "rake db:drop RAILS_ENV=test"
|
|
33
|
+
FileUtils.cd '..'
|
|
34
|
+
FileUtils.rm_rf TEST_PROJECT
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
desc 'Run the test suite'
|
|
39
|
+
task :default => ['test:full']
|
|
40
|
+
|
data/bin/da-suspenders
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/create")
|
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/errors")
|
|
5
|
+
|
|
6
|
+
include DaSuspenders::Errors
|
|
7
|
+
|
|
8
|
+
def usage
|
|
9
|
+
"Usage: #{File.basename(__FILE__)} create new_project_name"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
case ARGV[0]
|
|
13
|
+
when 'create', '--create'
|
|
14
|
+
begin
|
|
15
|
+
DaSuspenders::Create.run!(ARGV[1])
|
|
16
|
+
rescue DaSuspenders::InvalidInput => e
|
|
17
|
+
error_with_message(e.message)
|
|
18
|
+
end
|
|
19
|
+
when 'help', '--help'
|
|
20
|
+
puts usage
|
|
21
|
+
else
|
|
22
|
+
error_with_message "Unknown subcommand: #{ARGV[0]}\n#{usage}"
|
|
23
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require File.expand_path("../lib/da-suspenders/version", __FILE__)
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = 'da-suspenders'
|
|
5
|
+
s.version = DaSuspenders::VERSION
|
|
6
|
+
s.platform = Gem::Platform::RUBY
|
|
7
|
+
s.authors = ["thoughtbot", "Stefan Daschek"]
|
|
8
|
+
s.email = 'stefan@die-antwort.eu'
|
|
9
|
+
s.homepage = 'http://github.com/die-antwort/da-suspenders'
|
|
10
|
+
s.summary = "Generate a Rails app using DIE ANTWORT's best practices."
|
|
11
|
+
s.description = "DIE ANTWORT's fork of thoughtbot's original Suspenders. Suspenders is an upgradeable base Rails project."
|
|
12
|
+
|
|
13
|
+
s.required_rubygems_version = ">= 1.3.6"
|
|
14
|
+
|
|
15
|
+
s.add_dependency('rails', '>= 3.0.4')
|
|
16
|
+
s.add_dependency('bundler', '>= 1.0.10')
|
|
17
|
+
s.add_dependency('trout', '>= 0.3.0')
|
|
18
|
+
|
|
19
|
+
s.files = `git ls-files`.split("\n")
|
|
20
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
|
21
|
+
s.test_files = s.files.select{ |path| path =~ /^features/ }
|
|
22
|
+
s.require_path = 'lib'
|
|
23
|
+
|
|
24
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
25
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
|
26
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Feature: Running cucumber in the generated project
|
|
2
|
+
|
|
3
|
+
Scenario: jQuery and Modernizr work in the generated project
|
|
4
|
+
Given I drop and create the required databases
|
|
5
|
+
And I generate "scaffold user username:string"
|
|
6
|
+
And I run the rake task "db:migrate"
|
|
7
|
+
And I create a file named "features/js_test.feature" with:
|
|
8
|
+
"""
|
|
9
|
+
Feature: Javascript
|
|
10
|
+
@javascript
|
|
11
|
+
Scenario: Test jQuery and Modernizr
|
|
12
|
+
When I go to "the users page"
|
|
13
|
+
Then the javascript expression "$('html').hasClass('js')" should return "true"
|
|
14
|
+
And the javascript expression "$('html').hasClass('no-js')" should return "false"
|
|
15
|
+
"""
|
|
16
|
+
When I run the rake task "cucumber"
|
|
17
|
+
Then I see a successful response in the shell
|
|
18
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
When 'I run the rake task "$task_name"' do |task_name|
|
|
2
|
+
Dir.chdir('test_project') do
|
|
3
|
+
system("rake #{task_name}")
|
|
4
|
+
end
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
When 'I generate "$generator_with_args"' do |generator_with_args|
|
|
8
|
+
Dir.chdir('test_project') do
|
|
9
|
+
system("rails generate #{generator_with_args}")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When 'I create a file named "$filename" with:' do |filename, content|
|
|
14
|
+
File.open("test_project/#{filename}", "w") do |file|
|
|
15
|
+
file.write(content)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Then 'I see a successful response in the shell' do
|
|
20
|
+
$?.to_i.should == 0
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
When 'I drop and create the required databases' do
|
|
24
|
+
Dir.chdir('test_project') do
|
|
25
|
+
system("rake db:drop RAILS_ENV=test")
|
|
26
|
+
system("rake db:drop")
|
|
27
|
+
system("rake db:create RAILS_ENV=test")
|
|
28
|
+
system("rake db:create")
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'spec/expectations'
|
data/lib/create.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Methods needed to create a project.
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + "/errors")
|
|
5
|
+
|
|
6
|
+
module DaSuspenders
|
|
7
|
+
class Create
|
|
8
|
+
attr_accessor :project_path
|
|
9
|
+
|
|
10
|
+
def self.run!(project_path)
|
|
11
|
+
creator = self.new(project_path)
|
|
12
|
+
creator.create_project!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize(project_path)
|
|
16
|
+
self.project_path = project_path
|
|
17
|
+
validate_project_path
|
|
18
|
+
validate_project_name
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_project!
|
|
22
|
+
exec(<<-COMMAND)
|
|
23
|
+
rails new #{project_path} \
|
|
24
|
+
--template="#{template}" \
|
|
25
|
+
--database=mysql \
|
|
26
|
+
--skip-test-unit \
|
|
27
|
+
--skip-prototype
|
|
28
|
+
COMMAND
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def validate_project_name
|
|
34
|
+
project_name = File.basename(project_path)
|
|
35
|
+
unless project_name =~ /^[a-z0-9_]+$/
|
|
36
|
+
raise InvalidInput.new("Project name must only contain [a-z0-9_]")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def validate_project_path
|
|
41
|
+
base_directory = Dir.pwd
|
|
42
|
+
full_path = File.join(base_directory, project_path)
|
|
43
|
+
|
|
44
|
+
# This is for the common case for the user's convenience; the race
|
|
45
|
+
# condition can still occur.
|
|
46
|
+
if File.exists?(full_path)
|
|
47
|
+
raise InvalidInput.new("Project directory (#{project_path}) already exists")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def template
|
|
52
|
+
File.expand_path(File.dirname(__FILE__) + "/../template/da-suspenders.rb")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
data/lib/errors.rb
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
require "fileutils"
|
|
2
|
+
require "pathname"
|
|
3
|
+
require "trout"
|
|
4
|
+
|
|
5
|
+
template_root = File.expand_path(File.join(File.dirname(__FILE__)))
|
|
6
|
+
source_paths << File.join(template_root, "files")
|
|
7
|
+
|
|
8
|
+
# Helpers
|
|
9
|
+
|
|
10
|
+
def action_mailer_host(rails_env, host)
|
|
11
|
+
inject_into_file(
|
|
12
|
+
"config/environments/#{rails_env}.rb",
|
|
13
|
+
"\n\n config.action_mailer.default_url_options = { :host => '#{host}' }",
|
|
14
|
+
:before => "\nend"
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def origin
|
|
19
|
+
"git://github.com/die-antwort/da-suspenders.git"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def trout(destination_path)
|
|
23
|
+
parent = Pathname.new(destination_path).parent
|
|
24
|
+
FileUtils.mkdir_p(parent) unless File.exists?(parent)
|
|
25
|
+
run "trout checkout --source-root=template/trout #{destination_path} #{origin}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Actions
|
|
29
|
+
|
|
30
|
+
def create_gemfile_and_install_gems
|
|
31
|
+
say "Creating Gemfile and installing gems (this may take a while)", :yellow
|
|
32
|
+
trout "Gemfile"
|
|
33
|
+
run "bundle install"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def add_staging_environment
|
|
37
|
+
say "Adding staging environment", :yellow
|
|
38
|
+
run "cp config/environments/production.rb config/environments/staging.rb"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def setup_action_mailer
|
|
42
|
+
say "Setting up action mailer config", :yellow
|
|
43
|
+
action_mailer_host "development", "localhost:3000"
|
|
44
|
+
action_mailer_host "test", "example.com"
|
|
45
|
+
action_mailer_host "staging", "#{app_name}.dev.die-antwort.eu"
|
|
46
|
+
action_mailer_host "production", "FIXME"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def setup_database
|
|
50
|
+
say "Setting up database config", :yellow
|
|
51
|
+
template "mysql_database.yml.erb", "config/database.yml", :force => true
|
|
52
|
+
rake "db:create"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def setup_german_locale
|
|
56
|
+
say "Setting up german locale", :yellow
|
|
57
|
+
trout "config/locales/de.yml"
|
|
58
|
+
gsub_file 'config/application.rb', '# config.i18n.default_locale = :de', 'config.i18n.default_locale = :de'
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def setup_viennese_timezone
|
|
62
|
+
say "Setting up viennese timezone", :yellow
|
|
63
|
+
gsub_file 'config/application.rb', "# config.time_zone = 'Central Time (US & Canada)'", "config.time_zone = 'Vienna'"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def update_generators_config
|
|
67
|
+
say "Updating config for generators", :yellow
|
|
68
|
+
generators_config = <<-RUBY
|
|
69
|
+
config.generators do |generate|
|
|
70
|
+
generate.stylesheets false
|
|
71
|
+
generate.test_framework :rspec
|
|
72
|
+
end
|
|
73
|
+
RUBY
|
|
74
|
+
inject_into_class "config/application.rb", "Application", generators_config
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def create_application_layout_and_views
|
|
78
|
+
say "Creating application layout and shared views", :yellow
|
|
79
|
+
trout "app/views/layouts/application.html.erb"
|
|
80
|
+
trout "app/views/shared/_flashes.html.erb"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def install_misc_support_files
|
|
84
|
+
say "Installing miscellaneous support files", :yellow
|
|
85
|
+
trout "config/initializers/errors.rb"
|
|
86
|
+
trout "app/helpers/body_class_helper.rb"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def install_app_config
|
|
90
|
+
say "Installing app_config", :yellow
|
|
91
|
+
generate "app_config:install staging"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def install_compass
|
|
95
|
+
say "Installing compass", :yellow
|
|
96
|
+
run "compass init rails . --sass-dir app/stylesheets --css-dir public/stylesheets -q"
|
|
97
|
+
inside 'app/stylesheets' do
|
|
98
|
+
remove_file 'ie.scss'
|
|
99
|
+
remove_file 'print.scss'
|
|
100
|
+
remove_file 'screen.scss'
|
|
101
|
+
empty_directory 'content'
|
|
102
|
+
empty_directory 'vendor'
|
|
103
|
+
end
|
|
104
|
+
trout "app/stylesheets/application.scss"
|
|
105
|
+
trout "app/stylesheets/ie.scss"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def install_formtastic
|
|
109
|
+
say "Installing formtastic", :yellow
|
|
110
|
+
generate "formtastic:install"
|
|
111
|
+
remove_file "public/stylesheets/formtastic.css"
|
|
112
|
+
remove_file "public/stylesheets/formtastic-changes.css"
|
|
113
|
+
trout "lib/templates/erb/scaffold/_form.html.erb"
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def install_sprockets_and_jquery
|
|
117
|
+
say "Installing sprockets, jQuery, and some other javascripts", :yellow
|
|
118
|
+
plugin 'sprockets-rails', :git => 'git://github.com/gmoeck/sprockets-rails.git'
|
|
119
|
+
plugin 'jrails', :git => 'git://github.com/die-antwort/jrails.git'
|
|
120
|
+
route 'SprocketsApplication.routes(self)'
|
|
121
|
+
remove_dir 'public/javascripts'
|
|
122
|
+
remove_file "app/javascripts/application.js"
|
|
123
|
+
trout "app/javascripts/application.js"
|
|
124
|
+
trout "vendor/sprockets/modernizr/src/modernizr.js"
|
|
125
|
+
trout "vendor/sprockets/jquery-ujs/src/rails.js"
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def install_rspec_and_cucumber
|
|
129
|
+
say "Installing rspec and cucumber", :yellow
|
|
130
|
+
generate "rspec:install"
|
|
131
|
+
generate "cucumber:install", "--rspec --capybara"
|
|
132
|
+
inject_into_file "features/support/env.rb",
|
|
133
|
+
%{Capybara.save_and_open_page_path = "tmp"\n} +
|
|
134
|
+
%{Capybara.javascript_driver = :akephalos\n},
|
|
135
|
+
:before => %{Capybara.default_selector = :css}
|
|
136
|
+
# replace_in_file "features/support/env.rb",
|
|
137
|
+
# %r{require .*capybara_javascript_emulation.*},
|
|
138
|
+
# ''
|
|
139
|
+
copy_file "factory_girl_steps.rb", "features/step_definitions/factory_girl_steps.rb"
|
|
140
|
+
trout "features/step_definitions/js_steps.rb"
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def cleanup
|
|
144
|
+
say "Cleaning up", :yellow
|
|
145
|
+
remove_file 'README'
|
|
146
|
+
remove_file 'public/index.html'
|
|
147
|
+
remove_file 'public/images/rails.png'
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
create_gemfile_and_install_gems
|
|
151
|
+
add_staging_environment
|
|
152
|
+
setup_database
|
|
153
|
+
setup_german_locale
|
|
154
|
+
setup_viennese_timezone
|
|
155
|
+
update_generators_config
|
|
156
|
+
create_application_layout_and_views
|
|
157
|
+
install_misc_support_files
|
|
158
|
+
install_app_config
|
|
159
|
+
install_compass
|
|
160
|
+
install_formtastic
|
|
161
|
+
install_sprockets_and_jquery
|
|
162
|
+
install_rspec_and_cucumber
|
|
163
|
+
cleanup
|
|
164
|
+
|
|
165
|
+
say "Rails app #{app_name} has been created successully!", :blue
|
|
166
|
+
say "Remember to run 'rails generate hoptoad' with your API key.", :blue
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'factory_girl/step_definitions'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
development:
|
|
2
|
+
adapter: mysql
|
|
3
|
+
encoding: utf8
|
|
4
|
+
reconnect: false
|
|
5
|
+
database: <%= app_name %>_dev
|
|
6
|
+
pool: 5
|
|
7
|
+
username: root
|
|
8
|
+
password: root
|
|
9
|
+
host: localhost
|
|
10
|
+
|
|
11
|
+
test:
|
|
12
|
+
adapter: mysql
|
|
13
|
+
encoding: utf8
|
|
14
|
+
reconnect: false
|
|
15
|
+
database: <%= app_name %>_test
|
|
16
|
+
pool: 5
|
|
17
|
+
username: root
|
|
18
|
+
password: root
|
|
19
|
+
host: localhost
|
|
20
|
+
|
|
21
|
+
staging:
|
|
22
|
+
adapter: mysql
|
|
23
|
+
encoding: utf8
|
|
24
|
+
reconnect: false
|
|
25
|
+
database: <%= app_name %>_staging
|
|
26
|
+
pool: 5
|
|
27
|
+
username: <%= app_name %>_s
|
|
28
|
+
password:
|
|
29
|
+
host: localhost
|
|
30
|
+
|
|
31
|
+
production:
|
|
32
|
+
adapter: mysql
|
|
33
|
+
encoding: utf8
|
|
34
|
+
reconnect: false
|
|
35
|
+
database: <%= app_name %>
|
|
36
|
+
pool: 5
|
|
37
|
+
username: <%= app_name %>
|
|
38
|
+
password:
|
|
39
|
+
host: localhost
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
source :rubygems
|
|
2
|
+
|
|
3
|
+
gem "rails", "3.0.4"
|
|
4
|
+
gem "mysql"
|
|
5
|
+
|
|
6
|
+
gem "app_config", :git => "git://github.com/die-antwort/app_config.git"
|
|
7
|
+
gem "compass", "~> 0.10.6"
|
|
8
|
+
gem "formtastic", ">= 1.2.1"
|
|
9
|
+
gem "hoptoad_notifier"
|
|
10
|
+
gem "sprockets", "~> 1.0.2"
|
|
11
|
+
gem "will_paginate"
|
|
12
|
+
|
|
13
|
+
# Uncomment if you want to use any of those
|
|
14
|
+
#gem "paperclip"
|
|
15
|
+
|
|
16
|
+
# RSpec needs to be in :development group to expose generators
|
|
17
|
+
# and rake tasks without having to type RAILS_ENV=test.
|
|
18
|
+
group :development, :test do
|
|
19
|
+
gem "rspec-rails", "~> 2.4.0"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
group :test do
|
|
23
|
+
gem "akephalos", :git => "git://github.com/die-antwort/akephalos.git"
|
|
24
|
+
gem "cucumber-rails"
|
|
25
|
+
gem "factory_girl_rails"
|
|
26
|
+
gem "capybara"
|
|
27
|
+
gem "database_cleaner"
|
|
28
|
+
gem "launchy"
|
|
29
|
+
gem "timecop"
|
|
30
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//= require <modernizr>
|
|
2
|
+
//= require <jquery.min>
|
|
3
|
+
//= require <rails>
|
|
4
|
+
|
|
5
|
+
// activate if you want to use jrails:
|
|
6
|
+
// = require <jquery-ui.min>
|
|
7
|
+
// = require <jrails>
|
|
8
|
+
|
|
9
|
+
// activate if you want to localize jQuery UI Datepicker:
|
|
10
|
+
// = require <jquery-ui-i18n.min>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
$ie: false !default;
|
|
2
|
+
|
|
3
|
+
@import 'compass/reset';
|
|
4
|
+
@import 'compass/utilities';
|
|
5
|
+
@import 'compass/css3';
|
|
6
|
+
|
|
7
|
+
// Use following syntax for IE-specific (<= 7) rules:
|
|
8
|
+
// .foobar {
|
|
9
|
+
// float: left;
|
|
10
|
+
// margin-left: 20px;
|
|
11
|
+
// @if $ie {
|
|
12
|
+
// margin-left: 10px;
|
|
13
|
+
// }
|
|
14
|
+
// }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="de" class="no-js">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Testapp</title>
|
|
5
|
+
<link href="/stylesheets/application.css" type="text/css" rel="stylesheet">
|
|
6
|
+
<!--[if lte IE 7]><link href="/public/stylesheets/ie7.css" type="text/css" rel="stylesheet"><![endif]-->
|
|
7
|
+
<%= sprockets_include_tag %>
|
|
8
|
+
<%= javascript_tag "$.ajaxSetup({ async: false });" if Rails.env.test?%>
|
|
9
|
+
<%= csrf_meta_tag %>
|
|
10
|
+
</head>
|
|
11
|
+
<body class="<%= body_class %>">
|
|
12
|
+
<%= render :partial => "shared/flashes" %>
|
|
13
|
+
<%= yield %>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
16
|
+
<!-- Created with care by DIE ANTWORT · Büro für Informationstechnik GmbH -->
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'net/smtp'
|
|
2
|
+
# Example:
|
|
3
|
+
# begin
|
|
4
|
+
# some http call
|
|
5
|
+
# rescue *HTTP_ERRORS => error
|
|
6
|
+
# notify_hoptoad error
|
|
7
|
+
# end
|
|
8
|
+
|
|
9
|
+
HTTP_ERRORS = [Timeout::Error,
|
|
10
|
+
Errno::EINVAL,
|
|
11
|
+
Errno::ECONNRESET,
|
|
12
|
+
EOFError,
|
|
13
|
+
Net::HTTPBadResponse,
|
|
14
|
+
Net::HTTPHeaderSyntaxError,
|
|
15
|
+
Net::ProtocolError]
|
|
16
|
+
|
|
17
|
+
SMTP_SERVER_ERRORS = [TimeoutError,
|
|
18
|
+
IOError,
|
|
19
|
+
Net::SMTPUnknownError,
|
|
20
|
+
Net::SMTPServerBusy,
|
|
21
|
+
Net::SMTPAuthenticationError]
|
|
22
|
+
|
|
23
|
+
SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
|
|
24
|
+
Net::SMTPSyntaxError]
|
|
25
|
+
|
|
26
|
+
SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Based on original translation by Clemens Kofler (clemens@railway.at)
|
|
2
|
+
de:
|
|
3
|
+
date:
|
|
4
|
+
formats:
|
|
5
|
+
default: "%d.%m.%Y"
|
|
6
|
+
short: "%e. %b"
|
|
7
|
+
long: "%e. %B %Y"
|
|
8
|
+
only_day: "%e"
|
|
9
|
+
|
|
10
|
+
day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
|
|
11
|
+
abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
|
|
12
|
+
month_names: [~, Jänner, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
|
|
13
|
+
abbr_month_names: [~, Jän, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
|
|
14
|
+
order: [ :day, :month, :year ]
|
|
15
|
+
|
|
16
|
+
time:
|
|
17
|
+
formats:
|
|
18
|
+
default: "%A, %d. %B %Y, %H:%M Uhr"
|
|
19
|
+
short: "%d. %B, %H:%M Uhr"
|
|
20
|
+
long: "%A, %d. %B %Y, %H:%M Uhr"
|
|
21
|
+
time: "%H:%M"
|
|
22
|
+
|
|
23
|
+
am: "vormittags"
|
|
24
|
+
pm: "nachmittags"
|
|
25
|
+
|
|
26
|
+
datetime:
|
|
27
|
+
distance_in_words:
|
|
28
|
+
half_a_minute: 'eine halbe Minute'
|
|
29
|
+
less_than_x_seconds:
|
|
30
|
+
one: 'weniger als eine Sekunde'
|
|
31
|
+
other: 'weniger als %{count} Sekunden'
|
|
32
|
+
x_seconds:
|
|
33
|
+
one: 'eine Sekunde'
|
|
34
|
+
other: '%{count} Sekunden'
|
|
35
|
+
less_than_x_minutes:
|
|
36
|
+
one: 'weniger als eine Minute'
|
|
37
|
+
other: 'weniger als %{count} Minuten'
|
|
38
|
+
x_minutes:
|
|
39
|
+
one: 'eine Minute'
|
|
40
|
+
other: '%{count} Minuten'
|
|
41
|
+
about_x_hours:
|
|
42
|
+
one: 'etwa eine Stunde'
|
|
43
|
+
other: 'etwa %{count} Stunden'
|
|
44
|
+
x_days:
|
|
45
|
+
one: 'ein Tag'
|
|
46
|
+
other: '%{count} Tage'
|
|
47
|
+
about_x_months:
|
|
48
|
+
one: 'etwa ein Monat'
|
|
49
|
+
other: 'etwa %{count} Monate'
|
|
50
|
+
x_months:
|
|
51
|
+
one: 'ein Monat'
|
|
52
|
+
other: '%{count} Monate'
|
|
53
|
+
almost_x_years:
|
|
54
|
+
one: 'fast ein Jahr'
|
|
55
|
+
other: 'fast %{count} Jahre'
|
|
56
|
+
about_x_years:
|
|
57
|
+
one: 'etwa ein Jahr'
|
|
58
|
+
other: 'etwa %{count} Jahre'
|
|
59
|
+
over_x_years:
|
|
60
|
+
one: 'mehr als ein Jahr'
|
|
61
|
+
other: 'mehr als %{count} Jahre'
|
|
62
|
+
prompts:
|
|
63
|
+
second: "Sekunden"
|
|
64
|
+
minute: "Minuten"
|
|
65
|
+
hour: "Stunden"
|
|
66
|
+
day: "Tag"
|
|
67
|
+
month: "Monat"
|
|
68
|
+
year: "Jahr"
|
|
69
|
+
|
|
70
|
+
number:
|
|
71
|
+
format:
|
|
72
|
+
precision: 2
|
|
73
|
+
separator: ','
|
|
74
|
+
delimiter: '.'
|
|
75
|
+
currency:
|
|
76
|
+
format:
|
|
77
|
+
unit: '€'
|
|
78
|
+
format: '%n%u'
|
|
79
|
+
separator:
|
|
80
|
+
delimiter:
|
|
81
|
+
precision:
|
|
82
|
+
percentage:
|
|
83
|
+
format:
|
|
84
|
+
delimiter: ""
|
|
85
|
+
precision:
|
|
86
|
+
format:
|
|
87
|
+
delimiter: ""
|
|
88
|
+
human:
|
|
89
|
+
format:
|
|
90
|
+
delimiter: ""
|
|
91
|
+
precision: 1
|
|
92
|
+
storage_units:
|
|
93
|
+
# Storage units output formatting.
|
|
94
|
+
# %u is the storage unit, %n is the number (default: 2 MB)
|
|
95
|
+
format: "%n %u"
|
|
96
|
+
units:
|
|
97
|
+
byte:
|
|
98
|
+
one: "Byte"
|
|
99
|
+
other: "Bytes"
|
|
100
|
+
kb: "KB"
|
|
101
|
+
mb: "MB"
|
|
102
|
+
gb: "GB"
|
|
103
|
+
tb: "TB"
|
|
104
|
+
|
|
105
|
+
support:
|
|
106
|
+
array:
|
|
107
|
+
words_connector: ", "
|
|
108
|
+
two_words_connector: " und "
|
|
109
|
+
last_word_connector: " und "
|
|
110
|
+
select:
|
|
111
|
+
prompt: "Bitte wählen:"
|
|
112
|
+
|
|
113
|
+
activemodel:
|
|
114
|
+
errors:
|
|
115
|
+
template:
|
|
116
|
+
header:
|
|
117
|
+
one: "Konnte %{model} nicht speichern: ein Fehler."
|
|
118
|
+
other: "Konnte %{model} nicht speichern: %{count} Fehler."
|
|
119
|
+
body: "Bitte überprüfen Sie die folgenden Felder:"
|
|
120
|
+
|
|
121
|
+
activerecord:
|
|
122
|
+
errors:
|
|
123
|
+
template:
|
|
124
|
+
header:
|
|
125
|
+
one: "Konnte %{model} nicht speichern: ein Fehler."
|
|
126
|
+
other: "Konnte %{model} nicht speichern: %{count} Fehler."
|
|
127
|
+
body: "Bitte überprüfen Sie die folgenden Felder:"
|
|
128
|
+
|
|
129
|
+
messages:
|
|
130
|
+
inclusion: "ist kein gültiger Wert"
|
|
131
|
+
exclusion: "ist nicht verfügbar"
|
|
132
|
+
invalid: "ist nicht gültig"
|
|
133
|
+
confirmation: "stimmt nicht mit der Bestätigung überein"
|
|
134
|
+
accepted: "muss akzeptiert werden"
|
|
135
|
+
empty: "muss ausgefüllt werden"
|
|
136
|
+
blank: "muss ausgefüllt werden"
|
|
137
|
+
too_long: "ist zu lang (nicht mehr als %{count} Zeichen)"
|
|
138
|
+
too_short: "ist zu kurz (nicht weniger als %{count} Zeichen)"
|
|
139
|
+
wrong_length: "hat die falsche Länge (muss genau %{count} Zeichen haben)"
|
|
140
|
+
taken: "ist bereits vergeben"
|
|
141
|
+
not_a_number: "ist keine Zahl"
|
|
142
|
+
greater_than: "muss größer als %{count} sein"
|
|
143
|
+
greater_than_or_equal_to: "muss größer oder gleich %{count} sein"
|
|
144
|
+
equal_to: "muss genau %{count} sein"
|
|
145
|
+
less_than: "muss kleiner als %{count} sein"
|
|
146
|
+
less_than_or_equal_to: "muss kleiner oder gleich %{count} sein"
|
|
147
|
+
odd: "muss ungerade sein"
|
|
148
|
+
even: "muss gerade sein"
|
|
149
|
+
record_invalid: "Gültigkeitsprüfung ist fehlgeschlagen: %{errors}"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%%= semantic_form_for(@<%= singular_table_name %>) do |f| %>
|
|
2
|
+
<%%= f.semantic_errors %>
|
|
3
|
+
|
|
4
|
+
<%% f.inputs do %>
|
|
5
|
+
<% for attribute in attributes -%>
|
|
6
|
+
<%%= f.input :<%= attribute.name %> %>
|
|
7
|
+
<% end -%>
|
|
8
|
+
<%% end %>
|
|
9
|
+
|
|
10
|
+
<%% f.buttons do %>
|
|
11
|
+
<%%= f.commit_button %>
|
|
12
|
+
<%% end %>
|
|
13
|
+
<%% end %>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unobtrusive scripting adapter for jQuery
|
|
3
|
+
*
|
|
4
|
+
* Requires jQuery 1.4.3 or later.
|
|
5
|
+
* https://github.com/rails/jquery-ujs
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
(function($) {
|
|
9
|
+
// Make sure that every Ajax request sends the CSRF token
|
|
10
|
+
function CSRFProtection(fn) {
|
|
11
|
+
var token = $('meta[name="csrf-token"]').attr('content');
|
|
12
|
+
if (token) fn(function(xhr) { xhr.setRequestHeader('X-CSRF-Token', token) });
|
|
13
|
+
}
|
|
14
|
+
if ($().jquery == '1.5') { // gruesome hack
|
|
15
|
+
var factory = $.ajaxSettings.xhr;
|
|
16
|
+
$.ajaxSettings.xhr = function() {
|
|
17
|
+
var xhr = factory();
|
|
18
|
+
CSRFProtection(function(setHeader) {
|
|
19
|
+
var open = xhr.open;
|
|
20
|
+
xhr.open = function() { open.apply(this, arguments); setHeader(this) };
|
|
21
|
+
});
|
|
22
|
+
return xhr;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
else $(document).ajaxSend(function(e, xhr) {
|
|
26
|
+
CSRFProtection(function(setHeader) { setHeader(xhr) });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Triggers an event on an element and returns the event result
|
|
30
|
+
function fire(obj, name, data) {
|
|
31
|
+
var event = new $.Event(name);
|
|
32
|
+
obj.trigger(event, data);
|
|
33
|
+
return event.result !== false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Submits "remote" forms and links with ajax
|
|
37
|
+
function handleRemote(element) {
|
|
38
|
+
var method, url, data,
|
|
39
|
+
dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
|
40
|
+
|
|
41
|
+
if (element.is('form')) {
|
|
42
|
+
method = element.attr('method');
|
|
43
|
+
url = element.attr('action');
|
|
44
|
+
data = element.serializeArray();
|
|
45
|
+
// memoized value from clicked submit button
|
|
46
|
+
var button = element.data('ujs:submit-button');
|
|
47
|
+
if (button) {
|
|
48
|
+
data.push(button);
|
|
49
|
+
element.data('ujs:submit-button', null);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
method = element.attr('data-method');
|
|
53
|
+
url = element.attr('href');
|
|
54
|
+
data = null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
$.ajax({
|
|
58
|
+
url: url, type: method || 'GET', data: data, dataType: dataType,
|
|
59
|
+
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
|
60
|
+
beforeSend: function(xhr, settings) {
|
|
61
|
+
if (settings.dataType === undefined) {
|
|
62
|
+
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
|
63
|
+
}
|
|
64
|
+
return fire(element, 'ajax:beforeSend', [xhr, settings]);
|
|
65
|
+
},
|
|
66
|
+
success: function(data, status, xhr) {
|
|
67
|
+
element.trigger('ajax:success', [data, status, xhr]);
|
|
68
|
+
},
|
|
69
|
+
complete: function(xhr, status) {
|
|
70
|
+
element.trigger('ajax:complete', [xhr, status]);
|
|
71
|
+
},
|
|
72
|
+
error: function(xhr, status, error) {
|
|
73
|
+
element.trigger('ajax:error', [xhr, status, error]);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Handles "data-method" on links such as:
|
|
79
|
+
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
|
80
|
+
function handleMethod(link) {
|
|
81
|
+
var href = link.attr('href'),
|
|
82
|
+
method = link.attr('data-method'),
|
|
83
|
+
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
|
84
|
+
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
|
85
|
+
form = $('<form method="post" action="' + href + '"></form>'),
|
|
86
|
+
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
|
87
|
+
|
|
88
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
|
89
|
+
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
form.hide().append(metadata_input).appendTo('body');
|
|
93
|
+
form.submit();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function disableFormElements(form) {
|
|
97
|
+
form.find('input[data-disable-with]').each(function() {
|
|
98
|
+
var input = $(this);
|
|
99
|
+
input.data('ujs:enable-with', input.val())
|
|
100
|
+
.val(input.attr('data-disable-with'))
|
|
101
|
+
.attr('disabled', 'disabled');
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function enableFormElements(form) {
|
|
106
|
+
form.find('input[data-disable-with]').each(function() {
|
|
107
|
+
var input = $(this);
|
|
108
|
+
input.val(input.data('ujs:enable-with')).removeAttr('disabled');
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function allowAction(element) {
|
|
113
|
+
var message = element.attr('data-confirm');
|
|
114
|
+
return !message || (fire(element, 'confirm') && confirm(message));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function requiredValuesMissing(form) {
|
|
118
|
+
var missing = false;
|
|
119
|
+
form.find('input[name][required]').each(function() {
|
|
120
|
+
if (!$(this).val()) missing = true;
|
|
121
|
+
});
|
|
122
|
+
return missing;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
|
|
126
|
+
var link = $(this);
|
|
127
|
+
if (!allowAction(link)) return false;
|
|
128
|
+
|
|
129
|
+
if (link.attr('data-remote') != undefined) {
|
|
130
|
+
handleRemote(link);
|
|
131
|
+
return false;
|
|
132
|
+
} else if (link.attr('data-method')) {
|
|
133
|
+
handleMethod(link);
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
$('form').live('submit.rails', function(e) {
|
|
139
|
+
var form = $(this), remote = form.attr('data-remote') != undefined;
|
|
140
|
+
if (!allowAction(form)) return false;
|
|
141
|
+
|
|
142
|
+
// skip other logic when required values are missing
|
|
143
|
+
if (requiredValuesMissing(form)) return !remote;
|
|
144
|
+
|
|
145
|
+
if (remote) {
|
|
146
|
+
handleRemote(form);
|
|
147
|
+
return false;
|
|
148
|
+
} else {
|
|
149
|
+
// slight timeout so that the submit button gets properly serialized
|
|
150
|
+
setTimeout(function(){ disableFormElements(form) }, 13);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
$('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
|
|
155
|
+
var button = $(this);
|
|
156
|
+
if (!allowAction(button)) return false;
|
|
157
|
+
// register the pressed submit button
|
|
158
|
+
var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
|
|
159
|
+
button.closest('form').data('ujs:submit-button', data);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
$('form').live('ajax:beforeSend.rails', function(event) {
|
|
163
|
+
if (this == event.target) disableFormElements($(this));
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
$('form').live('ajax:complete.rails', function(event) {
|
|
167
|
+
if (this == event.target) enableFormElements($(this));
|
|
168
|
+
});
|
|
169
|
+
})( jQuery );
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Modernizr v1.6
|
|
3
|
+
* http://www.modernizr.com
|
|
4
|
+
*
|
|
5
|
+
* Developed by:
|
|
6
|
+
* - Faruk Ates http://farukat.es/
|
|
7
|
+
* - Paul Irish http://paulirish.com/
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2009-2010
|
|
10
|
+
* Dual-licensed under the BSD or MIT licenses.
|
|
11
|
+
* http://www.modernizr.com/license/
|
|
12
|
+
*/
|
|
13
|
+
window.Modernizr=function(i,e,u){function s(a,b){return(""+a).indexOf(b)!==-1}function D(a,b){for(var c in a)if(j[a[c]]!==u&&(!b||b(a[c],E)))return true}function n(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1);c=(a+" "+F.join(c+" ")+c).split(" ");return!!D(c,b)}function S(){f.input=function(a){for(var b=0,c=a.length;b<c;b++)L[a[b]]=!!(a[b]in h);return L}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" "));f.inputtypes=function(a){for(var b=0,c,k=a.length;b<
|
|
14
|
+
k;b++){h.setAttribute("type",a[b]);if(c=h.type!=="text"){h.value=M;if(/^range$/.test(h.type)&&h.style.WebkitAppearance!==u){l.appendChild(h);c=e.defaultView;c=c.getComputedStyle&&c.getComputedStyle(h,null).WebkitAppearance!=="textfield"&&h.offsetHeight!==0;l.removeChild(h)}else/^(search|tel)$/.test(h.type)||(c=/^(url|email)$/.test(h.type)?h.checkValidity&&h.checkValidity()===false:h.value!=M)}N[a[b]]=!!c}return N}("search tel url email datetime date month week time datetime-local number range color".split(" "))}
|
|
15
|
+
var f={},l=e.documentElement,E=e.createElement("modernizr"),j=E.style,h=e.createElement("input"),M=":)",O=Object.prototype.toString,q=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),F="Webkit Moz O ms Khtml".split(" "),v={svg:"http://www.w3.org/2000/svg"},d={},N={},L={},P=[],w,Q=function(a){var b=document.createElement("style"),c=e.createElement("div");b.textContent=a+"{#modernizr{height:3px}}";(e.head||e.getElementsByTagName("head")[0]).appendChild(b);c.id="modernizr";l.appendChild(c);a=c.offsetHeight===
|
|
16
|
+
3;b.parentNode.removeChild(b);c.parentNode.removeChild(c);return!!a},o=function(){var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return function(b,c){c=c||document.createElement(a[b]||"div");b="on"+b;var k=b in c;if(!k){c.setAttribute||(c=document.createElement("div"));if(c.setAttribute&&c.removeAttribute){c.setAttribute(b,"");k=typeof c[b]=="function";if(typeof c[b]!="undefined")c[b]=u;c.removeAttribute(b)}}return k}}(),G={}.hasOwnProperty,R;R=
|
|
17
|
+
typeof G!=="undefined"&&typeof G.call!=="undefined"?function(a,b){return G.call(a,b)}:function(a,b){return b in a&&typeof a.constructor.prototype[b]==="undefined"};d.flexbox=function(){var a=e.createElement("div"),b=e.createElement("div");(function(k,g,r,x){g+=":";k.style.cssText=(g+q.join(r+";"+g)).slice(0,-g.length)+(x||"")})(a,"display","box","width:42px;padding:0;");b.style.cssText=q.join("box-flex:1;")+"width:10px;";a.appendChild(b);l.appendChild(a);var c=b.offsetWidth===42;a.removeChild(b);
|
|
18
|
+
l.removeChild(a);return c};d.canvas=function(){var a=e.createElement("canvas");return!!(a.getContext&&a.getContext("2d"))};d.canvastext=function(){return!!(f.canvas&&typeof e.createElement("canvas").getContext("2d").fillText=="function")};d.webgl=function(){var a=e.createElement("canvas");try{if(a.getContext("webgl"))return true}catch(b){}try{if(a.getContext("experimental-webgl"))return true}catch(c){}return false};d.touch=function(){return"ontouchstart"in i||Q("@media ("+q.join("touch-enabled),(")+
|
|
19
|
+
"modernizr)")};d.geolocation=function(){return!!navigator.geolocation};d.postmessage=function(){return!!i.postMessage};d.websqldatabase=function(){return!!i.openDatabase};d.indexedDB=function(){for(var a=-1,b=F.length;++a<b;){var c=F[a].toLowerCase();if(i[c+"_indexedDB"]||i[c+"IndexedDB"])return true}return false};d.hashchange=function(){return o("hashchange",i)&&(document.documentMode===u||document.documentMode>7)};d.history=function(){return!!(i.history&&history.pushState)};d.draganddrop=function(){return o("drag")&&
|
|
20
|
+
o("dragstart")&&o("dragenter")&&o("dragover")&&o("dragleave")&&o("dragend")&&o("drop")};d.websockets=function(){return"WebSocket"in i};d.rgba=function(){j.cssText="background-color:rgba(150,255,150,.5)";return s(j.backgroundColor,"rgba")};d.hsla=function(){j.cssText="background-color:hsla(120,40%,100%,.5)";return s(j.backgroundColor,"rgba")||s(j.backgroundColor,"hsla")};d.multiplebgs=function(){j.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(j.background)};d.backgroundsize=
|
|
21
|
+
function(){return n("backgroundSize")};d.borderimage=function(){return n("borderImage")};d.borderradius=function(){return n("borderRadius","",function(a){return s(a,"orderRadius")})};d.boxshadow=function(){return n("boxShadow")};d.textshadow=function(){return e.createElement("div").style.textShadow===""};d.opacity=function(){var a=q.join("opacity:.5;")+"";j.cssText=a;return s(j.opacity,"0.5")};d.cssanimations=function(){return n("animationName")};d.csscolumns=function(){return n("columnCount")};d.cssgradients=
|
|
22
|
+
function(){var a=("background-image:"+q.join("gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:")+q.join("linear-gradient(left top,#9f9, white);background-image:")).slice(0,-17);j.cssText=a;return s(j.backgroundImage,"gradient")};d.cssreflections=function(){return n("boxReflect")};d.csstransforms=function(){return!!D(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])};d.csstransforms3d=function(){var a=!!D(["perspectiveProperty","WebkitPerspective",
|
|
23
|
+
"MozPerspective","OPerspective","msPerspective"]);if(a)a=Q("@media ("+q.join("transform-3d),(")+"modernizr)");return a};d.csstransitions=function(){return n("transitionProperty")};d.fontface=function(){var a,b=e.head||e.getElementsByTagName("head")[0]||l,c=e.createElement("style"),k=e.implementation||{hasFeature:function(){return false}};c.type="text/css";b.insertBefore(c,b.firstChild);a=c.sheet||c.styleSheet;b=k.hasFeature("CSS2","")?function(g){if(!(a&&g))return false;var r=false;try{a.insertRule(g,
|
|
24
|
+
0);r=!/unknown/i.test(a.cssRules[0].cssText);a.deleteRule(a.cssRules.length-1)}catch(x){}return r}:function(g){if(!(a&&g))return false;a.cssText=g;return a.cssText.length!==0&&!/unknown/i.test(a.cssText)&&a.cssText.replace(/\r+|\n+/g,"").indexOf(g.split(" ")[0])===0};f._fontfaceready=function(g){g(f.fontface)};return b('@font-face { font-family: "font"; src: "font.ttf"; }')};d.video=function(){var a=e.createElement("video"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('video/ogg; codecs="theora"');
|
|
25
|
+
b.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"')||a.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');b.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return b};d.audio=function(){var a=e.createElement("audio"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('audio/ogg; codecs="vorbis"');b.mp3=a.canPlayType("audio/mpeg;");b.wav=a.canPlayType('audio/wav; codecs="1"');b.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}return b};d.localstorage=function(){try{return"localStorage"in
|
|
26
|
+
i&&i.localStorage!==null}catch(a){return false}};d.sessionstorage=function(){try{return"sessionStorage"in i&&i.sessionStorage!==null}catch(a){return false}};d.webWorkers=function(){return!!i.Worker};d.applicationcache=function(){return!!i.applicationCache};d.svg=function(){return!!e.createElementNS&&!!e.createElementNS(v.svg,"svg").createSVGRect};d.inlinesvg=function(){var a=document.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==v.svg};d.smil=function(){return!!e.createElementNS&&
|
|
27
|
+
/SVG/.test(O.call(e.createElementNS(v.svg,"animate")))};d.svgclippaths=function(){return!!e.createElementNS&&/SVG/.test(O.call(e.createElementNS(v.svg,"clipPath")))};for(var H in d)if(R(d,H)){w=H.toLowerCase();f[w]=d[H]();P.push((f[w]?"":"no-")+w)}f.input||S();f.crosswindowmessaging=f.postmessage;f.historymanagement=f.history;f.addTest=function(a,b){a=a.toLowerCase();if(!f[a]){b=!!b();l.className+=" "+(b?"":"no-")+a;f[a]=b;return f}};j.cssText="";E=h=null;i.attachEvent&&function(){var a=e.createElement("div");
|
|
28
|
+
a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function c(p){for(var m=-1;++m<r;)p.createElement(g[m])}function k(p,m){for(var I=p.length,t=-1,y,J=[];++t<I;){y=p[t];m=y.media||m;J.push(k(y.imports,m));J.push(y.cssText)}return J.join("")}var g="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"),r=g.length,x=RegExp("<(/*)(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)",
|
|
29
|
+
"gi"),T=RegExp("\\b(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)\\b(?!.*[;}])","gi"),z=b.createDocumentFragment(),A=b.documentElement,K=A.firstChild,B=b.createElement("style"),C=b.createElement("body");B.media="all";c(b);c(z);a.attachEvent("onbeforeprint",function(){for(var p=-1;++p<r;)for(var m=b.getElementsByTagName(g[p]),I=m.length,t=-1;++t<I;)if(m[t].className.indexOf("iepp_")<0)m[t].className+=" iepp_"+
|
|
30
|
+
g[p];K.insertBefore(B,K.firstChild);B.styleSheet.cssText=k(b.styleSheets,"all").replace(T,".iepp_$1");z.appendChild(b.body);A.appendChild(C);C.innerHTML=z.firstChild.innerHTML.replace(x,"<$1bdo")});a.attachEvent("onafterprint",function(){C.innerHTML="";A.removeChild(C);K.removeChild(B);A.appendChild(z.firstChild)})}(this,document);f._enableHTML5=true;f._version="1.6";l.className=l.className.replace(/\bno-js\b/,"")+" js";l.className+=" "+P.join(" ");return f}(this,this.document);
|
metadata
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: da-suspenders
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 1
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
version: 1.0.0
|
|
10
|
+
platform: ruby
|
|
11
|
+
authors:
|
|
12
|
+
- thoughtbot
|
|
13
|
+
- Stefan Daschek
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-02-14 00:00:00 +01:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies:
|
|
21
|
+
- !ruby/object:Gem::Dependency
|
|
22
|
+
name: rails
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
segments:
|
|
29
|
+
- 3
|
|
30
|
+
- 0
|
|
31
|
+
- 4
|
|
32
|
+
version: 3.0.4
|
|
33
|
+
type: :runtime
|
|
34
|
+
version_requirements: *id001
|
|
35
|
+
- !ruby/object:Gem::Dependency
|
|
36
|
+
name: bundler
|
|
37
|
+
prerelease: false
|
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
- - ">="
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
segments:
|
|
43
|
+
- 1
|
|
44
|
+
- 0
|
|
45
|
+
- 10
|
|
46
|
+
version: 1.0.10
|
|
47
|
+
type: :runtime
|
|
48
|
+
version_requirements: *id002
|
|
49
|
+
- !ruby/object:Gem::Dependency
|
|
50
|
+
name: trout
|
|
51
|
+
prerelease: false
|
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
segments:
|
|
57
|
+
- 0
|
|
58
|
+
- 3
|
|
59
|
+
- 0
|
|
60
|
+
version: 0.3.0
|
|
61
|
+
type: :runtime
|
|
62
|
+
version_requirements: *id003
|
|
63
|
+
description: DIE ANTWORT's fork of thoughtbot's original Suspenders. Suspenders is an upgradeable base Rails project.
|
|
64
|
+
email: stefan@die-antwort.eu
|
|
65
|
+
executables:
|
|
66
|
+
- da-suspenders
|
|
67
|
+
extensions: []
|
|
68
|
+
|
|
69
|
+
extra_rdoc_files:
|
|
70
|
+
- README.md
|
|
71
|
+
- LICENSE
|
|
72
|
+
files:
|
|
73
|
+
- .gitignore
|
|
74
|
+
- LICENSE
|
|
75
|
+
- README.md
|
|
76
|
+
- Rakefile
|
|
77
|
+
- bin/da-suspenders
|
|
78
|
+
- da-suspenders.gemspec
|
|
79
|
+
- features/running_cucumber.feature
|
|
80
|
+
- features/step_definitions/shell.rb
|
|
81
|
+
- features/support/env.rb
|
|
82
|
+
- lib/create.rb
|
|
83
|
+
- lib/da-suspenders/version.rb
|
|
84
|
+
- lib/errors.rb
|
|
85
|
+
- template/da-suspenders.rb
|
|
86
|
+
- template/files/factory_girl_steps.rb
|
|
87
|
+
- template/files/mysql_database.yml.erb
|
|
88
|
+
- template/trout/Gemfile
|
|
89
|
+
- template/trout/app/helpers/body_class_helper.rb
|
|
90
|
+
- template/trout/app/javascripts/application.js
|
|
91
|
+
- template/trout/app/stylesheets/application.scss
|
|
92
|
+
- template/trout/app/stylesheets/ie.scss
|
|
93
|
+
- template/trout/app/views/layouts/application.html.erb
|
|
94
|
+
- template/trout/app/views/shared/_flashes.html.erb
|
|
95
|
+
- template/trout/config/initializers/errors.rb
|
|
96
|
+
- template/trout/config/locales/de.yml
|
|
97
|
+
- template/trout/features/step_definitions/js_steps.rb
|
|
98
|
+
- template/trout/lib/templates/erb/scaffold/_form.html.erb
|
|
99
|
+
- template/trout/vendor/sprockets/jquery-ujs/src/rails.js
|
|
100
|
+
- template/trout/vendor/sprockets/modernizr/src/modernizr.js
|
|
101
|
+
has_rdoc: true
|
|
102
|
+
homepage: http://github.com/die-antwort/da-suspenders
|
|
103
|
+
licenses: []
|
|
104
|
+
|
|
105
|
+
post_install_message:
|
|
106
|
+
rdoc_options:
|
|
107
|
+
- --charset=UTF-8
|
|
108
|
+
require_paths:
|
|
109
|
+
- lib
|
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
- - ">="
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
segments:
|
|
115
|
+
- 0
|
|
116
|
+
version: "0"
|
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
|
+
requirements:
|
|
119
|
+
- - ">="
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
segments:
|
|
122
|
+
- 1
|
|
123
|
+
- 3
|
|
124
|
+
- 6
|
|
125
|
+
version: 1.3.6
|
|
126
|
+
requirements: []
|
|
127
|
+
|
|
128
|
+
rubyforge_project:
|
|
129
|
+
rubygems_version: 1.3.6
|
|
130
|
+
signing_key:
|
|
131
|
+
specification_version: 3
|
|
132
|
+
summary: Generate a Rails app using DIE ANTWORT's best practices.
|
|
133
|
+
test_files:
|
|
134
|
+
- features/running_cucumber.feature
|
|
135
|
+
- features/step_definitions/shell.rb
|
|
136
|
+
- features/support/env.rb
|