Articles tagged 'feather'

Setup Feather to run as a slice within a Merb app Jan 30

In response to a few queries and comments on my post about the ejdraper.com blog running as a Feather slice underneath a parent Merb application, I decided to put together a sample app demonstrating just how you’d configure such a beast.

Introducing Feather Sample Slice Host… this is an up-to-date Merb application (Merb 1.0.8.1) that hosts Feather as a slice. It comes with a few common plugins installed, and an ultra basic theme override to demonstrate the themes working. It shows how you can easily integrate Feather into a Merb application, and you should be able to use it as a base for any application that you’d like to build with Feather integrated. You need to install Feather as a gem first - for now, simply “git clone” the Feather code, and then run “sudo rake install” in the root of the Feather codebase. A configured development sqlite3 database is included with the sample app so that you should then just be able to “git clone” the host app code and fire it up!

For those that are interested, integrating Feather as a slice boils down to the following steps:

  • if you haven’t already, grab Feather as a gem (same as above, clone the code, and then “sudo rake install” in the project root; this will change when the first gem version of Feather, 0.5, is officially released shortly)
  • create a brand new Merb app
  • add Feather, and a few of it’s dependencies to “config/dependencies.rb”
  • add the appropriate Feather slice commands to the host apps router, to mount Feather at /blog (or wherever you would like)
  • run “rake slices:feather:install” and “rake slices:merb-auth-slice-password:install” from the root of the host app to copy static resources over
  • setup the database, using the “Feather::Database.initial_setup” method from the Merb console (“merb -i”)
  • implement a login form under the “app/views/exceptions/unauthenticated.html.erb” view
  • install any plugins required
  • setup any themes needed (if using the themes plugin)
  • implement the rest of the functionality you want in your host application!

For any of the steps above that aren’t all too clear, you should be able to refer to the sample application now to see exactly what is required. It isn’t currently as straightforward as I’d like, and as a part of the aforementioned 0.5 gem release, I’d like to provide an easy command to add Feather to a Merb application, or create a new Merb host app with Feather already installed as a slice. For now though, the above checklist alongside the sample app should have most of you up and running in no time!

As always, any questions, please feel free to contact me or leave a comment.

Comments

Reboot Jan 10

I’ve designed and built a brand new personal site here at ejdraper.com, and have moved over this blog - all url’s from crazycool.co.uk now point to ejdraper.com/blog, and the blog integrates with the rest of my personal site, which also includes a bit about me, my portfolio of work, my code and a lifestream on the homepage aggregating content from this blog, GitHub, Flickr, Delicious and Twitter.

As part of the migration I’ve created a new feed with FeedBurner, at http://feeds.feedburner.com/ejdraper. I’ve left the old crazycool feed running too though, and pointed it at the new site, so those of you subscribed should continue to receive the latest articles, but if you get chance it may be worth switching your subscriptions to the new feed to ensure that it always works in future.

For those interested, this new site runs on Merb, and is hosted using Apache and Passenger. The blog portion still runs on Feather, however it runs as a slice inside the main ejdraper.com app. I’ve spent a fair bit of time recently on bringing the Feather codebase up to speed to make it work with the latest Merb/DM, to finish up slices support, fix some of the bigger bugs, and to make it more stable and reliable. Soon enough I’ll be wrapping up the latest code into a 0.5 gem release, so watch this space!

Any comments on the new site and design will be welcome, and I’m going to be more blogging a lot more regularly from here on out!

Comments

Can you hear me now? Oct 29

So this blog has been a little bit up and down recently, partly because the Feather installation is overdue an update, and partly because the server could do with being rebuilt, but I figured that rather than me finding out the site has been down for a day and then manually booting it, there must be an automated way of picking up these issues and restarting the site. Sure enough, there is!

God is a great gem that allows Ruby scripts to be written to describe the configuration, settings and scenarios required for monitoring a particular process, and to outline the steps to take when certain conditions are met. I was able to knock up a script to reboot the app server for this blog whenever it doesn’t get a 200 response back from the main index, and I think that’ll do the trick nicely!

So if you see this blog is down, just give it a minute or so - God is on the case and will fix the issue shortly :-) Thanks Mojombo!

Comments

Rename Oct 23

So I’ve decided to rename my GitHub account, from http://github.com/eldiablo to http://github.com/edraper. If you’re using or working against feather-plugins or merb-manage then you’ll need to reset your remote location for doing a git pull or whatever. Not sure if you’ve forked whether that’ll continue to work, probably best to check and rebase against the repo at the new url. Any questions let me know and I’ll try to help you out if it’s screwed something up.

And just for fun, here is a video of me scoring a great free kick with the brilliant Jimmy Bullard for Fulham against Arsenal.

Comments

What's up Proc? Jul 6

So it’s awesome Ruby snippet time, and in particular I’m going to look at the ability to evaluate statements against a block, specifically to find out where the particular block came from.

The “eval” command not only takes in the command to be executed, but can also optionally take in a binding to run against. This means that instead of evaluating a command against the current, local binding, a specific binding can be used, and for our example, we are going to use the binding on a Proc object, to allow us to evaluate a statement as if it was running within the block itself.

Let’s setup a module that allows us simply to register a block to an array:

module TestApp
  class << self
    # Adds a block to our global array
    def add_block(&block)
      @@blocks ||= []
      @@blocks << block
    end

    # This just returns our block array so we can iterate through it
    def blocks
      @@blocks
    end
  end
end

Within this same file (let’s call it test1.rb), we can also register a test block. The execution of the block isn’t really important, so let’s just do:

TestApp::add_block { puts "test1" }

Now let’s setup a second script (called test2.rb) that’ll also register a block, and that will iterate through the blocks and use the “eval” command to show where each block originated from:

# Reference our first script
require File.join(File.dirname(__FILE__), "test1")

# Add a second block
TestApp::add_block { puts "test2" }

# For each block we have, run a statement that will return the "__FILE__"
# variable for each block, against the blocks own binding
TestApp::blocks.each do |blk|
  puts "Block from: #{eval('__FILE__', blk.binding)}" 
end

If we run the test2.rb script now, we should see output similar to the following:

Block from: ./test1.rb
Block from: test2.rb

So we can now differentiate between our blocks, by investigating the blocks own binding! Something to bear in mind is that obviously the paths shown are relative – if you were executing the test2.rb script using an absolute path (for example, “ruby /path/to/test2.rb”), you’d see that the absolute paths were shown instead. Either way, the information should be useful in determining the origin of a block.

Now you may be asking, what’s the use case for something like this? Our block registration code above does nothing useful, and in fact we don’t even execute the blocks themselves! Well, within Feather we use this code to find out which plugin registered a particular block – in this way, we can check at runtime (before executing the registered block) whether the plugin is active or not. If it isn’t, it won’t be executed, if it is, it will.

This is just one of those cool things you can do when you have a reference to a specific binding – there’d be nothing to stop you from interacting with the blocks bindings in other ways too.

Comments

Call To Arms Jun 25

So a quick Feather update: we’re now running against the latest stable versions of Merb (0.9.3) and DataMapper (0.9.1), which should make getting Feather up and running even easier. We’re also currently starting work on running against edge Merb, to try and implement merb-slices, so that Feather can be run as a slice within other apps, and so that Feather plugins themselves are slices in their own right. If you’d like to contribute to that effort, there is a “slices” branch for both core, and plugins. Just fork, hack away, and send me a pull request with your changes!

In other news, the official Merb blog is now running the best Merb blog in the world – that’s right, Feather! It’s great to see the blog running Feather, and we hope we can continue to improve it to make it even more useful for the Merb guys to be able to get out important Merb information and articles!

Also, I’ve been through the tickets on the Feather Lighthouse, and setup two milestones – 0.5, and 1.0. The idea is that 0.5 will aim for stability, and getting the work on slices up and running. Milestone 1.0 will be for trying to improve the distribution, setup and configuration of Feather to make it more user friendly.

There are currently a ton of feature requests and small bug fixes outstanding, that I’ve assigned to me on the LH tracker. I’m going to start to try to get through them, but if anyone out there fancies taking any of them on (a lot of them are great little ways to get into Feather development!), then just let me know, and I can re-assign the ticket to you. There’s no deadline on the 0.5 milestone just yet, but the more contributions we can get to knock off some of the outstanding items, the quicker we’ll hit the milestone! Consider this a call to arms :-)

Lastly, big shout out to some of the contributions coming in – after a mammoth merge session the other night, I rolled in great contributions from aflatter, sudothinker, jf, piclez and fujin. Apologies if I missed anyone else – ping me if I did, and I’ll give you the appropriate kudos.

Comments

Feather + DataMapper 0.9 Jun 11

Last night I finished merging some of the work Alexander Flatter did on converting Feather core code for use with DataMapper 0.9, along with the work I did that was required on the plugins code to be compatible with DM 0.9, and some other fixes that popped up during initial testing. It’s a lot of changes, and so there are bound to be certain bits that aren’t quite right. Also, after some testing today, it appears that the various combinations of Merb and DataMapper that are getting used are causing some strange errors for some people. We’ve taken the decision to try and get Feather running cleanly on the latest versions of Merb and DM, so that if people are experiencing problems, the nice simple solution should be installing the latest versions of both dependencies.

We’ve committed a workaround within Feather for the merb-cache issue that was holding us back from running on the latest Merb (0.9.3), and I’ve updated the Getting Started guide over on GitHub to provide more details on how to setup the core dependencies (Merb and DataMapper) to ensure you are using the latest versions (as well as detailing another potential conflict with the latest version of ParseTree).

As is to be expected with a project as young as Feather, it’s in a fair state of flux at the minute, but please bear with us as we try to improve and upgrade the application to use the latest versions of its core dependencies; we hope that by doing this it will make it easier to setup and install Feather in the long run, and it’ll also eventually make Feather more stable if we are using the latest stable versions of both Merb and DM.

Any questions, comments, issues or bugs can be raised with us in IRC (irc.freenode.net, #feather), or on our new Feather mailing list (http://groups.google.com/group/feather-dev). At the minute, we’d like as many people as possible to try to use Feather against Merb 0.9.3 and DM 0.9, so we can resolve any outstanding issues promptly, so if you encounter any problems, please let us know!

Comments

Feather by mail Jun 7

As an alternative to IRC, we’ve now got a mailing list setup for Feather, where you can discuss ideas, feature requests and issues. Also, we’ll use it for announcements surrounding Feather releases. The mailing list is on Google Groups here, and you can browse the messages and sign up there. The more the merrier, so sign up, and drop the list a mail if you have something to say about Feather!

Comments

Changes May 28

I haven’t posted much for the last couple of weeks, the main reason being I was busy finishing one job, and starting another. After four and a half years at Nildram, it was about time for me to move on to a new, more interesting challenge. And I also wanted to take the opportunity to move from .Net to Ruby on Rails. I was able to find a great new opportunity with a fantastic company, and I’m now a Ruby on Rails developer with TouchLocal, a local business directory. I started yesterday and my first two days have been really great, I feel like I’m settling in nicely, the people are great, and the opportunity is just as good as I thought it would be. And of course it’s awesome to be working with Ruby on Rails in my day job.

I’m aiming to get back to posting a bit more regularly on the weekend, including a round-up on the most recent progress with Feather.

Comments

Feathered May 9

So it’s been two weeks since we open-sourced Feather. The feedback so far has been great, really pleasing, we’ve had some great coverage, and some great contributions. I figured I’d do an update on where we’re at, and highlight some of the cool things from the last two weeks.

So first of all, the coverage the project has gotten is great. We made it on to the brilliant “This Week In Ruby” on Antonio Cangiano’s blog, for April 28th. We also made it on to the Rails Envy podcast, another great source of the latest Ruby and Rails information, on April 30th. On top of that, after submitting the announcement post link to RubyFlow, it then made it on to Ruby Inside, in a round-up post of the best of RubyFlow for the last couple of weeks. RubyFlow seems to be a great site for the latest and greatest news in the world of Ruby, so it was brilliant to be picked in a round-up post from two weeks worth of links!

We also received numerous links from other bloggers, and there seems to be quite a buzz about the project so far, which is great!

As for the sourcecode itself, thanks to GitHub we are able to keep a great handle on the interest level, and we’ve seen that skyrocket! At the minute, we now have 95 watchers on the main codebase, and 13 people have forked the code! For the plugins codebase, we have 6 forks, with 40 watchers! And each day we have more and more people watch or fork the code.

We’ve also made some great progress with features and bug fixes. In the last couple of weeks since opening up the codebase, we’ve had:

  • XHTML/styling fixes from Michael Bleigh
  • custom permalink formats from Jake Good
  • Mike added pagination for the admin article index, and also for the admin comment index
  • Atom feed support for articles/comments from Markus Prinz
  • a Mephisto importer plugin from Jake Good
  • a Typo importer plugin from Marc Seeger
  • a small markup fix from Bradly Feeley
  • Mike also nailed a few other fixes

I think that’s most of the major contributions, apologies if I’ve missed anyone (let me know in the comments and I’ll update the list!). Considering that it’s only been open source for two weeks though, I think that’s great! We also have some other contributions in the pipeline, and so things seem to be progressing nicely. A list of contributors is also available on the GitHub wiki (thanks to Mike) here. If you’d like to see your name there, you know what to do!

To try and organize fixes, issues and feature requests, we’ve setup a Lighthouse instance for Feather. It’s available at http://feather.lighthouseapp.com. You’ll be able to add bugs or feature requests, and if you’d like to contribute by tackling any of the issues or feature requests there, let us know and we’ll give you access so that you can be assigned them so everyone knows your working on them. We’ve also setup an IRC channel to hang out and discuss Feather on irc.freenode.net (#feather). Me and Mike are in there quite a lot, so come on in to talk about Feather, whether it’s talking about how to set it up, how to extend it, or specific issues you might be having. The more the merrier!

Something else to mention is those that have switched their blogs to Feather. Obviously me and Mike are running Feather, and Jake finally got his blog over to Feather once he finished his Mephisto importer. And more recently, in the last few days Marc got his blog up and running with Feather too. They all look great, and if anyone else is using Feather, it’d be great to hear about it, so let me know!

Besides logging a few bugs, and hanging out in IRC to help people with some setup issues, I was also able to knock together a basic getting started guide this week. It’s available on the GitHub wiki for the project, here. One of our aims is to make setup easier over the next few weeks, but in the meantime at least there is a set of instructions to hopefully make it easier for people to get up and running.

Also over the next few weeks, we’ll be aiming to get an official Feather site up and running, which will include news, updates, an official plugin repository so that we can have one-click installs for plugins, and some more guides to using Feather, and developing plugins for it.

With more plugins on the way, a few bugs to fix, and some new features to put together, I’m sure the next two weeks and beyond will be just as productive for Feather. If you’re interested in getting involved, drop by #feather and introduce yourself, you’ll be more than welcome!

Comments

Defer To May 3

So one of the really great features within the Merb router is “defer_to”. This enables you to defer certain routing decisions to runtime, allowing you to evaluate and decide what needs to be handled where based on runtime factors. This is used in a couple of places within Feather and its plugins, specifically the main use is the handling of the article permalinks. Each article has a permalink stored against it, and while there is a default pattern for new articles, we allow any url as a permalink for an article to ensure that importing/backwards compatibility is straightforward. As this may not follow any particular pattern, we need to be able to evaluate this at runtime.

Originally, Feather handled this with a custom Rack handler, that ran before the main Merb application handler. It checked the request uri, and if it matched an article permalink, it dispatched the call to the articles controller to show the appropriate article. If it didn’t match, it simply went on and processed using the Merb app handler as normal. This worked fine, but looked like in the long run it might be difficult to maintain – it would certainly be nice to have a way to handle it all from within Merb routing.

Lo and behold, there is! Enter, defer_to. Let’s take a look at the article matching code from Feather first of all to see how it works:


r.match("").defer_to do |request, path_match|
  unless (article = Article.find_by_permalink(request.uri.to_s.chomp("/"))).nil?
    {:controller => "articles", :action => "show", :id => article.id}
  end
end

So what is this doing? Well it’s basically starting by matching all routes. It then calls “defer_to”, specifying a block to be used to evaluate a request at runtime. This block is passed the incoming request, which is all we need for our purpose here (the second argument is a set of parameters containing information about the route matched so far – in our case we are matching everything to try and then match the permalink at runtime, so we don’t use this argument).

We then basically use the incoming request uri to evaluate whether it matches an article permalink, and if it does we return the routing information for that particular article. Otherwise, the block will just return nothing, and so the Merb router will then continue on its way attempting to find a route that matches for the request. This means that the moment a new article is posted, or perhaps old articles are imported with specific permalinks, they are available and will be handled, all using Merb routing, thanks to “defer_to”. It’s a tidy, lightweight, great way of handling a complex routing problem.

Comments

Lights Out Apr 28

The response to us open-sourcing Feather has been great so far, with some contributions, some questions, some comments, all good stuff. And now, thanks to the guys over at ActiveReload, we’ve got a public facing instance of Lighthouse to be able to track bugs, issues and feature requests, in both the core code, and the plugins! So if you discover an issue, or want to request a feature, then log it on there at http://feather.lighthouseapp.com and we’ll get to it! If you’d like to tackle the fixing of a bug, or the implementation of a feature, get in contact and we’ll set it up so that we can assign that particular request to you so everyone knows you’re on it!

This should make managing and co-ordinating development a lot easier! Thanks again to the guys at ActiveReload for a great product, and for hooking us up with a free account for our open source project! And thanks to everyone so far who has contributed with code, comments and queries, keep ‘em coming!

Comments

Page 1 of 2 | Next page