Welcome to turbo-generators
This is a work in progress. It’s my first attempt at writing a gem. Well I say ‘write’ when I actually mean ‘copy’.
Much of the code has been shamelessly stolen from ryanb’s nifty-generators. Thanks ryan.
The reason I have created a brand new gem is because it does one or two extra things.
The gem is quite quirky right now in version 0.0.1 and is probably only really of use to myself in it’s current state.
Installation
First make sure that you have gemcutter gem installed and tumbled by doing:
gem install gemcutter
gem tumble
(don't forget to use 'sudo' command if you are on mac or linux)
Then install the turbo-generators:
gem install turbo-generators
Usage:
I created the gem to be used along with my rails application template - github.com/murdoch/rails-templates You can create a rails app using that template by typing:
rails my_app -m http://github.com/murdoch/rails-templates/raw/master/base_template.rb
What do these generators do then?
You will now have access to two new generators that you can run from within your rails apps:
* sript/generate turbo_layout
* script/generate turbo_blog
Gotchas
Presently the turbo_blog generator requires you to have a user model named user.rb. If you don’t then it probably won’t work. The easiest way to make sure you hae a model called user.rb is by ryanb’ nifty_authentication generator. I would like my gem to be more flexible so in future versions you will be able to accomodate different authentication setups.
Also, the blog resource that is setup by the turbo_blog generator is by default called Post. This suits me but you might not like that so in future version users will be able to specify a differnent name for the resource. For now though, blog resources will be available from localhost:3000/posts.….
You must create a user and login before you can create new posts.
About turbo_layout
Right now it just creates a simple layout - I will work hard on improving this over the next few weeks as it’s quite important to me to have a good starting point.
The turbo_layout uses blueprint css but it does not use compass or sas yet - this is coming soon once I’ve figured out how to use them myself.
Turbo_layout currently looks very dull and very boring but like I said, I’m going to work really hard on getting this up to the standard that I require for my apps.
About turbo_blog
As mentioned, turbo_blog requires you to have a user model called user.rb setup. This can be achieved by installing ryanb’s nifty-generators and running ‘script/generate nifty_authenticaion’ from within your rails app.
Future versions of the gem will allow you to specify the name of your user model.
Example use
-
create a new rails app by typing:
rails test
-
run ryanb’s nifty_authentication generator
script/generate nifty_authentication
-
run turbo_layout generator
script/generate turbo_layout
-
rub turbo_blog generater
script/generator turbo_blog
-
run the migrations
rake db:create rake db:migrate
How do I see my blog posts?
Create a user by going to localhost:3000/signup - Login - Go to localhost:3000/posts
Finally.
This is my first gem. This is new to me to be honest. I know my generated template presently lacks a lot of features but I need to start somewhere and this gem will get much better. I promise. There’s much more to come. If you have any ideas, suggestions or complainst please email me at [email protected] and I’ll see what I can do
Thanks - and yeah, I know, my code is quite messy, and my template is a bit plain and boring - but I am goign to fix all that soon.
Steve