hamgen 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/*CMD ADDED
@@ -0,0 +1,2 @@
1
+ rails new {app} -m ./shawns-rails3-template/init.rb
2
+
data/README.md ADDED
@@ -0,0 +1,227 @@
1
+ # Hampton's Shawn's Rails 3 Generator
2
+ ***
3
+
4
+ ## Requirements
5
+ <table>
6
+ <tr>
7
+ <th>ruby</th>
8
+ <td>&ge; 1.9.2</td>
9
+ </tr>
10
+ <tr>
11
+ <th>rails</th>
12
+ <td>&ge; 3.0.0</td>
13
+ </tr>
14
+ <tr>
15
+ <th>haml</th>
16
+ <td>&ge; 3.0.18</td>
17
+ </tr>
18
+ <tr>
19
+ <th>bundler</th>
20
+ <td>&ge; 0.9.26</td>
21
+ </tr>
22
+ <tr>
23
+ <th>colored</th>
24
+ <td>&ge; 1.2</td>
25
+ </tr>
26
+ </table>
27
+
28
+ ## Getting Started
29
+
30
+ Install the gem with "gem install hamgen" then run "hamgen #{app_name}" which app_name is your app name... duh!
31
+
32
+ Then it builds something *I* like.
33
+
34
+ ## Internet Explorer Support
35
+
36
+ The defaults in this project _do not_ support anything below **IE8**. Instead, using conditional
37
+ comments, all javascript is removed and IE 7 and below are served with the [Universal IE CSS](http://code.google.com/p/universal-ie6-css/)
38
+ stylesheet. The content is readable and accessible in these browsers, but presented with a simpler style.
39
+
40
+ There is also meta information setup in `application.html.haml` to set IE8 to `edge` compatibility and also to check for _Google Chrome Frame_,
41
+ if it exists.
42
+
43
+ ## Sass
44
+
45
+ ### Directory Structure
46
+ * **/sass**
47
+ * \_setup.sass **_(START HERE!)_**
48
+ * application.sass (Where all @imports are linked.)
49
+ * **/lib** (Default libraries. Basically, don't touch these!)
50
+ * \_extend.sass
51
+ * \_mixins.sass
52
+ * \_reset.sass
53
+ * \_variables.sass
54
+ * **/styles** (Place your project-specific Sass in these files.)
55
+ * \_common.sass
56
+ * \_extend.sass
57
+ * \_mixins.sass
58
+ * \_template.sass
59
+ * \_variables.sass
60
+
61
+
62
+ ### Default Variables and Mixins in Sass
63
+
64
+ The following **variables `$`** and **mixins `+`** have been included in the project's Sass `lib` directory.
65
+
66
+ #### Cross-browser Mixins
67
+
68
+ <table>
69
+ <tr>
70
+ <th align="left">name</th>
71
+ <th align="left">function</th>
72
+ </tr>
73
+
74
+ <tr>
75
+ <td>+border-radius(<code>string</code>)</td>
76
+ <td>
77
+ Creates rounded corners that work in modern browsers.
78
+ If you wish to target less than four corners, append the position to the mixin like so:
79
+ <br>
80
+ <code>+border-radius-top-left(10px)</code>
81
+ </td>
82
+ </tr>
83
+
84
+ <tr>
85
+ <td>+box-shadow(<code>string</code>)</td>
86
+ <td>Creates a drop shadow that works in modern browsers.</td>
87
+ </tr>
88
+
89
+ <tr>
90
+ <td>+column-count(<code>string</code>)</td>
91
+ <td>Sets the number of CSS3-style columns.</td>
92
+ </tr>
93
+
94
+ <tr>
95
+ <td>+column-gap(<code>string</code>)</td>
96
+ <td>Sets the size of the gaps between CSS3-style columns.</td>
97
+ </tr>
98
+
99
+ <tr>
100
+ <td>+columns(<code>count string</code>, <code>gap string</code>)</td>
101
+ <td>Sets both column -count and -gap in one mixin.</td>
102
+ </tr>
103
+
104
+ <tr>
105
+ <td>+opacity(<code>integer</code>)</td>
106
+ <td>Sets the opacity of an entire element.</td>
107
+ </tr>
108
+
109
+ <tr>
110
+ <td>+tranform(<code>string</code>)</td>
111
+ <td>Create a CSS3 transformation.</td>
112
+ </tr>
113
+
114
+ <tr>
115
+ <td>+transition(<code>string</code>)</td>
116
+ <td>Create a CSS3 transition.</td>
117
+ </tr>
118
+ </table>
119
+
120
+ #### Font Stack Variables
121
+ <table>
122
+ <tr>
123
+ <th align="left">name</th>
124
+ <th align="left">value</th>
125
+ </tr>
126
+ <tr>
127
+ <td>$geneva</td>
128
+ <td>geneva, tahoma, "dejavu sans condensed", sans-serif</td>
129
+ </tr>
130
+ <tr>
131
+ <td>$helvetica</td>
132
+ <td>"helvetica neue", helvetica, arial, freesans, "liberation sans", "numbus sans l", sans-serif</td>
133
+ </tr>
134
+ <tr>
135
+ <td>$lucida</td>
136
+ <td>"lucida grande", "lucida sans unicode", lucida sans, lucida, sans-serif</td>
137
+ </tr>
138
+ <tr>
139
+ <td>$verdana </td>
140
+ <td>verdana, "bitstream vera sans", "dejavu sans", "liberation sans", geneva, sans-serif</td>
141
+ </tr>
142
+ <tr>
143
+ <td>$georgia </td>
144
+ <td>georgia, "bitstream charter", "century schoolbook l", "liberation serif", times, serif</td>
145
+ </tr>
146
+ <tr>
147
+ <td>$palatino </td>
148
+ <td>palatino, "palatino linotype", palladio, "urw palladio l", "book antiqua", "liberation serif", times, serif</td>
149
+ </tr>
150
+ <tr>
151
+ <td>$times </td>
152
+ <td>times, "times new roman", "nimbus roman no9 l", freeserif, "liberation serif", serif</td>
153
+ </tr>
154
+ <tr>
155
+ <td>$courier </td>
156
+ <td>"courier new", courier, freemono, "nimbus mono l", "liberation mono", monospace</td>
157
+ </tr>
158
+ <tr>
159
+ <td>$monaco </td>
160
+ <td>monaco, "lucida console", "dejavu sans mono", "bitstream vera sans mono", "liberation mono", monospace</td>
161
+ </tr>
162
+ </table>
163
+
164
+ #### Font Size Variables
165
+ <table>
166
+ <tr>
167
+ <th align="left">name</th>
168
+ <th align="left">value</th>
169
+ </tr>
170
+ <tr>
171
+ <td>$x-small</td>
172
+ <td>9px</td>
173
+ </tr>
174
+ <tr>
175
+ <td>$small</td>
176
+ <td>11px</td>
177
+ </tr>
178
+ <tr>
179
+ <td>$medium</td>
180
+ <td>13px</td>
181
+ </tr>
182
+ <tr>
183
+ <td>$x-medium</td>
184
+ <td>17px</td>
185
+ </tr>
186
+ <tr>
187
+ <td>$large</td>
188
+ <td>21px</td>
189
+ </tr>
190
+ <tr>
191
+ <td>$x-large</td>
192
+ <td>34px</td>
193
+ </tr>
194
+ <tr>
195
+ <td>$xx-large</td>
196
+ <td>55px</td>
197
+ </tr>
198
+ <tr>
199
+ <td>$huge</td>
200
+ <td>72px</td>
201
+ </tr>
202
+ <tr>
203
+ <td>$x-huge</td>
204
+ <td>89px</td>
205
+ </tr>
206
+ </table>
207
+
208
+ #### `@extend` Classes
209
+ There are a number of classes contained in `lib/_extend.sass` that can be used in conjunction with the Sass `@extend` function. Please
210
+ see that file for what's included.
211
+
212
+
213
+ <br>
214
+
215
+ #### Sass Syntax
216
+
217
+ I have been using and writing Sass since its original inception. Thus you'll notice I use the original Sass syntax and not the newer SCSS implementation.
218
+
219
+ I am not a fan of the SCSS style and will never be converting this project to it. If you'd prefer the SCSS style of writing your Sass, it should be easy enough to
220
+ fork this project and convert the formatting styles. Check the [SASS Documentation](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html) for more.
221
+
222
+ I also prefer prefixing the `:` to the _start_ of the attribute selector as opposed to the more CSS/SCSS syntax of the colon being the suffix.
223
+ This is just me being set in my ways and, in all honesty, doesn't effect the end-user functionality of the project if you choose to do otherwise.
224
+
225
+ <br><br>
226
+ If you have questions or concerns, feel free to give me a shout at:
227
+ [shawn@yayinternets.com](mailto:shawn@yayinternets.com)
data/REVISION ADDED
@@ -0,0 +1 @@
1
+ (unknown)
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'rake'
2
+ require 'rake/gempackagetask'
3
+
4
+ spec = eval(File.read('hamgen.gemspec'))
5
+ Rake::GemPackageTask.new(spec) do |pkg|
6
+ pkg.gem_spec = spec
7
+ end
8
+
9
+ desc "Build and install local gem"
10
+ task "local" => "repackage" do
11
+ puts "Installing locally... this might take a second"
12
+ puts `gem install pkg/hamgen-#{File.read('VERSION').strip}.gem --no-ri --no-rdoc`
13
+ end
data/SNIPPETS.md ADDED
@@ -0,0 +1,32 @@
1
+ # MISC SNIPPETS
2
+ **Stuff that might be useful to your life?**
3
+
4
+ ## Fibonnaci Sequence -- basis for font sizes
5
+ 1 2 3 5 8 13 21 34 55 89 144
6
+
7
+ ## MOBILE CODE SNIPPETS
8
+
9
+ ### iPhone/iPod Touch/iPad Home screen Icon
10
+ #### 57x57 PNG Image
11
+ - %link{:rel => 'apple-touch-icon', :href => '/'}
12
+
13
+ #### Act like a web app (no back button)
14
+ - %meta{:name => 'apple-mobile-web-app-capable', :content => 'yes'}
15
+
16
+ ### Useful Media Queries
17
+
18
+ #### General Mobile Devices / Small Screen Size
19
+ - @media handheld and (max-width: 480px), screen and (max-device-width: 480px), screen and (max-width: 600px)
20
+
21
+ #### iPhone + iPod Touch Only
22
+ - @media only screen and (max-device-width: 480px)
23
+
24
+ #### iPad Only
25
+ - @media only screen and (min-device-width: 768px) and (max-device-width: 1024px)
26
+
27
+ #### iOS 4 Devices Only
28
+ - @media only screen and (-webkit-min-device-pixel-radio: 2)
29
+
30
+ #### Orientations
31
+ - @media only screen and (orientation: portrait)
32
+ - @media only screen and (orientation: landscape)
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1
data/bin/hamgen ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+ # The command rails generator tool
3
+
4
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../'
5
+
6
+ require 'optparse'
7
+ require 'pp'
8
+
9
+ options = {}
10
+
11
+ optparse = OptionParser.new do|opts|
12
+ # TODO: Put command-line options here
13
+ options[:run_checks] = true
14
+
15
+ opts.banner = %"Usage: hamgen [options] name
16
+
17
+ Description:
18
+ Generate a Rails project just the way ole' Hamptino like them"
19
+
20
+ # This displays the help screen, all programs are
21
+ # assumed to have this option.
22
+ opts.on( '-h', '--help', 'Display this screen' ) do
23
+ puts opts
24
+ exit
25
+ end
26
+
27
+ opts.on( '-f', '--force', 'Run without version checks') do
28
+ options[:run_checks] = false
29
+ end
30
+
31
+ opts.on( '-e', '--erb', 'Generate ERB') do
32
+ puts "hahahahhaa... no. get your own generator!"
33
+ exit
34
+ end
35
+ end
36
+
37
+ # Parse the command-line. Remember there are two forms
38
+ # of the parse method. The 'parse' method simply parses
39
+ # ARGV, while the 'parse!' method parses ARGV and removes
40
+ # any options found there, as well as any parameters for
41
+ # the options. What's left is the list of files to resize.
42
+ optparse.parse!
43
+
44
+ if options[:run_checks]
45
+ unless `rails --version`.include?("Rails 3")
46
+ puts "Must have Rails 3 installed"
47
+ exit
48
+ end
49
+
50
+ unless `ruby --version`.include?("ruby 1.9")
51
+ puts "Must have Ruby 1.9.2"
52
+ exit
53
+ end
54
+ end
55
+
56
+ if ARGV[0].nil?
57
+ puts "You must give the project a name!"
58
+ exit
59
+ end
60
+
61
+ puts `rails new #{ARGV[0]} -m #{File.dirname(__FILE__) + '/../init.rb'}`
data/hamgen.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ HAML_GEMSPEC = Gem::Specification.new do |s|
5
+ s.name = 'hamgen'
6
+ s.rubyforge_project = 'hamgen'
7
+ s.summary = "Hampton's preferred Rails 3.0 generator based off Shawn Allison's work"
8
+ s.version = File.read('VERSION').strip
9
+ s.authors = ['Hampton Catlin']
10
+ s.email = 'hampton@hamptoncatlin.com'
11
+ s.description = <<-END
12
+ A Rails 3.0 generator (like for the whole project) that pre-generates
13
+ a bunch of shit I like. Most of it is stolen directly from Shawn's Rails Template
14
+ at http://github.com/shawn/shawns-rails3-template but with changes just for ole' me
15
+ END
16
+
17
+ s.add_runtime_dependency('colored', ['~> 1.2'])
18
+ s.add_runtime_dependency('rails', ['~> 3.0.0'])
19
+ s.add_runtime_dependency('haml', ['~> 3.0.18'])
20
+
21
+ s.add_development_dependency('rake', ['~> 0.8.7'])
22
+
23
+ s.executables = ['hamgen']
24
+ s.files = Dir['**/**'].to_a.select { |f| f[0..2] != "pkg"}
25
+ s.homepage = 'http://www.hamptoncatlin.com/'
26
+ end
data/init.rb ADDED
@@ -0,0 +1,84 @@
1
+
2
+
3
+ # REQUIRED GEMS
4
+ require "colored"
5
+ require "rails"
6
+ require "haml"
7
+ require "bundler"
8
+
9
+ @path = "#{File.dirname(__FILE__)}/templates/"
10
+
11
+ # START THIS THING
12
+ puts "\n========================================================="
13
+ puts " HAMPTON'S SHAWN'S RAILS 3 TEMPLATE - [#{File.read(@path + '../VERSION').strip}] ".yellow.bold
14
+ puts "=========================================================\n\n"
15
+
16
+ # REMOVE FILES
17
+ puts "---------------------------------------------------------"
18
+ puts " Removing useless junk ... ".red
19
+ puts "---------------------------------------------------------"
20
+ run "rm README"
21
+ run "rm public/index.html"
22
+ run "rm public/favicon.ico"
23
+ run "rm public/robots.txt"
24
+ run "rm -r public/images"
25
+ run "rm -f public/javascripts/*"
26
+ run "rm app/views/layouts/application.html.erb"
27
+ puts "---------------------------------------------------------"
28
+
29
+ # ADD FILES
30
+ puts " Adding useful junk ... ".green
31
+ puts "---------------------------------------------------------"
32
+ run "cp #{@path}application.html.haml app/views/layouts"
33
+ run "mkdir public/images"
34
+ run "mkdir public/images/backgrounds"
35
+ run "mkdir public/images/sprites"
36
+ puts "---------------------------------------------------------"
37
+
38
+ # GIT INIT
39
+ puts " Initializing new Git repo ...".cyan
40
+ puts "---------------------------------------------------------"
41
+ run "rm .gitignore"
42
+ run "touch .gitignore"
43
+ run "cat #{@path}gitignore >> .gitignore"
44
+ git :init
45
+ git :add => "."
46
+ puts "---------------------------------------------------------"
47
+
48
+ # JAVASCRIPT
49
+ puts " Adding Javascript files ...".green
50
+ puts "---------------------------------------------------------"
51
+ run "cp #{@path}javascripts/application.js public/javascripts"
52
+ run "cp #{@path}javascripts/rails.js public/javascripts"
53
+ puts "---------------------------------------------------------"
54
+
55
+ # SASS
56
+ puts " Installing Sass directory, files and environment preferences ...".green
57
+ puts "---------------------------------------------------------"
58
+ run "cp -r #{@path}sass app/"
59
+ run "cp #{@path}plugins.rb config/initializers/"
60
+ run "cat #{@path}environment.rb >> config/environment.rb"
61
+ Dir["app/sass/**/*.sass"].each do |file|
62
+ run "sass-convert -T sass -F sass -i #{file}"
63
+ end
64
+ puts "---------------------------------------------------------"
65
+
66
+ # GEMFILE
67
+ puts " Appending Gemfile and running Bundler ...".magenta
68
+ puts "---------------------------------------------------------"
69
+ run "cat #{@path}Gemfile > Gemfile"
70
+ puts " Running Bundler install. This could take a moment ...".yellow
71
+ run "bundle install"
72
+ puts " Bundled gems installed successfully!".green.bold
73
+ puts "---------------------------------------------------------"
74
+
75
+ # GIT COMMIT
76
+ puts " Creating initial Git commit ...".cyan
77
+ puts "---------------------------------------------------------"
78
+ git :add => "."
79
+ git :commit => "-am 'Initial commit.'"
80
+
81
+ # DONE!
82
+ puts "\n========================================================="
83
+ puts " INSTALLATION COMPLETE!".yellow.bold
84
+ puts "=========================================================\n\n\n"
data/templates/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://gemcutter.org"
2
+
3
+ gem "rails", "~> 3.0.0"
4
+ gem "haml", "~> 3.0.18"
5
+ gem "carrierwave", :git => "git://github.com/jnicklas/carrierwave.git"
6
+ gem "bluecloth", ">= 2.0.7"
7
+ gem "sqlite3-ruby", "~> 1.3.1", :require => "sqlite3"
8
+ gem "will_paginate", "~> 3.0.pre2"
@@ -0,0 +1,28 @@
1
+ !!!
2
+ %html{:lang => 'en'}
3
+ %head
4
+ %title #{@title}
5
+ %meta{:charset => 'utf-8'}
6
+ %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
7
+ %meta{:name => 'viewport', :content => 'width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0'}
8
+ = csrf_meta_tag
9
+ <!--[if ! lte IE 7]><!-->
10
+ %link{:rel => 'stylesheet', :href => '/stylesheets/application.css'}
11
+ <!--<![endif]-->
12
+ /[if lte IE 7]
13
+ %link{:rel => 'stylesheet', :href => 'http://universal-ie6-css.googlecode.com/files/ie6.0.3.css'}
14
+ /[if IE]
15
+ %script{:src => 'http://html5shiv.googlecode.com/svn/trunk/html5.js'}
16
+
17
+ %body{:class => page_class}
18
+ = yield
19
+
20
+ <!--[if ! lte IE 7]><!-->
21
+ %script{:src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'}
22
+ %script{:src => '/javascripts/application.js'}
23
+ <!--<![endif]-->
24
+ /[if lte IE 8]
25
+ //%script{:src => 'http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js'}
26
+
27
+ / Google Analytics | Don't forget to include your tracking number!!!!
28
+ %script var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);})();
@@ -0,0 +1,13 @@
1
+ # put rails errors inline on the tags themselves
2
+ ActionView::Base.field_error_proc = (
3
+ Proc.new do |html_tag, instance|
4
+ class_name = "error"
5
+ d = HTML::Document.new(html_tag)
6
+ tag = d.root.children.first
7
+ if tag.attributes.has_key?('class')
8
+ tag.attributes["class"] += " #{class_name}"
9
+ else
10
+ tag.attributes["class"] = class_name
11
+ end
12
+ tag.to_s.html_safe
13
+ end)
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ .bundle
3
+ log/*.log
4
+ tmp/**/*
5
+ db/*.sqlite3
6
+ Gemfile.lock
@@ -0,0 +1,7 @@
1
+ // jQuery Browser Plugin | Version 2.3 | http://jquery.thewikies.com/browser
2
+ (function($){$.browserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i<h.length;i=i+1){r=r.replace(h[i][0],h[i][1]);}return r;},c=function(i,a,b,c){var r={name:m((a.exec(i)||[u,u])[1],b)};r[r.name]=true;r.version=(c.exec(i)||[x,x,x,x])[3];if(r.name.match(/safari/)&&r.version>400){r.version='2.0';}if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';}r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);
3
+
4
+ $(document).ready(function(){
5
+
6
+
7
+ });
@@ -0,0 +1 @@
1
+ jQuery(function($){var csrf_token=$('meta[name=csrf-token]').attr('content'),csrf_param=$('meta[name=csrf-param]').attr('content');$.fn.extend({triggerAndReturn:function(name,data){var event=new $.Event(name);this.trigger(event,data);return event.result!==false},callRemote:function(){var el=this,data=el.is('form')?el.serializeArray():[],method=el.attr('method')||el.attr('data-method')||'GET',url=el.attr('action')||el.attr('href');if(url===undefined){throw"No URL specified for remote call (action or href must be present).";}else{if(el.triggerAndReturn('ajax:before')){$.ajax({url:url,data:data,dataType:'script',type:method.toUpperCase(),beforeSend:function(xhr){el.trigger('ajax:loading',xhr)},success:function(data,status,xhr){el.trigger('ajax:success',[data,status,xhr])},complete:function(xhr){el.trigger('ajax:complete',xhr)},error:function(xhr,status,error){el.trigger('ajax:failure',[xhr,status,error])}})}el.trigger('ajax:after')}}});$('a[data-confirm],input[data-confirm]').live('click',function(){var el=$(this);if(el.triggerAndReturn('confirm')){if(!confirm(el.attr('data-confirm'))){return false}}});$('form[data-remote]').live('submit',function(e){$(this).callRemote();e.preventDefault()});$('a[data-remote],input[data-remote]').live('click',function(e){$(this).callRemote();e.preventDefault()});$('a[data-method]:not([data-remote])').live('click',function(e){var link=$(this),href=link.attr('href'),method=link.attr('data-method'),form=$('<form method="post" action="'+href+'">'),metadata_input='<input name="_method" value="'+method+'" type="hidden" />';if(csrf_param!=null&&csrf_token!=null){metadata_input+='<input name="'+csrf_param+'" value="'+csrf_token+'" type="hidden" />'}form.hide().append(metadata_input).appendTo('body');e.preventDefault();form.submit()});var disable_with_input_selector='input[data-disable-with]';var disable_with_form_selector='form[data-remote]:has('+disable_with_input_selector+')';$(disable_with_form_selector).live('ajax:before',function(){$(this).find(disable_with_input_selector).each(function(){var input=$(this);input.data('enable-with',input.val()).attr('value',input.attr('data-disable-with')).attr('disabled','disabled')})});$(disable_with_form_selector).live('ajax:after',function(){$(this).find(disable_with_input_selector).each(function(){var input=$(this);input.removeAttr('disabled').val(input.data('enable-with'))})})});
@@ -0,0 +1,10 @@
1
+ Haml::Template.options[:attr_wrapper] = '"'
2
+ if Rails.env == "development"
3
+ Sass::Plugin.options[:line_numbers] = true
4
+ Sass::Plugin.options[:style] = :nested
5
+ else
6
+ Sass::Plugin.options[:style] = :compressed
7
+ end
8
+ Sass::Plugin.options[:syntax] = :scss
9
+ Sass::Plugin.options[:template_location] = (Rails.root + 'app' + 'sass').to_s
10
+ Sass::Plugin.options[:css_location] = (Rails.root + 'public' + 'stylesheets').to_s
@@ -0,0 +1,12 @@
1
+ // setup.sass | BOOTSTRAP YOUR PROJECT
2
+
3
+ // Default Body Styles
4
+ $background: white
5
+ $font-family: $helvetica
6
+ $font-size: $medium
7
+ $colour: darken(white, 93%)
8
+
9
+ // Default link colours/styles
10
+ $link_colour: blue
11
+ $hover_colour: purple
12
+ $active_colour: red
@@ -0,0 +1,15 @@
1
+ // DEFAULT LIBRARIES
2
+ @import lib/mixins
3
+ @import lib/variables
4
+ @import styles/variables
5
+ @import setup
6
+ @import lib/reset
7
+ @import lib/extend
8
+
9
+ // DEFAULT BASE STYLES
10
+ @import styles/extend
11
+ @import styles/mixins
12
+ @import styles/common
13
+ @import styles/template
14
+
15
+
@@ -0,0 +1,87 @@
1
+ // extend.sass | LIBRARY @EXTEND CLASSES
2
+
3
+ // Clearing Floats
4
+ ----------------------------------------------
5
+ .clear => For non-floating element immediately below a floating element.
6
+
7
+ .clearfix => For floating children inside a parent.
8
+ Class goes on parent holding floating children.
9
+
10
+ // Use all of these classes with the @extend option
11
+ .zoom
12
+ :zoom 1
13
+
14
+ .left
15
+ :float left
16
+
17
+ .right
18
+ :float right
19
+
20
+ .block
21
+ :display block
22
+
23
+ .absolute
24
+ :position absolute
25
+
26
+ .relative
27
+ :position relative
28
+
29
+ .center
30
+ :text-align center
31
+
32
+ .hidden
33
+ :overflow hidden
34
+
35
+ .bold
36
+ :font-weight bold
37
+
38
+ .clear
39
+ :clear both
40
+
41
+ .clearfix:after
42
+ @extend .clear
43
+ @extend .block
44
+ :content ""
45
+
46
+ // Replacing text with a background image
47
+ .hide-text, .h
48
+ @extend .block
49
+ @extend .hidden
50
+ :font-size 0
51
+ :text-indent -9999em
52
+ :white-space nowrap
53
+ :.text-transform capitalize
54
+
55
+ // Reset some basic styling
56
+ .reset, .r
57
+ :border 0
58
+ :margin 0
59
+ :padding 0
60
+
61
+ // Consolidate fonts. Works with font $variables in lib/variables.
62
+ .font_x-small
63
+ :font-size $x-small
64
+
65
+ .font_small
66
+ :font-size $small
67
+
68
+ .font_medium
69
+ :font-size $medium
70
+
71
+ .font_x-medium
72
+ :font-size $x-medium
73
+
74
+ .font_large
75
+ :font-size $large
76
+
77
+ .font_x-large
78
+ :font-size $x-large
79
+
80
+ .font_xx-large
81
+ :font-size $xx-large
82
+
83
+ .font_huge
84
+ :font-size $huge
85
+
86
+ .font_x-huge
87
+ :font-size $x-huge
@@ -0,0 +1,78 @@
1
+ // mixins.sass | LIBRARY MIX-INS
2
+
3
+ // Quickly outline any tag for debug purposes
4
+ =o
5
+ :background rgba(255, 0, 0, 0.15) !important
6
+ :outline 1px solid red !important
7
+
8
+ // Cross browser box model resizing
9
+ =box-sizing( $box-sizing)
10
+ :-moz-box-sizing $box-sizing
11
+ :-webkit-box-sizing $box-sizing
12
+ :box-sizing $box-sizing
13
+
14
+ // Cross browser opacity
15
+ =opacity( $opacity)
16
+ :-ms-filter unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=") + $opacity + unquote(")")
17
+ :filter unquote("alpha(opacity=") + $opacity + unquote(")")
18
+ :opacity $opacity * 0.01
19
+
20
+ // Cross browser transition effect
21
+ =transition( $transition)
22
+ :-moz-transition $transition
23
+ :-o-transition $transition
24
+ :-webkit-transition $transition
25
+ :transition $transition
26
+
27
+ // Cross browser transform effect
28
+ =transform( $transform)
29
+ :-moz-transform $transform
30
+ :-o-transform $transform
31
+ :-webkit-transform $transform
32
+ :transform $transform
33
+
34
+ // Cross browser multi-column layout
35
+ // # of columns
36
+ =column-count( $count)
37
+ :-moz-column-count $count
38
+ :-webkit-column-count $count
39
+ :column-count $count
40
+ // Space between columns
41
+ =column-gap( $gap)
42
+ :-moz-column-gap $gap
43
+ :-webkit-column-gap $gap
44
+ :column-gap $gap
45
+ // Combine -count and -gap into one easy mixin
46
+ =columns( $count, $gap)
47
+ +column-count( $count)
48
+ +column-gap( $gap)
49
+
50
+ // Cross browser box shadow
51
+ // If you want to have multiple box shadows, you must enclose the values in quotes (" ").
52
+ =box-shadow( $shadow)
53
+ $shadow: unquote($shadow)
54
+ :-moz-box-shadow $shadow
55
+ :-webkit-box-shadow $shadow
56
+ :box-shadow $shadow
57
+
58
+ // Cross browser rounded corners
59
+ =border-radius( $radius)
60
+ :-moz-border-radius $radius
61
+ :-webkit-border-radius $radius
62
+ :border-radius $radius
63
+ =border-radius-top-left( $radius)
64
+ :-moz-border-radius-topleft $radius
65
+ :-webkit-border-top-left-radius $radius
66
+ :border-top-left-radius $radius
67
+ =border-radius-top-right( $radius)
68
+ :-moz-border-radius-topright $radius
69
+ :-webkit-border-top-right-radius $radius
70
+ :border-top-right-radius $radius
71
+ =border-radius-bottom-right( $radius)
72
+ :-moz-border-radius-bottomright $radius
73
+ :-webkit-border-bottom-right-radius $radius
74
+ :border-bottom-right-radius $radius
75
+ =border-radius-bottom-left( $radius)
76
+ :-moz-border-radius-bottomleft $radius
77
+ :-webkit-border-bottom-left-radius $radius
78
+ :border-bottom-left-radius $radius
@@ -0,0 +1,150 @@
1
+ // reset.sass | LIBRARY HTML TAG RESET
2
+
3
+ // Hard Tag Reset
4
+ a, article, aside, blockquote, body, button, dd, dl, dt, fieldset, figure, footer,
5
+ h1, h2, h3, h4, h5, h6, header, hgroup, html, img, input, label, legend, li, menu,
6
+ nav, ol, p, section, select, small, table, textarea, td, th, tr, ul
7
+ :font
8
+ :size 100%
9
+ :style normal
10
+ :weight normal
11
+ :line-height 1
12
+ :margin 0
13
+ :padding 0
14
+ :vertical-align baseline
15
+
16
+ // Setting Blocks
17
+ article, aside, figure, footer, header, hgroup, img, label, menu, nav, section
18
+ @extend .block
19
+
20
+ // Typography
21
+ h1, h2, h3, h4, h5, h6, p, table, li, fieldset
22
+ :margin-bottom $font-size
23
+
24
+ p
25
+ :line-height $font-size * 1.55
26
+
27
+ // <body> Reset
28
+ body, textarea, input, option, select, button
29
+ :font-family $font-family
30
+
31
+ body
32
+ :-webkit-text-stroke 1px transparent
33
+ :background $background
34
+ :font-size $font-size
35
+ :text-rendering optimizeLegibility
36
+
37
+ body, legend
38
+ :color $colour
39
+
40
+ // Links
41
+ a, abbr[title]
42
+ :padding-bottom 1px
43
+
44
+ a
45
+ :border-bottom 1px solid
46
+ :color $link_colour
47
+ :outline 0
48
+ :text-decoration none
49
+ &:hover
50
+ :color $hover_colour
51
+ &:hover, &:focus
52
+ :border-bottom 0
53
+ &:active
54
+ :color $active_colour
55
+ img
56
+ :border 0
57
+
58
+ // Tables + Forms
59
+ table
60
+ :border
61
+ :collapse collapse
62
+ :spacing 0
63
+ :width 100%
64
+
65
+ caption, legend, td, th
66
+ :text-align left
67
+
68
+ td, th, input, select
69
+ :vertical-align middle
70
+
71
+ fieldset, input[type="checkbox"], input[type="radio"]
72
+ :border 0
73
+
74
+ button, input[type="checkbox"], input[type="radio"], input[type="submit"], select
75
+ :cursor pointer
76
+
77
+ input[type="checkbox"] + label, input[type="radio"] + label
78
+ :display inline-block
79
+ :vertical-align -1px
80
+ :.vertical-align baseline
81
+
82
+ button
83
+ :.vertical-align middle
84
+ &::-moz-focus-inner
85
+ :border 0
86
+
87
+ input
88
+ &[type="submit"], &[type="button"]
89
+ :.padding 2px 0 0
90
+
91
+ legend
92
+ :.margin-left -6px
93
+
94
+ textarea
95
+ +box-sizing( border-box)
96
+ :overflow auto
97
+ :resize none
98
+
99
+ // Misc
100
+ abbr[title]
101
+ :border-bottom 1px dotted
102
+ :cursor help
103
+
104
+ ul, ol
105
+ :list-style none
106
+
107
+ // Be nice to IE...
108
+ a, div, li, li a
109
+ @extend .zoom
110
+
111
+ img
112
+ :-ms-interpolation-mode bicubic
113
+
114
+ // Modern Mobile Devices
115
+ @media only screen and (max-device-width: 480px), only screen and (min-device-width: 768px) and (max-device-width: 1024px)
116
+ *
117
+ :-webkit-box-shadow none !important
118
+ :text-shadow none !important
119
+
120
+ html
121
+ :-ms-text-size-adjust none
122
+ :-webkit
123
+ :text-size-adjust none
124
+ :touch-callout none
125
+ :user-select none
126
+
127
+ body
128
+ :-webkit-text-stroke 0 black
129
+
130
+ a
131
+ :-webkit-tap-highlight-color rgba(0,0,0,0)
132
+
133
+ // Printing
134
+ @media print
135
+ body
136
+ :color black !important
137
+ :background white !important
138
+ :font-size 12pt !important
139
+
140
+ a:after, abbr[title]:after
141
+ :font-size 75%
142
+
143
+ a:after
144
+ :content " (" attr(href) ") "
145
+
146
+ abbr[title]
147
+ :border 0
148
+ &:after
149
+ :content " (" attr(title) ") "
150
+
@@ -0,0 +1,26 @@
1
+ // variables.sass | LIBRARY VARIABLES
2
+
3
+ // FONT STACKS
4
+ // Sans Serif
5
+ $geneva: geneva, tahoma, "dejavu sans condensed", sans-serif
6
+ $helvetica: "helvetica neue", helvetica, arial, freesans, "liberation sans", "numbus sans l", sans-serif
7
+ $lucida: "lucida grande", "lucida sans unicode", "lucida sans", lucida, sans-serif
8
+ $verdana: verdana, "bitstream vera sans", "dejavu sans", "liberation sans", geneva, sans-serif
9
+ // Serif
10
+ $georgia: georgia, "bitstream charter", "century schoolbook l", "liberation serif", times, serif
11
+ $palatino: "palatino linotype", palatino, palladio, "urw palladio l", "book antiqua", "liberation serif", times, serif
12
+ $times: times, "times new roman", "nimbus roman no9 l", freeserif, "liberation serif", serif
13
+ // Monospace
14
+ $courier: "courier new", courier, freemono, "nimbus mono l", "liberation mono", monospace
15
+ $monaco: monaco, "lucida console", "dejavu sans mono", "bitstream vera sans mono", "liberation mono", monospace
16
+
17
+ // FONT SIZES
18
+ $x-small: 9px
19
+ $small: 11px
20
+ $medium: 13px
21
+ $x-medium: 17px
22
+ $large: 21px
23
+ $x-large: 34px
24
+ $xx-large: 55px
25
+ $huge: 72px
26
+ $x-huge: 89px
@@ -0,0 +1 @@
1
+ // common.sass -- project-specific .classes
@@ -0,0 +1 @@
1
+ // extend.sass -- project-specific @extend .classes
@@ -0,0 +1 @@
1
+ // mixins.sass -- project-specific +mixins
@@ -0,0 +1 @@
1
+ // template.sass -- project-specific layout #ids
@@ -0,0 +1 @@
1
+ // variables.sass -- project-specific $variables
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'colored'
4
+ require 'fileutils'
5
+
6
+ class HamgenTest < Test::Unit::TestCase
7
+ def initialize(arg)
8
+ @path = File.dirname(__FILE__) + '/../'
9
+ @exec = @path + "bin/hamgen"
10
+ @app_name = "test_app"
11
+ @app_path = @path + "test_app"
12
+ super(arg)
13
+ end
14
+
15
+ def test_has_rvm_setup
16
+ list = `rvm list`
17
+ assert list.include?("ruby-1.8.7"), "Need rvm with 1.8.7 installed to run tests"
18
+ assert list.include?("ruby-1.9.2"), "Need rvm with 1.9.2 installed to run tests"
19
+ end
20
+
21
+ def test_runs_generator
22
+ result = build
23
+ assert !result.include?("Error"), "Threw an error"
24
+ end
25
+
26
+ def build(options = "")
27
+ `#{@exec} #{options} test_app`
28
+ end
29
+
30
+ def teardown
31
+ FileUtils.rm_rf(@app_path)
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hamgen
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ version: "0.1"
9
+ platform: ruby
10
+ authors:
11
+ - Hampton Catlin
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-10-12 00:00:00 +01:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: colored
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ version: "1.2"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rails
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 3
43
+ - 0
44
+ - 0
45
+ version: 3.0.0
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: haml
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 3
58
+ - 0
59
+ - 18
60
+ version: 3.0.18
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: rake
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ - 8
74
+ - 7
75
+ version: 0.8.7
76
+ type: :development
77
+ version_requirements: *id004
78
+ description: " A Rails 3.0 generator (like for the whole project) that pre-generates\n a bunch of shit I like. Most of it is stolen directly from Shawn's Rails Template\n at http://github.com/shawn/shawns-rails3-template but with changes just for ole' me\n"
79
+ email: hampton@hamptoncatlin.com
80
+ executables:
81
+ - hamgen
82
+ extensions: []
83
+
84
+ extra_rdoc_files: []
85
+
86
+ files:
87
+ - "*CMD"
88
+ - bin/hamgen
89
+ - hamgen.gemspec
90
+ - init.rb
91
+ - Rakefile
92
+ - README.md
93
+ - REVISION
94
+ - SNIPPETS.md
95
+ - templates/application.html.haml
96
+ - templates/environment.rb
97
+ - templates/Gemfile
98
+ - templates/gitignore
99
+ - templates/javascripts/application.js
100
+ - templates/javascripts/rails.js
101
+ - templates/plugins.rb
102
+ - templates/sass/_setup.sass
103
+ - templates/sass/application.sass
104
+ - templates/sass/lib/_extend.sass
105
+ - templates/sass/lib/_mixins.sass
106
+ - templates/sass/lib/_reset.sass
107
+ - templates/sass/lib/_variables.sass
108
+ - templates/sass/styles/_common.sass
109
+ - templates/sass/styles/_extend.sass
110
+ - templates/sass/styles/_mixins.sass
111
+ - templates/sass/styles/_template.sass
112
+ - templates/sass/styles/_variables.sass
113
+ - test/hamgen_test.rb
114
+ - VERSION
115
+ has_rdoc: true
116
+ homepage: http://www.hamptoncatlin.com/
117
+ licenses: []
118
+
119
+ post_install_message:
120
+ rdoc_options: []
121
+
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ none: false
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ segments:
138
+ - 0
139
+ version: "0"
140
+ requirements: []
141
+
142
+ rubyforge_project: hamgen
143
+ rubygems_version: 1.3.7
144
+ signing_key:
145
+ specification_version: 3
146
+ summary: Hampton's preferred Rails 3.0 generator based off Shawn Allison's work
147
+ test_files: []
148
+