younker-generators 0.0.2 → 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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 1.0.0
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate layout Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,24 @@
1
+ class LayoutGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+ argument :layout_name, :type => :string, :default => 'application'
4
+ class_option :stylesheet, :type => :boolean, :default => true, :desc => 'Include stylesheet file'
5
+
6
+ # Every pubic method gets called when the generator is run
7
+ def generate_layout
8
+ copy_file "blank-stylesheet.css", "public/stylesheets/#{file_name}.css" if options.stylesheets?
9
+ template "haml-layout.erb", "app/views/layouts/#{file_name}.haml"
10
+ end
11
+
12
+ private
13
+ def file_name
14
+ layout_name.underscore
15
+ end
16
+
17
+ def app_name
18
+ name.humanize
19
+ end
20
+
21
+ def app_class_name
22
+ name.camelize
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ /* update with your css */
@@ -0,0 +1,45 @@
1
+ :ruby
2
+ # YUI Grids : http://developer.yahoo.com/yui/grids/
3
+
4
+ :plain
5
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
6
+ %html
7
+ %head>
8
+ %title= content_for?(:header_title) ? yield(:header_title) : "<%= app_name %> | Welcome!"
9
+
10
+ %link{:rel => 'icon', :type => 'image/png', :href => '/images/favicon.png'}
11
+ %meta{:content => "text/html;charset=UTF-8", "http-equiv" => "content-type"}/
12
+ %meta{'name' => 'keywords', :content => yield(:keywords) }/
13
+ %meta{'name' => 'description', :content => yield(:description) }/
14
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/
15
+
16
+ %link{:rel => :stylesheet, :type => "text/css", :href => "http://yui.yahooapis.com/2.8.1/build/grids/grids-min.css"}
17
+
18
+ = stylesheet_link_tag :all
19
+ = javascript_include_tag :defaults, "<%= file_name %>"
20
+ = csrf_meta_tag
21
+
22
+ :javascript
23
+ var AUTH_TOKEN = encodeURIComponent(#{form_authenticity_token.inspect});
24
+
25
+ %body
26
+ %div#doc4
27
+ %div#hd
28
+ - if user_signed_in?
29
+ = "Signed in as #{current_user.email}. Not you?"
30
+ = link_to "Sign out", destroy_user_session_path
31
+
32
+ - else
33
+ = raw "#{link_to "Sign up", new_user_registration_path} or #{link_to "sign in", new_user_session_path}"
34
+
35
+ %div#bd
36
+ - if content_for?(:page_title)
37
+ = content_tag :div, yield(:page_title), :id => 'page_title'
38
+
39
+ - flash.each do |key, msg|
40
+ = content_tag :div, msg, :class => key
41
+
42
+ = yield
43
+
44
+ %div#ft
45
+ = "<%= app_name %>, 1901-#{Time.now.year}"
@@ -0,0 +1,14 @@
1
+ Description:
2
+ This will copy a default set of files to give functionality that is usually desired across smaller websites I build
3
+
4
+ Example:
5
+ rails generate new_site_files [APP_NAME]
6
+
7
+ This will create:
8
+ - Gemfile
9
+ - config/routes.rb
10
+ - config/application.rb
11
+ - app/helpers/application_helper.rb
12
+ - public/stylesheets/application.css
13
+
14
+
@@ -0,0 +1,29 @@
1
+ class NewSiteFilesGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ class_option :gemfile, :type => :boolean, :default => true, :desc => 'Include Gemfile'
5
+ class_option :app_config, :type => :boolean, :default => true, :desc => 'Include config/application.rb'
6
+ class_option :routes, :type => :boolean, :default => true, :desc => 'Include config/routes.rb'
7
+
8
+ def copy_files
9
+ # copy_file will do a straight copy
10
+ copy_file "Gemfile", "Gemfile" if options.gemfile?
11
+ copy_file "app_helper.rb", "app/helpers/application_helper.rb"
12
+ copy_file "yui-grid-body.css", "public/stylesheets/application.css"
13
+
14
+ # template will allow us to execute erb in the template
15
+ template "haml-application.erb", "app/views/layouts/application.haml"
16
+ template "application.rb", "config/application.rb" if options.app_config?
17
+ template "routes.rb", "config/routes.rb" if options.routes?
18
+ end
19
+
20
+ private
21
+
22
+ def app_name
23
+ name.humanize
24
+ end
25
+
26
+ def app_class_name
27
+ name.camelize
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.0.rc2'
4
+
5
+ gem 'haml'
6
+ gem 'mysql', ">= 2.8.1"
7
+ gem 'mysql2'
8
+ gem 'devise' # http://github.com/plataformatec/devise
9
+ # http://media.railscasts.com/videos/209_introducing_devise.mov
10
+ # http://media.railscasts.com/videos/210_customizing_devise.mov
11
+
12
+ gem 'younker-generators'
13
+
14
+ group :development, :test do
15
+ gem "haml-rails"
16
+ gem 'capistrano'
17
+ end
@@ -0,0 +1,25 @@
1
+ module ApplicationHelper
2
+
3
+ # Add some data inside the HTML header; must have corresponding
4
+ # content_for?(:foo) ? yield(:foo) : 'default' inside layout.
5
+ # Defaults -- :title, :keywords, :description
6
+ # Example
7
+ # header(:title, "Administration Functions")
8
+ def header(name, content)
9
+ case name
10
+ when :title then content_for :header_title do "#{content} : #{company_name}" end
11
+ else content_for name do content end
12
+ end
13
+ end
14
+
15
+ # Page title inside the body at the top of the main content section
16
+ # Example:
17
+ # page_title("Administration Functions")
18
+ def page_title(page_title)
19
+ unless page_title.blank?
20
+ content_for :page_title do
21
+ content_tag(:h1, page_title, :id => 'page_title')
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module <%= app_class_name %>
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ config.autoload_paths += %W(#{config.root}/lib)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+ config.time_zone = 'Pacific Time (US & Canada)'
29
+
30
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
+ # config.i18n.default_locale = :de
33
+
34
+ # JavaScript files you want as :defaults (application.js is always included).
35
+ config.action_view.javascript_expansions[:defaults] = %w(application jquery rails)
36
+ config.action_view.stylesheet_expansions[:defaults] = %w(application)
37
+
38
+ config.generators do |g|
39
+ g.template_engine :haml
40
+ end
41
+
42
+ # Configure the default encoding used in templates for Ruby 1.9.
43
+ config.encoding = "utf-8"
44
+
45
+ # Configure sensitive parameters which will be filtered from the log file.
46
+ config.filter_parameters += [:password]
47
+ end
48
+ end
@@ -0,0 +1,60 @@
1
+ :ruby
2
+ # YUI Grids
3
+ # Grid - http://developer.yahoo.com/yui/3/cssgrids/
4
+ # Base - http://developer.yahoo.com/yui/3/cssbase/
5
+ # Reset - http://developer.yahoo.com/yui/3/cssreset/
6
+
7
+ :plain
8
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
9
+ %html
10
+ %head>
11
+ %title= content_for?(:header_title) ? yield(:header_title) : "<%= app_name %> | Welcome!"
12
+
13
+ -# %link{:rel => 'icon', :type => 'image/png', :href => '/images/favicon.png'}
14
+ %meta{:content => "text/html;charset=UTF-8", "http-equiv" => "content-type"}/
15
+ %meta{'name' => 'keywords', :content => yield(:keywords) }/
16
+ %meta{'name' => 'description', :content => yield(:description) }/
17
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/
18
+
19
+ %link{:rel => :stylesheet, :type => "text/css", :href => "http://yui.yahooapis.com/3.2.0/build/cssgrids/grids-min.css"}
20
+ %link{:rel => :stylesheet, :type => "text/css", :href => "http://yui.yahooapis.com/3.2.0/build/cssbase/base-min.css"}
21
+ %link{:rel => :stylesheet, :type => "text/css", :href => "http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css"}
22
+
23
+ = stylesheet_link_tag :all
24
+ = javascript_include_tag :defaults
25
+ = csrf_meta_tag
26
+
27
+ :javascript
28
+ var AUTH_TOKEN = encodeURIComponent(#{form_authenticity_token.inspect});
29
+
30
+ %body
31
+ %div#hd
32
+ - if user_signed_in?
33
+ = "Signed in as #{current_user.email}. Not you?"
34
+ = link_to "Sign out", destroy_user_session_path
35
+
36
+ - else
37
+ = raw "#{link_to "Sign up", new_user_registration_path} or #{link_to "sign in", new_user_session_path}"
38
+
39
+ %div.yui3-g
40
+ %div.yui3-u-1-5
41
+ %div.content
42
+ left col
43
+
44
+ %div.yui3-u-2-5
45
+ %div.content
46
+ - if content_for?(:page_title)
47
+ = yield(:page_title)
48
+
49
+ - flash.each do |key, msg|
50
+ = content_tag :div, msg, :class => key
51
+
52
+ = yield
53
+
54
+ %div.yui3-u-2-5
55
+ %div.content
56
+ right col
57
+
58
+ %div#ft
59
+ = "<%= app_name %>, 1901-#{Time.now.year}"
60
+
@@ -0,0 +1,3 @@
1
+ <%= app_class_name %>::Application.routes.draw do
2
+ root :to => 'home#welcome'
3
+ end
@@ -0,0 +1,15 @@
1
+ /* http://developer.yahoo.com/yui/3/cssgrids/#page_width */
2
+ body {
3
+ margin: auto;
4
+ width: 970px;
5
+ }
6
+ #hd, .yui3-g .content, #ft {
7
+ border: 5px solid #ccc;
8
+ height: 400px;
9
+ margin-right: 10px; /* gutter between columns */
10
+ }
11
+
12
+ #hd, #ft {
13
+ height: 40px;
14
+ }
15
+ /* end default yui grid layout stuff */
Binary file
@@ -0,0 +1,71 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{younker-generators}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jason Younker"]
12
+ s.date = %q{2010-10-19}
13
+ s.description = "stuff written and used by Jason Younker"
14
+ s.email = %q{jason@28dev.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "layout/USAGE",
27
+ "layout/layout_generator.rb",
28
+ "layout/templates/blank-stylesheet.css",
29
+ "layout/templates/haml-layout.erb",
30
+ "lib/generators/layout/USAGE",
31
+ "lib/generators/layout/layout_generator.rb",
32
+ "lib/generators/layout/templates/blank-stylesheet.css",
33
+ "lib/generators/layout/templates/haml-layout.erb",
34
+ "lib/generators/new_site_files/USAGE",
35
+ "lib/generators/new_site_files/new_site_files_generator.rb",
36
+ "lib/generators/new_site_files/templates/Gemfile",
37
+ "lib/generators/new_site_files/templates/app_helper.rb",
38
+ "lib/generators/new_site_files/templates/application.rb",
39
+ "lib/generators/new_site_files/templates/haml-application.erb",
40
+ "lib/generators/new_site_files/templates/routes.rb",
41
+ "lib/generators/new_site_files/templates/yui-grid-body.css",
42
+ "lib/younker-generators.rb",
43
+ "test/test_helper.rb",
44
+ "test/younker-generators_test.rb",
45
+ "younker-generators-0.0.2.gem",
46
+ "younker-generators.gemspec"
47
+ ]
48
+ s.homepage = %q{http://github.com/younker/younker-generators}
49
+ s.rdoc_options = ["--charset=UTF-8"]
50
+ s.require_paths = ["lib"]
51
+ s.rubygems_version = %q{1.3.7}
52
+ s.summary = %q{Generators for homegrown projects, of little or no use to others}
53
+ s.test_files = [
54
+ "test/test_helper.rb",
55
+ "test/younker-generators_test.rb"
56
+ ]
57
+
58
+ if s.respond_to? :specification_version then
59
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
60
+ s.specification_version = 3
61
+
62
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
63
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
64
+ else
65
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
66
+ end
67
+ else
68
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
69
+ end
70
+ end
71
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: younker-generators
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Younker
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-18 00:00:00 -07:00
18
+ date: 2010-10-19 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: "0"
33
33
  type: :development
34
34
  version_requirements: *id001
35
- description: A few generators I use from time-to-time
35
+ description: stuff written and used by Jason Younker
36
36
  email: jason@28dev.com
37
37
  executables: []
38
38
 
@@ -52,9 +52,23 @@ files:
52
52
  - layout/layout_generator.rb
53
53
  - layout/templates/blank-stylesheet.css
54
54
  - layout/templates/haml-layout.erb
55
+ - lib/generators/layout/USAGE
56
+ - lib/generators/layout/layout_generator.rb
57
+ - lib/generators/layout/templates/blank-stylesheet.css
58
+ - lib/generators/layout/templates/haml-layout.erb
59
+ - lib/generators/new_site_files/USAGE
60
+ - lib/generators/new_site_files/new_site_files_generator.rb
61
+ - lib/generators/new_site_files/templates/Gemfile
62
+ - lib/generators/new_site_files/templates/app_helper.rb
63
+ - lib/generators/new_site_files/templates/application.rb
64
+ - lib/generators/new_site_files/templates/haml-application.erb
65
+ - lib/generators/new_site_files/templates/routes.rb
66
+ - lib/generators/new_site_files/templates/yui-grid-body.css
55
67
  - lib/younker-generators.rb
56
68
  - test/test_helper.rb
57
69
  - test/younker-generators_test.rb
70
+ - younker-generators-0.0.2.gem
71
+ - younker-generators.gemspec
58
72
  has_rdoc: true
59
73
  homepage: http://github.com/younker/younker-generators
60
74
  licenses: []