-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2489ade
commit 16e2dcd
Showing
8 changed files
with
174 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Description: | ||
The sentia_layout generator creates a basic layout and stylesheet. | ||
|
||
The generator takes one argument which will be the name of the | ||
layout and stylesheet files. If no argument is passed then it defaults | ||
to "application". | ||
|
||
Examples: | ||
script/generate sentia_layout | ||
|
||
Layout: app/views/layouts/application.html.haml | ||
Stylesheet: public/stylesheets/sass/application.css | ||
|
||
|
||
script/generate nifty_layout admin | ||
|
||
Layout: app/views/layouts/admin.html.haml | ||
Stylesheet: public/stylesheets/sass/admin.sass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class SentiaLayoutGenerator < Rails::Generator::Base | ||
def initialize(runtime_args, runtime_options = {}) | ||
super | ||
@name = @args.first || 'application' | ||
end | ||
|
||
def manifest | ||
record do |m| | ||
m.directory 'app/views/layouts' | ||
m.directory 'public/stylesheets/sass' | ||
|
||
m.template "layout.html.haml", "app/views/layouts/#{file_name}.html.haml" | ||
m.file "stylesheet.sass", "public/stylesheets/sass/#{file_name}.sass" | ||
end | ||
end | ||
|
||
def file_name | ||
@name.underscore | ||
end | ||
|
||
protected | ||
|
||
def add_options!(opt) | ||
opt.separator '' | ||
opt.separator 'Options:' | ||
opt.on("--haml", "Generate HAML for view, and SASS for stylesheet.") { |v| options[:haml] = v } | ||
end | ||
|
||
def banner | ||
<<-EOS | ||
Creates generic layout and stylesheet files. | ||
USAGE: #{$0} #{spec.name} [layout_name] | ||
EOS | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
!!! Strict | ||
%html{html_attrs} | ||
|
||
%head | ||
%title Untitled | ||
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/ | ||
= stylesheet_link_tag '<%= file_name %>' | ||
%body | ||
#container | ||
- flash.each do |name, msg| | ||
= content_tag :div, msg, :id => "flash_#{name}" | ||
|
||
= yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
!primary_color = #4B7399 | ||
|
||
body | ||
:background-color = !primary_color | ||
:font | ||
:family Verdana, Helvetica, Arial | ||
:size 14px | ||
|
||
a | ||
:color #0000FF | ||
img | ||
:border none | ||
|
||
.clear | ||
:clear both | ||
:height 0 | ||
:overflow hidden | ||
|
||
#container | ||
:width 75% | ||
:margin 0 auto | ||
:background #fff | ||
:padding 20px 40px | ||
:border solid 1px black | ||
:margin-top 20px | ||
|
||
#flash_notice, | ||
#flash_error | ||
:padding 5px 8px | ||
:margin 10px 0 | ||
|
||
#flash_notice | ||
:background-color #CFC | ||
:border solid 1px #6C6 | ||
|
||
#flash_error | ||
:background-color #FCC | ||
:border solid 1px #C66 | ||
|
||
.fieldWithErrors | ||
:display inline | ||
|
||
#errorExplanation | ||
:width 400px | ||
:border 2px solid #CF0000 | ||
:padding 0 | ||
:padding-bottom 12px | ||
:margin-bottom 20px | ||
:background-color #f0f0f0 | ||
h2 | ||
:text-align left | ||
:padding 5px 5px 5px 15px | ||
:margin 0 | ||
:font | ||
:weight bold | ||
:size 12px | ||
:background-color #c00 | ||
:color #fff | ||
p | ||
:color #333 | ||
:margin-bottom 0 | ||
:padding 8px | ||
ul | ||
:margin 2px 24px | ||
li | ||
:font-size 12px | ||
:list-style disc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env ruby | ||
# File: script/console | ||
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' | ||
|
||
libs = " -r irb/completion" | ||
# Perhaps use a console_lib to store any extra methods I may want available in the cosole | ||
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}" | ||
puts "Loading nifty-generators gem" | ||
exec "#{irb} #{libs} --simple-prompt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
begin | ||
require 'rubigen' | ||
rescue LoadError | ||
require 'rubygems' | ||
require 'rubigen' | ||
end | ||
require 'rubigen/scripts/destroy' | ||
|
||
ARGV.shift if ['--help', '-h'].include?(ARGV[0]) | ||
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] | ||
RubiGen::Scripts::Destroy.new.run(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
begin | ||
require 'rubigen' | ||
rescue LoadError | ||
require 'rubygems' | ||
require 'rubigen' | ||
end | ||
require 'rubigen/scripts/generate' | ||
|
||
ARGV.shift if ['--help', '-h'].include?(ARGV[0]) | ||
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] | ||
RubiGen::Scripts::Generate.new.run(ARGV) |