ricogen 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,234 @@
1
+ # Hampton's Shawn's Rails 3 Generator
2
+
3
+ This is a fork of Shawn's Rails 3 Templates. Shawn is the greatest front-end coder I've ever known.
4
+ Flat out. And, this combines his default setup and some of my own personal preferences. This is basically
5
+ a simple Rails project generator that gives you a good simple place to start.
6
+
7
+ The philosophy is not to install everything ever. I'm trying to keep the original stack thin.
8
+
9
+ Also, the other philosophy is that I built this for me. Not for you. You are welcome to use it,
10
+ but no bitching about what you prefer. Feel free to fork this to your black little heart's content.
11
+
12
+ ***
13
+
14
+ ## Requirements
15
+ <table>
16
+ <tr>
17
+ <th>ruby</th>
18
+ <td>&ge; 1.9.2</td>
19
+ </tr>
20
+ <tr>
21
+ <th>rails</th>
22
+ <td>&ge; 3.0.0</td>
23
+ </tr>
24
+ <tr>
25
+ <th>haml</th>
26
+ <td>&ge; 3.0.18</td>
27
+ </tr>
28
+ <tr>
29
+ <th>bundler</th>
30
+ <td>&ge; 0.9.26</td>
31
+ </tr>
32
+ <tr>
33
+ <th>colored</th>
34
+ <td>&ge; 1.2</td>
35
+ </tr>
36
+ </table>
37
+
38
+ ## Getting Started
39
+
40
+ Install the gem with "gem install ricogen" then run "ricogen #{app_name}" which app_name is your app name... duh!
41
+
42
+ Then it builds something *I* like.
43
+
44
+ ## Internet Explorer Support
45
+
46
+ The defaults in this project _do not_ support anything below **IE8**. Instead, using conditional
47
+ 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/)
48
+ stylesheet. The content is readable and accessible in these browsers, but presented with a simpler style.
49
+
50
+ There is also meta information setup in `application.html.haml` to set IE8 to `edge` compatibility and also to check for _Google Chrome Frame_,
51
+ if it exists.
52
+
53
+ ## Sass
54
+
55
+ ### Directory Structure
56
+ * **/sass**
57
+ * \_setup.sass **_(START HERE!)_**
58
+ * application.sass (Where all @imports are linked.)
59
+ * **/lib** (Default libraries. Basically, don't touch these!)
60
+ * \_extend.sass
61
+ * \_mixins.sass
62
+ * \_reset.sass
63
+ * \_variables.sass
64
+ * **/styles** (Place your project-specific Sass in these files.)
65
+ * \_common.sass
66
+ * \_extend.sass
67
+ * \_mixins.sass
68
+ * \_template.sass
69
+ * \_variables.sass
70
+
71
+
72
+ ### Default Variables and Mixins in Sass
73
+
74
+ The following **variables `$`** and **mixins `+`** have been included in the project's Sass `lib` directory.
75
+
76
+ #### Cross-browser Mixins
77
+
78
+ <table>
79
+ <tr>
80
+ <th align="left">name</th>
81
+ <th align="left">function</th>
82
+ </tr>
83
+
84
+ <tr>
85
+ <td>+border-radius(<code>string</code>)</td>
86
+ <td>
87
+ Creates rounded corners that work in modern browsers.
88
+ If you wish to target less than four corners, append the position to the mixin like so:
89
+ <br>
90
+ <code>+border-radius-top-left(10px)</code>
91
+ </td>
92
+ </tr>
93
+
94
+ <tr>
95
+ <td>+box-shadow(<code>string</code>)</td>
96
+ <td>Creates a drop shadow that works in modern browsers.</td>
97
+ </tr>
98
+
99
+ <tr>
100
+ <td>+column-count(<code>string</code>)</td>
101
+ <td>Sets the number of CSS3-style columns.</td>
102
+ </tr>
103
+
104
+ <tr>
105
+ <td>+column-gap(<code>string</code>)</td>
106
+ <td>Sets the size of the gaps between CSS3-style columns.</td>
107
+ </tr>
108
+
109
+ <tr>
110
+ <td>+columns(<code>count string</code>, <code>gap string</code>)</td>
111
+ <td>Sets both column -count and -gap in one mixin.</td>
112
+ </tr>
113
+
114
+ <tr>
115
+ <td>+opacity(<code>integer</code>)</td>
116
+ <td>Sets the opacity of an entire element.</td>
117
+ </tr>
118
+
119
+ <tr>
120
+ <td>+tranform(<code>string</code>)</td>
121
+ <td>Create a CSS3 transformation.</td>
122
+ </tr>
123
+
124
+ <tr>
125
+ <td>+transition(<code>string</code>)</td>
126
+ <td>Create a CSS3 transition.</td>
127
+ </tr>
128
+ </table>
129
+
130
+ #### Font Stack Variables
131
+ <table>
132
+ <tr>
133
+ <th align="left">name</th>
134
+ <th align="left">value</th>
135
+ </tr>
136
+ <tr>
137
+ <td>$geneva</td>
138
+ <td>geneva, tahoma, "dejavu sans condensed", sans-serif</td>
139
+ </tr>
140
+ <tr>
141
+ <td>$helvetica</td>
142
+ <td>"helvetica neue", helvetica, arial, freesans, "liberation sans", "numbus sans l", sans-serif</td>
143
+ </tr>
144
+ <tr>
145
+ <td>$lucida</td>
146
+ <td>"lucida grande", "lucida sans unicode", lucida sans, lucida, sans-serif</td>
147
+ </tr>
148
+ <tr>
149
+ <td>$verdana </td>
150
+ <td>verdana, "bitstream vera sans", "dejavu sans", "liberation sans", geneva, sans-serif</td>
151
+ </tr>
152
+ <tr>
153
+ <td>$georgia </td>
154
+ <td>georgia, "bitstream charter", "century schoolbook l", "liberation serif", times, serif</td>
155
+ </tr>
156
+ <tr>
157
+ <td>$palatino </td>
158
+ <td>palatino, "palatino linotype", palladio, "urw palladio l", "book antiqua", "liberation serif", times, serif</td>
159
+ </tr>
160
+ <tr>
161
+ <td>$times </td>
162
+ <td>times, "times new roman", "nimbus roman no9 l", freeserif, "liberation serif", serif</td>
163
+ </tr>
164
+ <tr>
165
+ <td>$courier </td>
166
+ <td>"courier new", courier, freemono, "nimbus mono l", "liberation mono", monospace</td>
167
+ </tr>
168
+ <tr>
169
+ <td>$monaco </td>
170
+ <td>monaco, "lucida console", "dejavu sans mono", "bitstream vera sans mono", "liberation mono", monospace</td>
171
+ </tr>
172
+ </table>
173
+
174
+ #### Font Size Variables
175
+ <table>
176
+ <tr>
177
+ <th align="left">name</th>
178
+ <th align="left">value</th>
179
+ </tr>
180
+ <tr>
181
+ <td>$x-small</td>
182
+ <td>9px</td>
183
+ </tr>
184
+ <tr>
185
+ <td>$small</td>
186
+ <td>11px</td>
187
+ </tr>
188
+ <tr>
189
+ <td>$medium</td>
190
+ <td>13px</td>
191
+ </tr>
192
+ <tr>
193
+ <td>$x-medium</td>
194
+ <td>17px</td>
195
+ </tr>
196
+ <tr>
197
+ <td>$large</td>
198
+ <td>21px</td>
199
+ </tr>
200
+ <tr>
201
+ <td>$x-large</td>
202
+ <td>34px</td>
203
+ </tr>
204
+ <tr>
205
+ <td>$xx-large</td>
206
+ <td>55px</td>
207
+ </tr>
208
+ <tr>
209
+ <td>$huge</td>
210
+ <td>72px</td>
211
+ </tr>
212
+ <tr>
213
+ <td>$x-huge</td>
214
+ <td>89px</td>
215
+ </tr>
216
+ </table>
217
+
218
+ #### `@extend` Classes
219
+ There are a number of classes contained in `lib/_extend.sass` that can be used in conjunction with the Sass `@extend` function. Please
220
+ see that file for what's included.
221
+
222
+
223
+ <br>
224
+
225
+ #### Sass Syntax
226
+
227
+ 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.
228
+
229
+ 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
230
+ fork this project and convert the formatting styles. Check the [SASS Documentation](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html) for more.
231
+
232
+ <br><br>
233
+ If you have questions or concerns, feel free to give me a shout at:
234
+ [hcatlin@gmail.com](mailto:hcatlin@gmail.com)
@@ -0,0 +1 @@
1
+ (unknown)
@@ -0,0 +1,24 @@
1
+ require 'rake'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/testtask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Run tests'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'test'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ spec = eval(File.read('hamgen.gemspec'))
16
+ Rake::GemPackageTask.new(spec) do |pkg|
17
+ pkg.gem_spec = spec
18
+ end
19
+
20
+ desc "Build and install local gem"
21
+ task "local" => "repackage" do
22
+ puts "Installing locally... this might take a second"
23
+ puts `gem install pkg/hamgen-#{File.read('VERSION').strip}.gem --no-ri --no-rdoc`
24
+ end
@@ -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
@@ -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/init.rb ADDED
@@ -0,0 +1,123 @@
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
+ run "rm config/initializers/session_store.rb"
28
+ run "rm config/initializers/secret_token.rb"
29
+ puts "---------------------------------------------------------"
30
+
31
+ # ADD FILES
32
+ puts " Adding useful junk ... ".green
33
+ puts "---------------------------------------------------------"
34
+ run "cp #{@path}application.html.haml app/views/layouts"
35
+ run "mkdir public/images"
36
+ run "mkdir public/images/backgrounds"
37
+ run "mkdir public/images/sprites"
38
+ puts "---------------------------------------------------------"
39
+
40
+ # GIT INIT
41
+ puts " Initializing new Git repo ...".cyan
42
+ puts "---------------------------------------------------------"
43
+ run "rm .gitignore"
44
+ run "touch .gitignore"
45
+ run "cat #{@path}gitignore >> .gitignore"
46
+ git :init
47
+ git :add => "."
48
+ puts "---------------------------------------------------------"
49
+
50
+ # JAVASCRIPT
51
+ puts " Adding Javascript files ...".green
52
+ puts "---------------------------------------------------------"
53
+ run "cp #{@path}javascripts/application.js public/javascripts"
54
+ run "cp #{@path}javascripts/rails.js public/javascripts"
55
+ puts "---------------------------------------------------------"
56
+
57
+ # SASS
58
+ puts " Installing Sass directory, files and environment preferences ...".green
59
+ puts "---------------------------------------------------------"
60
+ run "cp -r #{@path}sass app/stylesheets"
61
+ run "cp #{@path}compass.rb config/initializers/"
62
+ run "cp #{@path}compass.config config/"
63
+ run "cat #{@path}environment.rb >> config/environment.rb"
64
+ # Dir["app/sass/**/*.sass"].each do |file|
65
+ # run "sass-convert -T sass -F sass -i #{file}"
66
+ # end
67
+ puts "---------------------------------------------------------"
68
+
69
+ # SASS
70
+ puts " Installing Mongodb dependencies, files and environment preferences ...".green
71
+ puts "---------------------------------------------------------"
72
+ run "cp #{@path}_config.rb config/initializers/"
73
+ run "cp #{@path}mongo.rb config/initializers/"
74
+ run "cp #{@path}database.yml config/"
75
+ run "cp #{@path}magent.yml config/"
76
+
77
+ default_config = {"session_secret" => ActiveSupport::SecureRandom.hex(80),
78
+ "session_key" => "__app_session",
79
+ "domain" => "localhost"}
80
+
81
+ File.open("config/app.yml", "w") do |f|
82
+ f.puts({"development" => default_config}.to_yaml)
83
+ end
84
+
85
+ data = File.read("#{@path}application.rb")
86
+ orig_data = File.read("config/application.rb")
87
+
88
+ File.open("config/application.rb", "w") do |f|
89
+ orig_data.each_line do |line|
90
+ if line =~ /^require 'rails\/all'/
91
+ f.puts %@require "action_controller/railtie"
92
+ require "action_mailer/railtie"
93
+ require "active_resource/railtie"\n@
94
+ elsif line =~ /^\s+config\.filter_parameters/
95
+ f.write(line)
96
+ f.puts(data)
97
+ else
98
+ f.write(line)
99
+ end
100
+ end
101
+ end
102
+
103
+ puts "---------------------------------------------------------"
104
+
105
+ # GEMFILE
106
+ puts " Appending Gemfile and running Bundler ...".magenta
107
+ puts "---------------------------------------------------------"
108
+ run "cat #{@path}Gemfile > Gemfile"
109
+ puts " Running Bundler install. This could take a moment ...".yellow
110
+ run "bundle install"
111
+ puts " Bundled gems installed successfully!".green.bold
112
+ puts "---------------------------------------------------------"
113
+
114
+ # GIT COMMIT
115
+ puts " Creating initial Git commit ...".cyan
116
+ puts "---------------------------------------------------------"
117
+ git :add => "."
118
+ git :commit => "-am 'Initial commit.'"
119
+
120
+ # DONE!
121
+ puts "\n========================================================="
122
+ puts " INSTALLATION COMPLETE!".yellow.bold
123
+ puts "=========================================================\n\n\n"