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
@@ -0,0 +1,28 @@
1
+ module Haml
2
+ module Generators
3
+ module GeneratorExtensions
4
+ def parse_attributes!
5
+ super
6
+
7
+ attributes.each do |attribute|
8
+ attribute.extend(FormBuilderGeneratedAttributeExtensions)
9
+ end
10
+ end
11
+ end
12
+
13
+ module FormBuilderGeneratedAttributeExtensions
14
+ def field_type
15
+ @field_type ||= case type
16
+ when :integer then :number
17
+ when :float, :decimal then :text
18
+ when :time then :time
19
+ when :datetime, :timestamp then :date_time
20
+ when :date then :date
21
+ when :text then :area
22
+ when :boolean then :checkbox
23
+ else :text
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ require 'rails/generators/erb/controller/controller_generator'
2
+
3
+ module Haml
4
+ module Generators
5
+ class ControllerGenerator < Erb::Generators::ControllerGenerator
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ protected
9
+
10
+ def handler
11
+ :haml
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ %h1 <%= @action.humanize %>
2
+
@@ -0,0 +1,38 @@
1
+ require 'generators/haml'
2
+ require 'rails/generators/erb/scaffold/scaffold_generator'
3
+
4
+ module Haml
5
+ module Generators
6
+ class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
7
+ include Haml::Generators::GeneratorExtensions
8
+
9
+ source_root File.expand_path('../templates', __FILE__)
10
+
11
+ def copy_view_files
12
+ available_views.each do |view|
13
+ filename = filename_with_extensions(view)
14
+ template filename, File.join('app/views', controller_file_path, filename)
15
+ end
16
+ end
17
+
18
+ hook_for :form_builder, :as => :scaffold
19
+
20
+ def copy_form_file
21
+ if options[:form_builder].nil?
22
+ filename = filename_with_extensions('_form')
23
+ template filename, File.join('app/views', controller_file_path, filename)
24
+ end
25
+ end
26
+
27
+ protected
28
+
29
+ def available_views
30
+ %w(index show new edit delete)
31
+ end
32
+
33
+ def handler
34
+ :haml
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,6 @@
1
+ = form.error_messages
2
+
3
+ = form.fieldset legend: 'Details' do
4
+ <% attributes.each do |attribute| -%>
5
+ = form.<%= attribute.field_type %> :<%= attribute.name %>
6
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ %h1 Delete <%= human_name.titleize %>
2
+
3
+ = form_for @<%= singular_name %>, method: :delete do |form|
4
+ = form.fieldset legend: 'Confirmation' do
5
+ %p Are you sure you want to delete this <%= human_name.downcase %>?
6
+
7
+ = form.submit 'Delete' do
8
+ or
9
+ = link_to 'cancel', <%= plural_name %>_path
@@ -0,0 +1,9 @@
1
+ %h1 Edit <%= human_name.titleize %>
2
+
3
+ = form_for @<%= singular_name %> do |form|
4
+ = render form
5
+
6
+ .submit
7
+ = form.submit 'Update'
8
+ or
9
+ = link_to 'cancel', <%= plural_name %>_path
@@ -0,0 +1,23 @@
1
+ %h1 <%= human_name.titleize %>
2
+
3
+ %nav= link_to 'New', new_<%= singular_name %>_path
4
+
5
+ %table
6
+ %thead
7
+ %tr
8
+ <% for attribute in attributes -%>
9
+ %th <%= attribute.human_name %>
10
+ <% end -%>
11
+ %th Actions
12
+
13
+ %tbody
14
+ - @<%= plural_name %>.each do |<%= singular_name %>|
15
+ %tr
16
+ <% for attribute in attributes -%>
17
+ %td= <%= singular_name %>.<%= attribute.name %>
18
+ <% end -%>
19
+ %td
20
+ %nav
21
+ = link_to 'Show', <%= singular_name %>
22
+ = link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
23
+ = link_to 'Delete', delete_<%= singular_name %>_path(<%= singular_name %>)
@@ -0,0 +1,9 @@
1
+ %h1 New <%= human_name.titleize %>
2
+
3
+ = form_for @<%= singular_name %> do |form|
4
+ = render form
5
+
6
+ .submit
7
+ = form.submit 'Create'
8
+ or
9
+ = link_to 'cancel', <%= plural_name %>_path
@@ -0,0 +1,13 @@
1
+ %h1 <%= human_name.titleize %>
2
+
3
+ %nav
4
+ = link_to 'Back', <%= plural_name %>_path
5
+ = link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>)
6
+ = link_to 'Delete', delete_<%= singular_name %>_path(@<%= singular_name %>)
7
+
8
+ %dl
9
+ <% attributes.each do |attribute| -%>
10
+ %dt <%= attribute.human_name %>
11
+ %dd= @<%= singular_name %>.<%= attribute.name %>
12
+
13
+ <% end -%>
data/templates/rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/templates/rvmrc ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.2-p290@<%= app_name %>"
8
+
9
+ # Uncomment following line if you want options to be set only for given project.
10
+ #PROJECT_JRUBY_OPTS=( --1.9 )
11
+
12
+ # First we attempt to load the desired environment directly from the environment
13
+ # file. This is very fast and efficient compared to running through the entire
14
+ # CLI and selector. If you want feedback on which environment was used then
15
+ # insert the word 'use' after --create as this triggers verbose mode.
16
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
17
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
18
+ then
19
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
20
+
21
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
22
+ then
23
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
24
+ fi
25
+ else
26
+ # If the environment file has not yet been created, use the RVM CLI to select.
27
+ if ! rvm --create "$environment_id"
28
+ then
29
+ echo "Failed to create RVM environment '${environment_id}'."
30
+ exit 1
31
+ fi
32
+ fi
33
+
34
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
35
+ # it be automatically loaded. Uncomment the following and adjust the filename if
36
+ # necessary.
37
+ #filename=".gems"
38
+ #if [[ -s "$filename" ]] ; then
39
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
40
+ #fi
@@ -0,0 +1,17 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ # Requires supporting files with custom matchers and macros, etc.
8
+ Dir[Rails.root.join('spec/support/**/*.rb')].each { |file| require file }
9
+
10
+ RSpec.configure do |config|
11
+ config.mock_with :rspec
12
+ <% unless options[:skip_active_record] -%>
13
+ config.fixture_path = Rails.root.join('spec', 'fixtures')
14
+ config.use_transactional_fixtures = true
15
+ <% end -%>
16
+ config.infer_base_class_for_anonymous_controllers = false
17
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hightail
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tyler Hunt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-02 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70264621190400 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70264621190400
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &70264621189900 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70264621189900
36
+ description:
37
+ email:
38
+ - tyler@tylerhunt.com
39
+ executables:
40
+ - hightail
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE
47
+ - README.md
48
+ - Rakefile
49
+ - USAGE
50
+ - bin/hightail
51
+ - hightail.gemspec
52
+ - lib/hightail.rb
53
+ - lib/hightail/app_builder.rb
54
+ - lib/hightail/generators/app_generator.rb
55
+ - lib/hightail/version.rb
56
+ - templates/Gemfile
57
+ - templates/README.md
58
+ - templates/app_overrides/assets/stylesheets/application.css
59
+ - templates/app_overrides/assets/stylesheets/common.css.sass
60
+ - templates/app_overrides/assets/stylesheets/form_builder.css.sass
61
+ - templates/app_overrides/assets/stylesheets/layout.css.sass
62
+ - templates/app_overrides/assets/stylesheets/reset.css.sass
63
+ - templates/app_overrides/views/layouts/application.html.haml.tt
64
+ - templates/config.ru
65
+ - templates/config/application.rb
66
+ - templates/config/databases/postgresql.yml
67
+ - templates/config/environments/development.rb.tt
68
+ - templates/config/environments/production.rb.tt
69
+ - templates/config/environments/test.rb.tt
70
+ - templates/config/initializers/backtrace_silencers.rb
71
+ - templates/config/initializers/form_builder.rb.tt
72
+ - templates/config/initializers/haml.rb
73
+ - templates/config/initializers/inflections.rb
74
+ - templates/config/initializers/mime_types.rb
75
+ - templates/config/initializers/secret_token.rb.tt
76
+ - templates/config/initializers/session_store.rb.tt
77
+ - templates/config/initializers/wrap_parameters.rb.tt
78
+ - templates/config/locales/en.yml
79
+ - templates/config/locales/form_builder.en.yml
80
+ - templates/config/routes.rb
81
+ - templates/doc/README_FOR_APP.tt
82
+ - templates/gitignore
83
+ - templates/lib/%app_name%/form_builder.rb.tt
84
+ - templates/lib/generators/haml.rb
85
+ - templates/lib/generators/haml/controller/controller_generator.rb
86
+ - templates/lib/generators/haml/controller/templates/view.html.haml
87
+ - templates/lib/generators/haml/scaffold/scaffold_generator.rb
88
+ - templates/lib/generators/haml/scaffold/templates/_form.html.haml
89
+ - templates/lib/generators/haml/scaffold/templates/delete.html.haml
90
+ - templates/lib/generators/haml/scaffold/templates/edit.html.haml
91
+ - templates/lib/generators/haml/scaffold/templates/index.html.haml
92
+ - templates/lib/generators/haml/scaffold/templates/new.html.haml
93
+ - templates/lib/generators/haml/scaffold/templates/show.html.haml
94
+ - templates/rspec
95
+ - templates/rvmrc
96
+ - templates/spec/spec_helper.rb
97
+ homepage:
98
+ licenses: []
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 1.8.6
118
+ signing_key:
119
+ specification_version: 3
120
+ summary: Bootstraps a pretty looking Rails app in a jiff.
121
+ test_files: []