Monday, May 12, 2008

Great Reception for Merbunity

Wow. I'm feeling really grateful for the response to merbunity going live yesterday. A bunch of people have signed up, and hopefully busy writing tutorials to show off their merb skills.

It really is humbling to get such a reception for merbunity.com, and it gives me great hope that the site is really going to be great. Now, lets get some great tutorials and such out into the merbunity ;) Heh... that's a lot of great!

Sunday, May 11, 2008

Merbunity Is Live

Lets face it. Merb, for all it's goodies lacks good documentation at the moment. It' lacks a nice easy path to help beginners get into it.

I've been working on a site for a while to address this, and even though it's not finished, Merb's need for documentation is just too great.

Merbunity is a Merb commUnity site for all things Merb. Currently active are News, Tutorials, and Screencasts.

This is really a community site. It relies on the community writing the tutorials, screencasts, making the news announcements. There is other stuff on the cards, but for now I thought I'd get this out.

To try and keep the site of a high standard, it implements a peer review system. When you sign up, you can write all the tutorials and screencasts you like. When you decide that they're good enough, you can publish them, But... at that point they're not really published. They're 'Pending'. They need someone who is a "Publisher" to authorize them.

So the basic flow is, you write a tutorial or screencast, publish it, it becomes pending. At that point, you can have discussions with publishers about any tweaks that may be necessary. Once they're happy with it, they publish it for real, and it's live on the site. Don't worry though. You don't have to worry about that for ever... That would suck. Once you've published 3 "things" you become a publisher yourself, and you can publish others work, as well as your own.

When your a publisher you can also put up news on the site.

Tutorials and screencasts can be about anything you like, provided they are relevant to the Merb community. They could be about Merb, ORMS's upcoming tech, specs, whatever.

It really is up to us to make Merb great, and I think this will be a good place we can focus on.

Work is ongoing on the site to make it better all the time. Kudo's to Luke Sutton for a great site design. If there's any glitches in it, I'm sure it's my fault since I just *had* to play with it ;)

To get you started, I've posted a detailed tutorial of how to submit tutorials and screencasts.

Well, I'll step out of the way now. I hope we can use this to help people make the most of the awesomeness that is Merb :)

Friday, April 18, 2008

Looking for Powered by Merb Button Creator

A while ago a very kind soul created a "Powered by Merb" button for my site Postb.ag. For the life of me I can't remember who it was though. If you see this. Please get a hold of me :)

Sunday, April 6, 2008

I've Moved!

Well it sure has been a long time coming. I've finally moved jobs to Engine Yard :) It took me a while to finish up at my old job, but it's finally over.

I'm moving into Engine Yard as an Application Support Engineer and I've gotta say I'm super excited about working with such a great bunch of people. That and working with Ruby full time :)

Monday, March 31, 2008

Great To See This Kind of Appreciation

I'm a bit of a fan of DataMapper, and today even more so.

The site design for datamapper.org was very kindly donated by Luke Sutton aka unagi-san. He did the design as a way to contribute to datamapper, and it sure does make it nice. Not only did he do the original design for it, he continues to work on it, donating his time and talent to a great project.

Well. Today Sam Smoot, the father of DataMapper has setup a pledgie as a way to recognize the hard work, and say thanx. I think it's an awesome way for the community to help out a designer that's helped out the community. If you can spare a few dollars and like the project why not get in on it.

Wednesday, March 26, 2008

Introducing Whistler

With all the posts about merbful_athentication lately, you'd think that was all I was working on. It's not quite the case. A lot of it isn't looking like going OS, but I've been able extract something from one of my project.

Whistler is a markup white list filter. It's based on the specs of Rick Olson's WhiteList rails plugin and runs on hpricot.

Usage is super simple. You can either include it into your model, or use it directly.
Whistler.white_list(markup_string)
That's it. There are ways of using different tags and attributes on each call. Check out the source at http://github.com/hassox/whistler

Merbful Authentication 0.9.2

I've just put up a bugfix for merbful_authentication because there was a method name clash in merb-gen. This is really a very small fix. It also includes a couple of other minor fixes.

You can get the latest from rubyforge.

Wednesday, March 5, 2008

Merbful Authentication 0.9.1

After a buggy start, and no Test::Unit support, the new MerbfulAuthentication is here.

This release is a little experimental at the moment. I mean, it's more robust in the way it handles the dependencies, but there is one area I'd really like some feedback.

To minimise the setup and configuration required, I've taken some liberty with this release. There was an issue where with the way I had the routes in 0.9.0, when the router was reloaded because of a change, the AuthenticatedSystem routes were wiped out. Also there was requires and dependencies still fairly well littered throughout the code.

To accomplish this, I've taken the liberty of writing some configuration information into the config/init.rb and config/routes.rb files. This will add the lines when you generate, if they are not already there. It won't be destructive, and you can just remove them if you want.

I'd really like some feedback to see if ppl don't like this. I can't see it causing trouble. But that doesn't mean ppl will like it ;)

So have a crack and let me know what you think :)

Wednesday, February 27, 2008

Merbful Authentication Initial Merb 0.9 Support

It's ready for a first off flogging. A huge thanx to Shay Arnett of merborials.com fame for all the great help in getting it going, along with plenty of others how have given support and hacks to get the plugin going. Merbful Authentication, the authentication generators based on RickOlsons cool restful_authentictaion plugin is ready for a first cracking. Please bear in mind that Merb 0.9 is still in it's infancy and so is this gem. It needs to be flogged so it can be solid. Having said that, it seems to be solid, but... well, you know...

There are not too many changes from before, mostly spec updates, and internal updates that only really affect the generators to use merb-gen.

Unfortunately test unit support is... well the test unit tests aren't working atm. RSpec ones work, and all the specs should function correctly. The specs are fairly complete tho so I have at least some confidence that the plugin is working :)

Git it


The repo has now been fully moved over to git. I'm not planning on updating the SVN repo. Of course if there are people that really want to use the SVN repo, I'll push it over there.

To get merbful_authentication just
sudo gem install merbful_authentication
or get it from my git repo.
git clone git://github.com/hassox/restful-authentication.git
cd restful-authentication
git checkout -b merbful_authentication origin/merbful_authentication
rake install

How to use it

merb-gen authenticated user_model session_controller [--include-activation]
The only required argument is the user model. The sessions controller will default to Sessions. If you use the --include-activation mailers and required code will also be included.

What's different?

Well, besides the internals of the gem being simplified, there has been some changes to the generated files themselves.

  • There isn't the mess of dependency and require statements anymore. There is a require on 1 file lib/authenticated_system/authenticated_system_dependencies.rb All the dependencies are listed in here.

  • The required routes are now in the lib/authenticated_system/authenticated_system_routes.rb file. They are automatically prepended to you routes once the app has started. So now you can just start using them :)

That's really it. The other changes are in the structure of the gem itself, and just a couple of small tweaks to get the syntax right for 0.9.

I hope this release will be relatively bug free, but if you do have any issues, catch me in #merb, or shoot me an email has.sox [at] gmail DOT c o m

Sunday, January 27, 2008

Merb Supports rSpec Text Stories

Today I managed to release a new plugin for merb that provides basic support for rSpecs text stories. It's a bit experimental at the moment so if you want to pitch in and get it going smooth, come on down ;)

I have been hanging onto it for a little while, but I keep trying to get into the release early and often philosophy.

Get It

Like all merb plugins, this one is a gem. You can get it from gem
sudo gem install merb_stories
You can get it from source
svn checkout svn://rubyforge.org/var/svn/merb-plugins/merb_stories
cd merb_stories
rake install

Usage

At it's heart merb_stories is almost just a generator, but you do need to add it as a dependency to get going with it. You can safely remove it when you deploy, but for now it needs to be there to run the stories.

Generate A Story

In your Merb.root
ruby script/generate story my_story
This will generate all the support files, if they're missing, and also the story, story steps etc.

If you want to organise your stories a bit more, you can put them into sub-directories.
ruby script/generate story story_group/story
You can go as deep as you like with the directories.

Running Your Stories

It's really simple to run your stories. merb_stories supplies a rake task to remove any pain you might have.
rake story[my_story]
or if you used subdirectories
rake story[story_group/my_story]
You can also just run all of them at once.
rake story[all]


Thats really about all there is to it. To check out what to use stories for checkout the rSpec site.

Friday, January 18, 2008

Cool Stuff with the Merb Router

Today I found out something I didn't know about the merb router when looking for routing to subdomains.

I've got a route that looks like this:
  r.match(:first_subdomain => ":account_name") do |k|
k.match("/:controller/:action") #any old route match really
end
That will put the value of the first subdomain into params[:account_name]. Hang on though... That doesn't work by default.

How Is It So!!!?!!?

Well it turns out that when you pass a hash to r.match it uses the hash keys as method calls to the request object. It then compares the values returned to the ones you specify.

So you can have heaps of mini matchers in you matcher and all you have to do is specify a method on the request object and then use that method name as a hash key in the match. This is probably a bit dangerous so be careful with it. In this example this does the job at the top of the route file
module Merb
class Request
def first_subdomain
subdomains.first
end
end
end

Merbful Authentication Update

There have been a couple of little teething problems with the merbful_authentication gem, mostly because it's not automatically available to your app when you run the generators. There's all that you had to do to get going which really bugged me.

The Skinny

To setup your newly generated Authenticated user, now all you need to do is setup the routes. (and the mailer if your using activation). All the including and dependency is taken care of for you. This is current as of 0.1.2. If you care about why and how... read on.

Why and How

The main issues were with the controllers not having the mixin by default. Then when you try and include it you have to make it a dependency. Not very nice... I also kept getting tripped up on the merb_helpers dependency too.

Well you'll be pleased to know that now, when you generate an authenticated user and you app loads, all the authenticated system is mixed into Application. The controller that your controllers should all inherit from. So it's now available to all your controller automatically :)

Also merb_helpers has been made a dependency where it's needed, and also a dependency on the gem so you don't have to worry about it. Ahhh... gem plugins are so nice like that.

It's up on rubyforge so sudo gem install merbful_authentication should do the job.

If you want source with that see my other post for instructions on where to get it.

Happy Hacking!

Friday, January 11, 2008

Dynaically Setup Rake Tasks

This is probably really old news. I just setup my first rake task tonight though so I thought I'd put it up here. This is more for myself really so if it's not your cup of tea turn away now.

I've been playing with rSpec's text stories in Merb but I couldn't find a way to make a rake task that would take an argument for a particular story to run. e.g.
rake story:run my_story
So I've done the next best thing. I scan my directory for story files and create the rake tasks dynamically. Now I can use:
rake story:run:my_story
As well as
rake story:run:all
The code to make this dream a reality is
# Allows all found stories to be run individually by using
# rake story:run:story_name
namespace :story do
namespace :run do
all_stories = []
Dir.glob('stories/stories/**/*.rb').each do |path|
story = path.split("/").last[0..-4]
desc "Run spec story #{story}"
task "#{story}".to_sym do
sh %{ruby stories/stories/#{story}.rb}
end
all_stories << story
end

desc 'Run all stories'
task :all do
all_stories.each do |story|
puts
sh %{ruby stories/stories/#{story}.rb}
end
end
end
end

Monday, January 7, 2008

Merbful Authentication Update 0.1.1

Well, it's been out in the wild for a couple of days now, and there is at least one glaring error in the merbful_authentication code. The generator is called "authentication" instead of "authenticated" not too good for a port. That's changed now. Also there is some changes to give nice error messages when no ORM is selected or sequel is selected.

If you want to get the update you can get it the same as before.

Friday, January 4, 2008

Merbful Authentication is Born

Hooray... The initial release of merbful_authentication is cooked. It took a bit longer than I thought it would, mainly thanx to my unfamiliarity with test_unit. Well, that and I was away over the christmas holidays.

At the moment there is support for Datamapper and Activerecord ORM's. Hopefully Sequel will follow soon.

How to get it

The gem has been released on rubiforge, so the usual should do the trick
sudo gem install merbful_authentication
If you want source with that.

Git:
git clone git://activereload.net/restful_authentication.git merbful_authentication.git
git checkout -b local/merbful_authetication origin/merbful_authentication
Or SVN
svn co svn://rubyforge.org/var/svn/merbful-auth
From either of these you can package and install the gem
rake package
sudo gem install pkg/merbful_authentication-0.1.0.gem

Usage

It has the same usage as restful_authentication, without the stateful stuff. So (from README)
To use:

./script/generate authenticated user sessions \
--include-activation

The first parameter specifies the model that gets created in signup
(typically a user or account model). A model with migration is
created (if migrations are available), as well as a basic controller with the create method.

The second parameter specifies the sessions controller name. This is
the controller that handles the actual login/logout function on the
site.

The third parameter (--include-activation) generates the code for a
Mailer and the required support code. Don't forget to setup your mailer for this.

Required Setup

Unfortunately there is some setup required. At the moment, some named routes are required. You can set these up in you config/router.rb
      r.resources :users
r.match("/login").to(:controller => "Sessions", :action => "create").name(:login)
r.match("/logout").to(:controller => "Sessions", :action => "destroy").name(:logout)
r.match("/users/activate/:activation_code").to(:controller => "Users", :action => "activate").name(:user_activation)
That last one is only required if you include activation. Don't forget to setup your mailer configs if your using it too.

Also, you need to have merb_helpers installed. This is for the form generation stuff. In config/dependencies.rb
dependency "merb_helpers"
All crit, comments, bug reports, patches are welcome. Patches are more welcome of course ;)

Update: You will need to install merb and merb_helpers from trunk until the official 0.5 gem for merb comes out.