hazel 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +11 -0
- data/MIT-LICENSE +17 -16
- data/README.md +75 -0
- data/Rakefile +9 -0
- data/bin/hazel +2 -7
- data/lib/extensions/string.rb +36 -0
- data/lib/hazel/cli.rb +102 -22
- data/lib/hazel/version.rb +3 -3
- data/lib/templates/Gemfile +32 -0
- data/lib/templates/README.md +1 -0
- data/lib/templates/Rakefile +31 -0
- data/lib/templates/app.rb +11 -0
- data/lib/templates/config/db.yml +35 -0
- data/lib/templates/config/initializers/database.rb +9 -0
- data/lib/templates/config/initializers/redis.rb +3 -0
- data/lib/templates/config/redis.yml +14 -0
- data/lib/templates/config.ru +15 -0
- data/lib/templates/public/favicon.ico +0 -0
- data/lib/templates/public/images/.gitkeep +0 -0
- data/{app → lib/templates}/public/images/hazel_icon.png +0 -0
- data/lib/templates/public/images/hazel_small.png +0 -0
- data/lib/templates/public/javascripts/.gitkeep +0 -0
- data/lib/templates/public/stylesheets/main.css +116 -0
- data/lib/templates/spec/app_spec.rb +14 -0
- data/lib/templates/spec/spec_helper.rb +15 -0
- data/lib/templates/views/layout.erb.tt +37 -0
- data/lib/templates/views/welcome.erb +19 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/string_extension_spec.rb +48 -0
- metadata +71 -95
- data/README.rdoc +0 -49
- data/app/Gemfile +0 -5
- data/app/Gemfile.lock +0 -23
- data/app/config.ru +0 -7
- data/app/hazel.rb +0 -23
- data/app/public/favicon.ico +0 -0
- data/app/public/images/hazel.png +0 -0
- data/app/public/images/hazel_medium.png +0 -0
- data/app/public/images/hazel_small.png +0 -0
- data/app/public/stylesheets/_buttons.scss +0 -40
- data/app/public/stylesheets/_reset.scss +0 -104
- data/app/public/stylesheets/all.css +0 -1
- data/app/public/stylesheets/all.scss +0 -81
- data/app/views/bookmarklet.haml +0 -8
- data/app/views/index.haml +0 -10
- data/app/views/layout.haml +0 -11
- data/app/views/manage.haml +0 -7
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/MIT-LICENSE
CHANGED
@@ -1,19 +1,20 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2012 Peter Hellberg
|
2
2
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
of this software and associated documentation files (the
|
5
|
-
in the Software without restriction, including
|
6
|
-
to use, copy, modify, merge, publish,
|
7
|
-
copies of the Software, and to
|
8
|
-
furnished to do so, subject to
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
9
10
|
|
10
|
-
The above copyright notice and this permission notice shall be
|
11
|
-
all copies or substantial portions of the Software.
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
12
13
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
THE SOFTWARE.
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
![Hazel](http://c7.github.com/hazel/images/hazel_small.png)
|
2
|
+
|
3
|
+
A simple Sinatra app generator, heavily based on [snfn](https://github.com/zachpendleton/snfn).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
gem install hazel
|
8
|
+
|
9
|
+
## Configuration
|
10
|
+
|
11
|
+
* `-d` Database. Options are "postgres," "mysql," "sqlite", and "mongo."
|
12
|
+
Default is "sqlite."
|
13
|
+
* `--redis` Include Redis configuration options.
|
14
|
+
* `--no-database` Don't include any database config options.
|
15
|
+
* `--no-bundle-install` Don’t run bundle install after generating the app
|
16
|
+
* `--no-git-repo` Don’t initialize a Git repository
|
17
|
+
|
18
|
+
## Example
|
19
|
+
|
20
|
+
Standard app, using sqlite.
|
21
|
+
|
22
|
+
hazel my_app
|
23
|
+
|
24
|
+
App using MySQL and Redis.
|
25
|
+
|
26
|
+
hazel my_app -d mysql --redis
|
27
|
+
|
28
|
+
App using MongoDB and Redis, but don’t run bundle install.
|
29
|
+
|
30
|
+
hazel my_app -d mongo --redis --no-bundle-install
|
31
|
+
|
32
|
+
## Architecture
|
33
|
+
|
34
|
+
The template autoloads files in config/initializers and
|
35
|
+
/lib. Database configuration options are stored in `config/db.yml`
|
36
|
+
and are loaded via `config/initializers/database.rb`.
|
37
|
+
|
38
|
+
## DB Setup
|
39
|
+
|
40
|
+
[Sequel](http://sequel.rubyforge.org) is used as an ORM for
|
41
|
+
relational databases, and migrations are stored in db/migrate.
|
42
|
+
Migrations can be run using the rake command `rake rb:migrate`.
|
43
|
+
|
44
|
+
[mongodb_model](https://github.com/alexeypetrushin/mongodb_model)
|
45
|
+
is used for Mongo apps, with the config options
|
46
|
+
stored in the same files as relational databases (`config/db.yml`
|
47
|
+
and `config/initializers/database.rb`).
|
48
|
+
|
49
|
+
### More information
|
50
|
+
|
51
|
+
* [Sequel Migrations](http://sequel.rubyforge.org/rdoc/files/doc/migration_rdoc.html)
|
52
|
+
* [Sequel Models](http://sequel.rubyforge.org/rdoc/classes/Sequel/Model.html)
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
Copyright (c) 2012 Peter Hellberg
|
57
|
+
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
59
|
+
a copy of this software and associated documentation files (the
|
60
|
+
"Software"), to deal in the Software without restriction, including
|
61
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
62
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
63
|
+
permit persons to whom the Software is furnished to do so, subject to
|
64
|
+
the following conditions:
|
65
|
+
|
66
|
+
The above copyright notice and this permission notice shall be
|
67
|
+
included in all copies or substantial portions of the Software.
|
68
|
+
|
69
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
70
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
71
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
72
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
73
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
74
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
75
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/hazel
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
|
2
3
|
|
3
|
-
|
4
|
-
require "hazel/cli"
|
5
|
-
rescue LoadError
|
6
|
-
lib_path = File.expand_path('../../lib', __FILE__)
|
7
|
-
$:.unshift(lib_path)
|
8
|
-
require "hazel/cli"
|
9
|
-
end
|
4
|
+
require "hazel/cli"
|
10
5
|
|
11
6
|
Hazel::CLI.start
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Hazel
|
2
|
+
module Extensions
|
3
|
+
module String
|
4
|
+
def camel_case
|
5
|
+
return self.gsub(/^./) { |l| l.capitalize } if !match(/[_-]/)
|
6
|
+
altered_self = self.downcase.capitalize
|
7
|
+
altered_self.scan(/[_-][a-zA-Z]/).each do |match|
|
8
|
+
altered_self.gsub!(match, match[1].upcase)
|
9
|
+
end
|
10
|
+
|
11
|
+
altered_self
|
12
|
+
end
|
13
|
+
|
14
|
+
def camel_case!
|
15
|
+
self.replace camel_case
|
16
|
+
end
|
17
|
+
|
18
|
+
def file_name
|
19
|
+
return self.gsub(/-/, "_") if !match(/[A-Z]/)
|
20
|
+
altered_self = self.strip
|
21
|
+
|
22
|
+
altered_self.scan(/[A-Z]/).each do |match|
|
23
|
+
altered_self.gsub!(match, "_#{match.downcase}")
|
24
|
+
end
|
25
|
+
|
26
|
+
altered_self.sub(/^_/, "").gsub(/_{2,}+/, "_").downcase
|
27
|
+
end
|
28
|
+
|
29
|
+
def file_name!
|
30
|
+
self.replace file_name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
String.send(:include, Hazel::Extensions::String)
|
data/lib/hazel/cli.rb
CHANGED
@@ -1,30 +1,110 @@
|
|
1
|
-
|
1
|
+
# encoding: UTF-8
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "rubygems"
|
4
|
+
require "extensions/string"
|
5
|
+
require "thor/group"
|
6
6
|
|
7
7
|
module Hazel
|
8
|
-
class CLI < Thor
|
9
|
-
include Thor::Base
|
8
|
+
class CLI < Thor::Group
|
10
9
|
include Thor::Actions
|
11
|
-
|
12
|
-
desc
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
10
|
+
|
11
|
+
desc "Creates a new Sinatra application"
|
12
|
+
argument :name, :type => :string, :desc => "The name of the new application"
|
13
|
+
class_option :database, :aliases => "-d", :default => "sqlite", :desc => "The type of database to use"
|
14
|
+
class_option :no_database, :type => :boolean, :desc => "Exclude all database configuration files"
|
15
|
+
class_option :redis, :type => :boolean, :desc => "Include Redis configuration"
|
16
|
+
class_option :no_bundle_install, :type => :boolean, :desc => "Don’t run bundle install after generating the app"
|
17
|
+
class_option :no_git_repo, :type => :boolean, :desc => "Don’t initialize a Git repository"
|
18
|
+
|
19
|
+
# Creates instance variables from options passed to hazel.
|
20
|
+
def setup
|
21
|
+
@name = @app_path = name.file_name
|
22
|
+
options.each do |key, value|
|
23
|
+
instance_variable_set "@#{key.to_s}".to_sym, value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.source_root
|
28
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib", "templates"))
|
29
|
+
end
|
30
|
+
|
31
|
+
# Create empty directories
|
32
|
+
def create_empty_directories
|
33
|
+
%w{config/initializers lib log tmp spec}.each do |dir|
|
34
|
+
empty_directory File.join(@app_path, dir)
|
35
|
+
end
|
36
|
+
|
37
|
+
empty_directory File.join(@app_path, 'db/migrate') unless @no_database
|
38
|
+
|
39
|
+
create_file File.join(@app_path, "lib", ".gitkeep")
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_public_directory
|
43
|
+
%w{public/stylesheets public/javascripts public/images}.each do |dir|
|
44
|
+
directory dir, File.join(@app_path, dir)
|
45
|
+
end
|
46
|
+
|
47
|
+
template "public/favicon.ico", File.join(@app_path, "public/favicon.ico")
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_view_directory
|
51
|
+
directory "views", File.join(@app_path, "views")
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_app
|
55
|
+
template "app.rb", File.join(@app_path, "#{@name}.rb")
|
56
|
+
end
|
57
|
+
|
58
|
+
def create_app_spec
|
59
|
+
template "spec/app_spec.rb", File.join(@app_path, "spec/#{@name}_spec.rb")
|
60
|
+
end
|
61
|
+
|
62
|
+
def create_spec_helper
|
63
|
+
template "spec/spec_helper.rb", File.join(@app_path, "spec/spec_helper.rb")
|
64
|
+
end
|
65
|
+
|
66
|
+
def create_config
|
67
|
+
template "config.ru", File.join(@app_path, "config.ru")
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_gemfile
|
71
|
+
template "Gemfile", File.join(@app_path, "Gemfile")
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_rakefile
|
75
|
+
copy_file "Rakefile", File.join(@app_path, "Rakefile")
|
76
|
+
end
|
77
|
+
|
78
|
+
def create_readme
|
79
|
+
copy_file "README.md", File.join(@app_path, "README.md")
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_db_config
|
83
|
+
template("config/db.yml", File.join(@app_path, "config/db.yml")) unless @no_database
|
84
|
+
end
|
85
|
+
|
86
|
+
def create_database_initializer
|
87
|
+
template("config/initializers/database.rb", File.join(@app_path, "config/initializers/database.rb")) unless @no_database
|
88
|
+
end
|
89
|
+
|
90
|
+
def create_redis_config
|
91
|
+
copy_file("config/redis.yml", File.join(@app_path, "config/redis.yml")) if @redis
|
92
|
+
end
|
93
|
+
|
94
|
+
def create_redis_initializer
|
95
|
+
template("config/initializers/redis.rb", File.join(@app_path, "config/initializers/redis.rb")) if @redis
|
96
|
+
end
|
97
|
+
|
98
|
+
def install_dependencies
|
99
|
+
inside(@name) do
|
100
|
+
run('bundle install') unless @no_bundle_install
|
22
101
|
end
|
23
102
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
103
|
+
|
104
|
+
def initialize_git_repo
|
105
|
+
inside(@name) do
|
106
|
+
run('git init .') unless @no_git_repo
|
107
|
+
end
|
28
108
|
end
|
29
109
|
end
|
30
|
-
end
|
110
|
+
end
|
data/lib/hazel/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
# App Stack
|
4
|
+
gem "sinatra", "~> 1.3.2"
|
5
|
+
|
6
|
+
<% unless @no_database -%>
|
7
|
+
# Database Stack
|
8
|
+
<% unless @database == 'mongo' -%>
|
9
|
+
gem "sequel"
|
10
|
+
<% end -%>
|
11
|
+
<% if @database == "sqlite" -%>
|
12
|
+
gem "sqlite3"
|
13
|
+
<% elsif @database == "postgres" -%>
|
14
|
+
gem "pg"
|
15
|
+
<% elsif @database == "mysql" -%>
|
16
|
+
gem "mysql2"
|
17
|
+
<% elsif @database == "mongo" -%>
|
18
|
+
gem "bson_ext", "~> 1.5"
|
19
|
+
gem "mongodb_model", "~> 2.1"
|
20
|
+
<% end -%>
|
21
|
+
<% end -%>
|
22
|
+
|
23
|
+
<% if @redis -%>
|
24
|
+
# Redis
|
25
|
+
gem "hiredis", "~> 0.4"
|
26
|
+
gem "redis", "~> 2.2", :require => ["redis/connection/hiredis", "redis"]
|
27
|
+
<% end -%>
|
28
|
+
|
29
|
+
group :development do
|
30
|
+
gem "minitest", "~> 2.10"
|
31
|
+
gem "rack-test", "~> 0.6.1"
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
%w{ rubygems bundler find rake/testtask}.each { |lib| require lib }
|
2
|
+
|
3
|
+
task :default => :spec
|
4
|
+
|
5
|
+
Rake::TestTask.new(:spec) do |t|
|
6
|
+
t.test_files = FileList['spec/*_spec.rb']
|
7
|
+
t.ruby_opts = ['-rubygems'] if defined? Gem
|
8
|
+
t.ruby_opts << '-I.'
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :db do
|
12
|
+
desc "Run all migrations in db/migrate"
|
13
|
+
task :migrate => :connect do
|
14
|
+
Sequel.extension(:migration)
|
15
|
+
Sequel::Migrator.apply(DB, "db/migrate")
|
16
|
+
end
|
17
|
+
|
18
|
+
task :connect => :environment do
|
19
|
+
require "./config/initializers/database"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
task :environment, [:env] do |cmd, args|
|
24
|
+
Bundler.require
|
25
|
+
ENV['RACK_ENV'] = args[:env] || "development"
|
26
|
+
%w{ ./config/initializers ./lib }.each do
|
27
|
+
Find.find(lib) { |f| require f unless f.match(/\/\..+$/) || File.directory?(f) }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Sequel Database Configuration
|
2
|
+
<% if @database == "sqlite" %>
|
3
|
+
development: "sqlite://db/development.sqlite3"
|
4
|
+
test: "sqlite://db/test.sqlite3"
|
5
|
+
production: "sqlite://db/production.sqlite3"
|
6
|
+
<% elsif @database == "postgres" %>
|
7
|
+
development: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_development"
|
8
|
+
test: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_test"
|
9
|
+
production: "postgres://<%= `whoami`.chop %>@localhost/<%= @name %>_production"
|
10
|
+
<% elsif @database == "mysql" %>
|
11
|
+
development: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_development"
|
12
|
+
test: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_test"
|
13
|
+
production: "mysql2://<%= `whoami`.chop %>@localhost/<%= @name %>_production"
|
14
|
+
<% elsif @database == "mongo" %>
|
15
|
+
development:
|
16
|
+
host: localhost
|
17
|
+
port: 27017
|
18
|
+
database: <%= @name %>_development
|
19
|
+
username:
|
20
|
+
password:
|
21
|
+
|
22
|
+
test:
|
23
|
+
host: localhost
|
24
|
+
port: 27017
|
25
|
+
database: <%= @name %>_test
|
26
|
+
username:
|
27
|
+
password:
|
28
|
+
|
29
|
+
production:
|
30
|
+
host: localhost
|
31
|
+
port: 27017
|
32
|
+
database: <%= @name %>_production
|
33
|
+
username:
|
34
|
+
password:
|
35
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Load path and gems/bundler
|
2
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler"
|
5
|
+
Bundler.require
|
6
|
+
|
7
|
+
# Local config
|
8
|
+
require "find"
|
9
|
+
%w{config/initializers lib}.each do |load_path|
|
10
|
+
Find.find(load_path) { |f| require f unless f.match(/\/\..+$/) || File.directory?(f) }
|
11
|
+
end
|
12
|
+
|
13
|
+
# Load app
|
14
|
+
require "<%= @name %>"
|
15
|
+
run <%= @name.camel_case %>
|
Binary file
|
File without changes
|
File without changes
|
Binary file
|
File without changes
|
@@ -0,0 +1,116 @@
|
|
1
|
+
@media screen {
|
2
|
+
/* --- Reset Styles --- */
|
3
|
+
* {
|
4
|
+
list-style: none;
|
5
|
+
margin: 0;
|
6
|
+
padding: 0;
|
7
|
+
}
|
8
|
+
|
9
|
+
html, body {
|
10
|
+
height: 100%;
|
11
|
+
width: 100%;
|
12
|
+
}
|
13
|
+
|
14
|
+
/* --- Welcome Page Styles --- */
|
15
|
+
body {
|
16
|
+
background: #eee;
|
17
|
+
color: #333;
|
18
|
+
font-family: Sans-Serif;
|
19
|
+
line-height: 18px;
|
20
|
+
}
|
21
|
+
|
22
|
+
.wrapper {
|
23
|
+
background: #fff;
|
24
|
+
-moz-box-shadow: 0 0 10px rgba(0,0,0,.3);
|
25
|
+
-webkit-box-shadow: 0 0 10px rgba(0,0,0,.3);
|
26
|
+
box-shadow: 0 0 10px rgba(0,0,0,.3);
|
27
|
+
margin: 16px auto;
|
28
|
+
max-width: 960px;
|
29
|
+
padding: 2.25%; /* 18px / 800px */
|
30
|
+
width: 85%;
|
31
|
+
}
|
32
|
+
|
33
|
+
h1 {
|
34
|
+
font-size: 36px;
|
35
|
+
line-height: 54px;
|
36
|
+
}
|
37
|
+
|
38
|
+
h2 {
|
39
|
+
border-bottom: 2px solid #ccc;
|
40
|
+
font-size: 24px;
|
41
|
+
line-height: 36px;
|
42
|
+
margin-bottom: 16px;
|
43
|
+
}
|
44
|
+
|
45
|
+
h3 {
|
46
|
+
font-size: 18px;
|
47
|
+
line-height: 36px;
|
48
|
+
}
|
49
|
+
|
50
|
+
p {
|
51
|
+
margin-bottom: 18px;
|
52
|
+
}
|
53
|
+
|
54
|
+
.main {
|
55
|
+
overflow: hidden;
|
56
|
+
}
|
57
|
+
|
58
|
+
.content {
|
59
|
+
float: left;
|
60
|
+
width: 60%; /* 480px / 800px */
|
61
|
+
}
|
62
|
+
|
63
|
+
.sidebar {
|
64
|
+
background: #eee;
|
65
|
+
border: 1px solid #ccc;
|
66
|
+
float: right;
|
67
|
+
padding: 2.08333333333%; /* 5px / 240px */
|
68
|
+
width: 30%; /* 240px / 800px */
|
69
|
+
}
|
70
|
+
|
71
|
+
.sidebar ul {
|
72
|
+
font-size: 14px;
|
73
|
+
}
|
74
|
+
|
75
|
+
.branding {
|
76
|
+
clear: both;
|
77
|
+
}
|
78
|
+
|
79
|
+
footer.branding {
|
80
|
+
border-top: 2px solid #ccc;
|
81
|
+
margin-top: 20px;
|
82
|
+
padding-top: 20px;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
@media screen and (max-width: 600px) {
|
87
|
+
.wrapper {
|
88
|
+
-moz-box-shadow: none;
|
89
|
+
-webkit-box-shadow: none;
|
90
|
+
box-shadow: none;
|
91
|
+
width: auto;
|
92
|
+
}
|
93
|
+
|
94
|
+
.content, .sidebar {
|
95
|
+
float: none;
|
96
|
+
width: 100%;
|
97
|
+
}
|
98
|
+
|
99
|
+
.sidebar {
|
100
|
+
background: transparent;
|
101
|
+
border: none;
|
102
|
+
border-top: 2px solid #ccc;
|
103
|
+
padding: 0;
|
104
|
+
}
|
105
|
+
|
106
|
+
h1 {
|
107
|
+
font-size: 24px;
|
108
|
+
line-height: 36px;
|
109
|
+
}
|
110
|
+
|
111
|
+
h2 {
|
112
|
+
font-size: 18px;
|
113
|
+
line-height: 24px;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
require_relative "../<%= @name %>.rb"
|
3
|
+
|
4
|
+
def app
|
5
|
+
<%= @name.camel_case %>
|
6
|
+
end
|
7
|
+
|
8
|
+
describe <%= @name.camel_case %> do
|
9
|
+
it "responds with a welcome message" do
|
10
|
+
get '/'
|
11
|
+
|
12
|
+
last_response.body.must_include 'Welcome to the Sinatra Template!'
|
13
|
+
end
|
14
|
+
end
|