hazel 0.0.1 → 0.0.2

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.
Files changed (48) hide show
  1. data/Gemfile +7 -0
  2. data/Gemfile.lock +11 -0
  3. data/MIT-LICENSE +17 -16
  4. data/README.md +75 -0
  5. data/Rakefile +9 -0
  6. data/bin/hazel +2 -7
  7. data/lib/extensions/string.rb +36 -0
  8. data/lib/hazel/cli.rb +102 -22
  9. data/lib/hazel/version.rb +3 -3
  10. data/lib/templates/Gemfile +32 -0
  11. data/lib/templates/README.md +1 -0
  12. data/lib/templates/Rakefile +31 -0
  13. data/lib/templates/app.rb +11 -0
  14. data/lib/templates/config/db.yml +35 -0
  15. data/lib/templates/config/initializers/database.rb +9 -0
  16. data/lib/templates/config/initializers/redis.rb +3 -0
  17. data/lib/templates/config/redis.yml +14 -0
  18. data/lib/templates/config.ru +15 -0
  19. data/lib/templates/public/favicon.ico +0 -0
  20. data/lib/templates/public/images/.gitkeep +0 -0
  21. data/{app → lib/templates}/public/images/hazel_icon.png +0 -0
  22. data/lib/templates/public/images/hazel_small.png +0 -0
  23. data/lib/templates/public/javascripts/.gitkeep +0 -0
  24. data/lib/templates/public/stylesheets/main.css +116 -0
  25. data/lib/templates/spec/app_spec.rb +14 -0
  26. data/lib/templates/spec/spec_helper.rb +15 -0
  27. data/lib/templates/views/layout.erb.tt +37 -0
  28. data/lib/templates/views/welcome.erb +19 -0
  29. data/spec/spec_helper.rb +5 -0
  30. data/spec/string_extension_spec.rb +48 -0
  31. metadata +71 -95
  32. data/README.rdoc +0 -49
  33. data/app/Gemfile +0 -5
  34. data/app/Gemfile.lock +0 -23
  35. data/app/config.ru +0 -7
  36. data/app/hazel.rb +0 -23
  37. data/app/public/favicon.ico +0 -0
  38. data/app/public/images/hazel.png +0 -0
  39. data/app/public/images/hazel_medium.png +0 -0
  40. data/app/public/images/hazel_small.png +0 -0
  41. data/app/public/stylesheets/_buttons.scss +0 -40
  42. data/app/public/stylesheets/_reset.scss +0 -104
  43. data/app/public/stylesheets/all.css +0 -1
  44. data/app/public/stylesheets/all.scss +0 -81
  45. data/app/views/bookmarklet.haml +0 -8
  46. data/app/views/index.haml +0 -10
  47. data/app/views/layout.haml +0 -11
  48. data/app/views/manage.haml +0 -7
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ group :development do
4
+ gem "bundler", "~> 1.0.0"
5
+ end
6
+
7
+ gem "thor", "~> 0.14.6"
data/Gemfile.lock ADDED
@@ -0,0 +1,11 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ thor (0.14.6)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ bundler (~> 1.0.0)
11
+ thor (~> 0.14.6)
data/MIT-LICENSE CHANGED
@@ -1,19 +1,20 @@
1
- Copyright (c) 2010 Peter Hellberg
1
+ Copyright (c) 2012 Peter Hellberg
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
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 included in
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, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
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
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:spec) do |test|
5
+ test.libs << 'lib' << 'spec'
6
+ test.pattern = 'spec/**/*_spec.rb'
7
+ end
8
+
9
+ task :default => :spec
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
- begin
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
- $:.unshift(File.expand_path('..', __FILE__))
1
+ # encoding: UTF-8
2
2
 
3
- require 'hazel/version'
4
- require 'rubygems'
5
- require 'thor'
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 'setup [PATH]', 'Setup a new Hazel instance'
13
- def setup(path = "hazel")
14
- if File.exists? path
15
- puts "#{path} already exists. Exiting."
16
- else
17
- app_files = File.expand_path('../../../app', __FILE__)
18
-
19
- Hazel::CLI.source_root(app_files)
20
-
21
- directory(app_files, path)
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
- desc :version, "The current version number (#{VERSION::STRING})"
26
- def version
27
- puts VERSION::STRING
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
@@ -2,8 +2,8 @@ module Hazel
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 1
6
-
5
+ TINY = 2
6
+
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
9
- end
9
+ end
@@ -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,11 @@
1
+ class <%= @name.camel_case %> < Sinatra::Base
2
+
3
+ set :public_folder => "public", :static => true
4
+
5
+ get "/" do
6
+ @version = RUBY_VERSION
7
+ @environment = ENV['RACK_ENV']
8
+
9
+ erb :welcome
10
+ end
11
+ end
@@ -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,9 @@
1
+ <% unless @no_database -%>
2
+ settings = YAML::load_file("config/db.yml")
3
+ <% if @database != 'mongo' -%>
4
+ # Sequel Configuration
5
+ DB = Sequel.connect(settings[ENV['RACK_ENV']])
6
+ <% else -%>
7
+ # MongoDB Configuration
8
+ <% end -%>
9
+ <% end -%>
@@ -0,0 +1,3 @@
1
+ # Redis Configuration
2
+ redis_settings = YAML::load_file("config/redis.yml")
3
+ REDIS = Redis.new(redis_settings[ENV['RACK_ENV']])
@@ -0,0 +1,14 @@
1
+ development:
2
+ host: localhost
3
+ port: 6387
4
+ password:
5
+
6
+ test:
7
+ host: localhost
8
+ port: 6387
9
+ password:
10
+
11
+ production:
12
+ host: localhost
13
+ port: 6387
14
+ password:
@@ -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
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
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'bundler'
4
+
5
+ Bundler.setup
6
+ Bundler.require
7
+
8
+ require 'minitest/pride'
9
+ require 'minitest/autorun'
10
+ require 'minitest/spec'
11
+ require 'rack/test'
12
+
13
+ class MiniTest::Spec
14
+ include Rack::Test::Methods
15
+ end