hightail 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +20 -0
  4. data/README.md +46 -0
  5. data/Rakefile +1 -0
  6. data/USAGE +9 -0
  7. data/bin/hightail +15 -0
  8. data/hightail.gemspec +17 -0
  9. data/lib/hightail.rb +4 -0
  10. data/lib/hightail/app_builder.rb +40 -0
  11. data/lib/hightail/generators/app_generator.rb +94 -0
  12. data/lib/hightail/version.rb +3 -0
  13. data/templates/Gemfile +26 -0
  14. data/templates/README.md +2 -0
  15. data/templates/app_overrides/assets/stylesheets/application.css +7 -0
  16. data/templates/app_overrides/assets/stylesheets/common.css.sass +40 -0
  17. data/templates/app_overrides/assets/stylesheets/form_builder.css.sass +112 -0
  18. data/templates/app_overrides/assets/stylesheets/layout.css.sass +50 -0
  19. data/templates/app_overrides/assets/stylesheets/reset.css.sass +35 -0
  20. data/templates/app_overrides/views/layouts/application.html.haml.tt +16 -0
  21. data/templates/config.ru +3 -0
  22. data/templates/config/application.rb +40 -0
  23. data/templates/config/databases/postgresql.yml +19 -0
  24. data/templates/config/environments/development.rb.tt +28 -0
  25. data/templates/config/environments/production.rb.tt +60 -0
  26. data/templates/config/environments/test.rb.tt +38 -0
  27. data/templates/config/initializers/backtrace_silencers.rb +7 -0
  28. data/templates/config/initializers/form_builder.rb.tt +3 -0
  29. data/templates/config/initializers/haml.rb +1 -0
  30. data/templates/config/initializers/inflections.rb +8 -0
  31. data/templates/config/initializers/mime_types.rb +3 -0
  32. data/templates/config/initializers/secret_token.rb.tt +5 -0
  33. data/templates/config/initializers/session_store.rb.tt +6 -0
  34. data/templates/config/initializers/wrap_parameters.rb.tt +15 -0
  35. data/templates/config/locales/en.yml +1 -0
  36. data/templates/config/locales/form_builder.en.yml +6 -0
  37. data/templates/config/routes.rb +3 -0
  38. data/templates/doc/README_FOR_APP.tt +1 -0
  39. data/templates/gitignore +9 -0
  40. data/templates/lib/%app_name%/form_builder.rb.tt +171 -0
  41. data/templates/lib/generators/haml.rb +28 -0
  42. data/templates/lib/generators/haml/controller/controller_generator.rb +15 -0
  43. data/templates/lib/generators/haml/controller/templates/view.html.haml +2 -0
  44. data/templates/lib/generators/haml/scaffold/scaffold_generator.rb +38 -0
  45. data/templates/lib/generators/haml/scaffold/templates/_form.html.haml +6 -0
  46. data/templates/lib/generators/haml/scaffold/templates/delete.html.haml +9 -0
  47. data/templates/lib/generators/haml/scaffold/templates/edit.html.haml +9 -0
  48. data/templates/lib/generators/haml/scaffold/templates/index.html.haml +23 -0
  49. data/templates/lib/generators/haml/scaffold/templates/new.html.haml +9 -0
  50. data/templates/lib/generators/haml/scaffold/templates/show.html.haml +13 -0
  51. data/templates/rspec +1 -0
  52. data/templates/rvmrc +40 -0
  53. data/templates/spec/spec_helper.rb +17 -0
  54. metadata +121 -0
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ .rvmrc
4
+ Gemfile.lock
5
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Tyler Hunt
2
+
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:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
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,46 @@
1
+ Hightail bootstraps a pretty looking Rails app in a jiff.
2
+
3
+
4
+ ## Installation
5
+
6
+ First install the hightail Gem:
7
+
8
+ gem install hightail
9
+
10
+ Then run:
11
+
12
+ hightail APP_NAME
13
+
14
+ This will create a Rails 3.1 app in `APP_NAME`. This script creates a new
15
+ new git repository. It is not meant to be used against an existing repository.
16
+
17
+
18
+ ## What's Included
19
+
20
+ Here are a few of the differences you can expect to find between the default
21
+ Rails generator and what Hightail generates for you:
22
+
23
+ * PostgreSQL as the default database
24
+ * RSpec instead of Test::Unit
25
+ * a customized form builder
26
+ * default Sass style sheets
27
+ * a Haml application layout
28
+ * simplified and unified generated files
29
+ * a directory under lib for app-specific code
30
+
31
+ And a slew of other minor changes. Basically, these are all the things I found
32
+ myself doing over and over whenever I created a new Rails app.
33
+
34
+
35
+ ## Credits
36
+
37
+ Hightail is a derivative work of [Suspenders][] by [thoughtbot][].
38
+
39
+ [suspenders]: https://github.com/thoughtbot/suspenders
40
+ [thoughtbot]: http://thoughtbot.com/
41
+
42
+
43
+ ## License
44
+
45
+ Hightail is Copyright © 2011 Tyler Hunt. It is free software, and may be
46
+ redistributed under the terms specified in the LICENSE file.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/USAGE ADDED
@@ -0,0 +1,9 @@
1
+ Description:
2
+ The 'hightail' command creates a new Rails application with a default
3
+ directory structure and configuration at the path you specify.
4
+
5
+ Example:
6
+ hightail ~/Code/Ruby/weblog
7
+
8
+ This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
9
+ See the README in the newly created application to get going.
data/bin/hightail ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ hightail_root = File.expand_path('../../lib/hightail', __FILE__)
4
+ templates_root = File.expand_path('../../templates', __FILE__)
5
+
6
+ require File.join(hightail_root, 'generators/app_generator')
7
+ require File.join(hightail_root, 'app_builder')
8
+
9
+ Hightail::Generator.source_root templates_root
10
+
11
+ Hightail::Generator.source_paths \
12
+ << templates_root \
13
+ << Rails::Generators::AppGenerator.source_root
14
+
15
+ Hightail::Generator.start
data/hightail.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ require './lib/hightail/version'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'hightail'
5
+ s.version = Hightail::VERSION
6
+ s.authors = ['Tyler Hunt']
7
+ s.email = ['tyler@tylerhunt.com']
8
+ s.summary = 'Bootstraps a pretty looking Rails app in a jiff.'
9
+
10
+ s.files = `git ls-files`.split("\n")
11
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
+ s.require_paths = ['lib']
14
+
15
+ s.add_dependency('rails', '~> 3.1.1')
16
+ s.add_dependency('bundler', '~> 1.0')
17
+ end
data/lib/hightail.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'hightail/version'
2
+
3
+ module Hightail
4
+ end
@@ -0,0 +1,40 @@
1
+ module Hightail
2
+ class AppBuilder < Rails::AppBuilder
3
+ def app
4
+ super
5
+ remove_file 'app/views/layouts/application.html.erb'
6
+ directory 'app_overrides', 'app', :force => true
7
+ end
8
+
9
+ def lib
10
+ super
11
+ directory 'lib', nil, :force => true
12
+ end
13
+
14
+ def database_yml
15
+ template "config/databases/#{options[:database]}.yml", 'config/database.yml.example'
16
+ end
17
+
18
+ def readme
19
+ template 'README.md'
20
+ end
21
+
22
+ def rspec
23
+ copy_file 'rspec', '.rspec'
24
+ template 'spec/spec_helper.rb'
25
+ empty_directory_with_gitkeep 'spec/support'
26
+ end
27
+
28
+ def rvm
29
+ template 'rvmrc', '.rvmrc'
30
+ end
31
+
32
+ def remove_public_index
33
+ remove_file 'public/index.html'
34
+ end
35
+
36
+ def remove_rails_logo
37
+ remove_file 'app/assets/images/rails.png'
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,94 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/rails/app/app_generator'
3
+
4
+ module Hightail
5
+ class Generator < Rails::Generators::AppGenerator
6
+ class_option :database,
7
+ type: :string,
8
+ aliases: '-d',
9
+ default: 'postgresql',
10
+ desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
11
+
12
+ class_option :skip_bundle,
13
+ :type => :boolean,
14
+ :default => true,
15
+ :desc => "Don't run bundle install"
16
+
17
+ class_option :skip_test_unit,
18
+ type: :boolean,
19
+ aliases: '-T',
20
+ default: true,
21
+ desc: 'Skip Test::Unit files'
22
+
23
+ class_option :skip_rspec,
24
+ type: :boolean,
25
+ default: false,
26
+ desc: 'Skip RSpec files'
27
+
28
+ class_option :skip_rvm,
29
+ type: :boolean,
30
+ default: false,
31
+ desc: 'Skip RVM files'
32
+
33
+ def initialize(*args)
34
+ raise Rails::Generators::Error, 'Options should be given after the application name. For details run: hightail --help' if args[0].blank?
35
+ super
36
+ end
37
+
38
+ def finish_template
39
+ invoke :hightail_customization
40
+ super
41
+ end
42
+
43
+ def hightail_customization
44
+ build :rvm unless options[:skip_rvm]
45
+ build :rspec unless options[:skip_rspec]
46
+ build :remove_public_index
47
+ build :remove_rails_logo
48
+ end
49
+
50
+ protected
51
+
52
+ def self.banner
53
+ "hightail #{self.arguments.map(&:usage).join(' ')} [options]"
54
+ end
55
+
56
+ def comment_if(value)
57
+ super.strip
58
+ end
59
+
60
+ def rails_gemfile_entry
61
+ if options.dev?
62
+ <<-GEMFILE.strip_heredoc
63
+ gem 'rails', :path => '#{Rails::Generators::RAILS_DEV_PATH}'
64
+ GEMFILE
65
+ elsif options.edge?
66
+ <<-GEMFILE.strip_heredoc
67
+ gem 'rails', :git => 'git://github.com/rails/rails.git'
68
+ GEMFILE
69
+ else
70
+ <<-GEMFILE.strip_heredoc
71
+ gem 'rails'
72
+ GEMFILE
73
+ end
74
+ end
75
+
76
+ def rspec_gemfile_entry
77
+ unless options[:skip_rspec]
78
+ <<-GEMFILE.strip_heredoc
79
+ group :test, :development do
80
+ gem 'rspec-rails'
81
+ end
82
+
83
+ group :test do
84
+ gem 'remockable'
85
+ end
86
+ GEMFILE
87
+ end
88
+ end
89
+
90
+ def get_builder_class
91
+ AppBuilder
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,3 @@
1
+ module Hightail
2
+ VERSION = '0.0.1'
3
+ end
data/templates/Gemfile ADDED
@@ -0,0 +1,26 @@
1
+ source 'http://rubygems.org'
2
+
3
+ <%= rails_gemfile_entry -%>
4
+ <%= database_gemfile_entry -%>
5
+ <%= "gem 'jruby-openssl'\n" if defined?(JRUBY_VERSION) -%>
6
+ <%= "gem 'json'\n" if RUBY_VERSION < "1.9.2" -%>
7
+ <%= javascript_gemfile_entry %>
8
+
9
+ gem 'coercion'
10
+ gem 'haml'
11
+
12
+ # To use ActiveModel has_secure_password
13
+ #gem 'bcrypt-ruby', '~> 3.0.0'
14
+
15
+ # Use unicorn as the web server
16
+ #gem 'unicorn'
17
+
18
+ # Deploy with Capistrano
19
+ #gem 'capistrano'
20
+
21
+ # To use debugger
22
+ #<%= ruby_debugger_gemfile_entry %>
23
+
24
+ <%= assets_gemfile_entry.gsub(/,\s+/, ', ') %>
25
+ <%= turn_gemfile_entry -%>
26
+ <%= rspec_gemfile_entry -%>
@@ -0,0 +1,2 @@
1
+ # <%= app_const_base %>
2
+
@@ -0,0 +1,7 @@
1
+ /*
2
+ *= require reset
3
+ *= require layout
4
+ *
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,40 @@
1
+ $black: #000
2
+ $off-black: #111
3
+ $dark-gray: #333
4
+ $gray: #666
5
+ $medium-gray: #999
6
+ $light-gray: #CCC
7
+ $off-white: #EEE
8
+ $white: #FFF
9
+
10
+ $red: #F33
11
+ $blue: #369
12
+ $green: #9C6
13
+
14
+ $background: $white
15
+ $text: $black
16
+ $link: $blue
17
+ $error: $red
18
+
19
+ $spacer: 1.5em
20
+ $line_height: $spacer
21
+
22
+ =rounded($radius: 0.5em)
23
+ -webkit-border-radius: $radius
24
+ -moz-border-radius: $radius
25
+
26
+ =shadow($top: 0, $left: 0, $radius: 1.5em, $color: rgba(0, 0, 0, 0.5))
27
+ box-shadow: $top $left $radius $color
28
+ -webkit-box-shadow: $top $left $radius $color
29
+ -moz-box-shadow: $top $left $radius $color
30
+
31
+ =inset($top: 0, $left: 0, $radius: 0.5em, $color: rgba(0, 0, 0, 0.5))
32
+ box-shadow: inset $top $left $radius $color
33
+ -webkit-box-shadow: inset $top $left $radius $color
34
+ -moz-box-shadow: inset $top $left $radius $color
35
+
36
+ =ease($duration: 0.25s)
37
+ transition: all $duration ease-in-out
38
+ -webkit-transition: all $duration ease-in-out
39
+ -moz-transition: all $duration ease-in-out
40
+ -ms-transition: all $duration ease-in-out
@@ -0,0 +1,112 @@
1
+ @import 'common'
2
+
3
+ form
4
+ section > &
5
+ +rounded
6
+ background: #FFF
7
+ color: #000
8
+ padding: $spacer
9
+
10
+ input,
11
+ select
12
+ +rounded(0.25em)
13
+ background: #EEE
14
+ border: 0.125em solid #999
15
+ font-family: 'Helvetica', sans-serif
16
+ font-size: 1em
17
+ margin: 0
18
+ padding: 0.25em
19
+
20
+ &:focus
21
+ +shadow(0, 0, 0.5em, $blue)
22
+ outline: none
23
+
24
+ fieldset
25
+ border-top: 0.125em solid #999
26
+ margin: ($spacer / 2) 0
27
+ padding-top: $spacer
28
+
29
+ legend
30
+ border-right: (0.125em / 0.875) solid #999
31
+ color: #666
32
+ font-size: 0.875em
33
+ font-weight: bold
34
+ padding-right: 0.5em
35
+ text-transform: uppercase
36
+
37
+ fieldset
38
+ margin-left: $spacer * 2
39
+
40
+ & > p
41
+ margin-bottom: $spacer
42
+
43
+ .section
44
+ :clear left
45
+
46
+ .field
47
+ :float left
48
+ :margin-right $spacer * 2
49
+
50
+ .field
51
+ margin-bottom: $spacer
52
+
53
+ label
54
+ display: block
55
+ line-height: $line-height
56
+
57
+ &.required label
58
+ font-weight: bold
59
+
60
+ &.optional label
61
+ color: #666
62
+ font-style: italic
63
+
64
+ &.radio input
65
+ height: $line-height
66
+ float: left
67
+ margin-right: 0.5em
68
+
69
+ .instructions
70
+ color: $gray
71
+ font-size: 0.875em
72
+ font-style: italic
73
+ line-height: $line-height / 0.875
74
+
75
+ .submit
76
+ border-top: 0.25em solid #999
77
+ padding-top: $spacer
78
+
79
+ input
80
+ +rounded
81
+ background: $blue
82
+ border-color: $blue
83
+ color: #FFF
84
+ font-weight: bold
85
+ margin-right: 0.25em
86
+ padding: 0.25em 0.5em
87
+
88
+ a
89
+ font-weight: bold
90
+ margin: 0 0.25em
91
+
92
+ .errors
93
+ color: $error
94
+ border-color: $error
95
+
96
+ legend
97
+ color: $error
98
+ border-color: $error
99
+
100
+ ul
101
+ margin-bottom: $spacer
102
+
103
+ li
104
+ list-style: disc
105
+ line-height: $line-height
106
+
107
+ .field_with_errors
108
+ label
109
+ :color $error
110
+
111
+ input
112
+ border-color: $error