Articles tagged 'ruby'

Feather + DataMapper 0.9 Jun 11 2008

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 2008

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 2008

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 2008

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

Lights Out Apr 28 2008

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

Announcing: Feather Apr 26 2008

So after a few weeks of teaser posts, we’ve finally opened up the code on the software that powers this very blog, Feather. It’s been a collaborative effort so far between me and my boy Mike, but now it’s time to open source it, and hopefully people besides us will not only find a use for it, but will also find new ways to extend and improve it.

So what’s in the current codebase? As alluded to before, the core itself is lightweight. Basic article posting, and user management is all you’re really getting. The beauty is in the wide variety of plugins that are (and will be) available to extend the software further. Within a separate plugins repository, there are currently twelve plugins, that extend Feather to provide comments for articles, feeds, formatters for article content (Textile and Markdown), basic RSS importing for articles and comments, integration with ping services, the ability to setup hard-coded redirects on your site, sidebar and snippet content, overridden css styles, tagging, Twitter integration (to display your tweets in line with blog posts), and file uploads. The code in core and for these plugins probably isn’t perfect, but it’s good enough to power a few blogs already - and improvement is where you come in.

If you’ve got an idea for a new plugin, improvements to existing functionality, or you’ve found a bug, then by all means fork the project on GitHub, implement your code, and send us a pull request so we can merge the changes into the main trunk. Alternatively, send us your patch via e-mail, and we’ll look to include it within the application. If you submit two patches to either feather, or feather-plugins, then you’ll be given commit access to the repository in question, and will effectively become part of the core team. So what needs doing right away?

The biggest deficiency at the minute are specs - there are some specs in the core code, but it doesn’t cover a lot of the application, and ideally we’d be aiming for 100% coverage of the core controllers and models. We then need to devise a decent way of similarly shipping specs with plugins. When we start updating and improving plugins, we’ll need a way of handling data migrations smoothly and efficiently. On top of this, there are still outstanding useful plugins that need to be written, such as content search, and trackbacks, as well as integration with services other than Twitter. Lastly, there are bound to be bugs, so roll up your sleeves and fix them, it’ll be much appreciated!

We’ll be rolling out a Feather website soon, along with an official plugin directory to make installing plugins easier - for now, there’s a basic getting started page on the wiki over at GitHub, and there will be more information over the coming days on both mine and Mike’s blog. Any questions in the meantime, then let me know.

Other than that, what are you waiting for? Get your Feather on!

Comments

gem install merb-manage Apr 20 2008

So I’ve put merb-manage up on RubyForge, and uploaded the latest gem release, 0.4. This now means that you can do “gem install merb-manage” and have it installed to your machine, ready for use! For more information on how to use it and setup your apps, see the README over in the source at GitHub.

Any questions or comments, let me know!

Comments

Manage Your Merb Apr 16 2008

So in getting this blog up and running on a server of mine, I needed a simple way to control and configure the Merb application, preferably with the ability to quickly alter the amount of servers, the logging, or indeed the adapter being used, amongst other things. I also wanted it so that much like Nginx, the Merb application itself would automatically restart if the server got bounced for whatever reason.

Introducing… merb-manage! Hosted over at GitHub, and open source, this is a simple tool that allows you to quickly and easily manage your Merb configurations on a server, and start/stop/restart your Merb applications as per your configuration. It also includes a bash script that can be installed to act as a startup script (such as in /etc/init.d) so that when your server restarts, your Merb applications spring back to life too! You can store the configuration within your application, and simply symlink it to a central configuration directory for merb-manage to go to work on (defaults to /etc/merb-manage), and you can change the adapter, amount of servers, port, user, group, and logging level straight from the configuration! It’ll handle multiple applications and their configurations so you have a one-stop shop for configuring and managing your Merb instances!

It’s fairly simple at the minute and I’m sure there’s some more useful features to be added, so if you have any ideas then simply fork it, add them in, and send me a pull request! Likewise any bugs, issues, either let me know, or even better, fix them and I’ll add them back in to the main tree!

Comments

Drop It Like It's Hot Apr 13 2008

So anyone that isn’t reading this in a feed reader will see that my blog has had a serious overhaul - and I’m now running on Feather. Me and Mike spent quite a bit of time last week or so expanding the Feather feature set, and it now more than copes with my existing blog. I was able to import all my old posts, customize the default theme to something a little bit different, and add in a few custom snippets (Analytics, FeedFlare etc). I was also able to add redirects for old links to ensure that (hopefully) there isn’t too much broken by the move. All old posts will have the same permalink too, handled as part of the import process.

Currently I’m running without caching, but I see my partner in crime Mike has gotten caching up and running on Feather, so I’ll get that setup and running shortly too, to improve the performance of the blog still further.

As far as I can see the blog should be running ok, but any issues - let me know with a comment, or an e-mail, and I’ll get right on it!

Comments

Light as a Feather Apr 7 2008

My boy Mike is back blogging his ass off again, and this time, he’s doing it on some decent software! Last few weeks me and Mike have been working on an ultra-cool blogging platform written using the Merb framework, and it’s now in production use for Mike’s blog. This very blog will follow suit shortly as I migrate over, and within a few weeks we are hoping to have the codebase in a good enough state to be able to open up the source, and start to invite contributions from anyone that feels the need to help out. The idea behind Feather is the same as Merb - lightweight core framework, extended heavily by plugins, allowing you to choose the pieces of functionality you need, and leave out the guff that you don’t. Keep it dialed in here for further updates on Feather over the next few weeks, and keep a keen eye on Mike’s blog too for more great posts. In fact, he’s already in the thick of it with this great post on why Ruby does it for him (and why .Net doesn’t).

Comments

Adventures in Merb Mar 17 2008

I decided to give Merb a go, and after doing a fair bit of reading up on it, I took the plunge. It’s a little rough around the edges, but that’s probably to be expected given it’s youth - however there are a number of cool features and benefits to using it, and it’s getting better and better as it’s being refactored. I did however come across a few interesting issues getting up and running, so I thought I’d share these to try and make the process easier for others.



I installed the gems from http://merbivore.com, by doing the following:



sudo gem install merb --source=http://merbivore.com --include-dependencies

This gave me the merb-core gem, along with merb-more. However, to get up and running with a database, we really need a database plugin - let’s try DataMapper.



sudo gem install datamapper --source=http://merbivore.com --include-dependencies
sudo gem install merb_datamapper --source=http://merbivore.com --include-dependencies

Now you’d think that a dependency for merb_datamapper would be datamapper itself, however it doesn’t get included, and so you need to download that as a gem, and then download merb_datamapper. We then need a few other gems, including one specific to the database you’ll be connecting to:



sudo gem install data_objects --source=http://merbivore.com
sudo gem install do_sqlite3 --source=http://merbivore.com

As you can see, I chose to install do_sqlite3 for accessing a sqlite3 database. However you could install “do_mysql”, or “do_postgres” to access MySql or PostgreSql databases respectively, and I’m sure there are others. Sqlite users using Mac OS X 10.4 (Tiger) should bear in mind an issue I came across, whereby a strange error is received when attempting to do any database related activity with the do_sqlite3 gem and the default native sqlite3 version that comes with the operating system. This manifested itself as a couple of different strange errors (including a “DataMapper constant not found” error when starting Merb), however the solution was simply to grab the latest sqlite source from www.sqlite.org, build it, and install it. Then try re-installing the do_sqlite3 gem as above, and you should find that they play together much better!



We can now proceed with creating a Merb app to play with:



merb-gen testapp

Looking in the “testapp” folder now shows us the initial structure Merb uses, which is fairly similar to how Rails applications are structured. The main differences that you’ll need to know straight away are that routes are defined in the “router.rb” file within the “config” directory, and that the main settings and application initialization stuff is within “init.rb” in the “config” folder. Let’s setup our app to use DataMapper by changing the “init.rb” file. Find the following lines:



### Uncomment for DataMapper ORM
# use_orm :datamapper

### Uncomment for ActiveRecord ORM
# use_orm :activerecord

### Uncomment for Sequel ORM
# use_orm :sequel

and uncomment the datamapper line, like this



### Uncomment for DataMapper ORM
use_orm :datamapper

### Uncomment for ActiveRecord ORM
# use_orm :activerecord

### Uncomment for Sequel ORM
# use_orm :sequel

This then tells our application to use and load the DataMapper database plugin. Further down in that file you’ll see something similar for testing, and you can choose whether to use rspec, or test_unit. Using rspec is the default. After we change the database settings, we run:



merb-gen

to get it to generate database config. This will create the file “database.sample.yml” in the “config” folder, which we can rename to “database.yml”, and configure correctly. Here is a sample development configuration set to use sqlite3:



:development: &defaults
:adapter: sqlite3
:database: db/testapp_development.sqlite3

Remember to create the “db” directory. Now to finish off our test application, we can create a dummy controller and views, to see our application in action.



merb-gen resource person first_name:string last_name:string date_of_birth:date

Now we need to migrate the data to take into account the new model. Note there are no migration files like in Rails, however there is a Rake task to migrate the data based on the DataMapper definitions with the model classes:

rake dm:db:automigrate

That should now create the database file (“db/testapp_development.sqlite3”), and we should now be able to play around with the model within our application. First, let’s run the application via the console, and inspect the new model:



merb -i
>> Person.count

This will display a count of 0, as there are no people in the database yet. Let’s create one:

>> Person.create({:first_name => "test", :last_name => "dude", :date_of_birth => Time.now})

Only this returns an error!



DataObject::QueryError: Your query failed.
table people has no column named date_of_birth

For some reason, the migrations within DataMapper tend to be a bit erratic - there is a console command you can run however that will often fix issues and sync the model definitions to the database more accurately:



>> DataMapper::Persistence::auto_migrate!

Running our create command from before should now work as expected, with a Person object returned and saved with an ID of 1. You can check to ensure that there is a Person object:



>> Person.count
=> 1
>> Person.all
=> [#Person]
>> Person.first
=> #Person
>> Person[1]
=> #Person

The above queries show how to retrieve all Person instances within the database, just the first, or a specific Person by ID. In this case, the same (and only) Person instance is returned (it’s returned as an array with a single element in the “Person.all” query). But now let’s check out the real deal, and see the web interface - fire it up by just running:



merb

This will start the server, and you can now browse to http://localhost:4000 to see the application. This will show a Merb error page, saying that no route matches the request “/”. This is because while we have a single resource within the application, it’s setup to be exposed by default at http://localhost:4000/people. Browse to that url, and you’ll see the default Merb generated view. Let’s hook this up to the root of the application so it’s accessible at the easier to remember url http://localhost:4000. Within the “router.rb” file in the “config” folder, look for the following lines:



# Change this for your home page to be available at /
# r.match('/').to(:controller => 'whatever', :action =>'index')

and change the second line to read the following (uncommenting it, and changing the controller to our “people” controller):



r.match('/').to(:controller => 'people', :action =>'index')

Now browsing to http://localhost:4000 will show you the same default view for the “people” index as it would if you were browsing http://localhost:4000/people. You can now customize these views to display and interact the models, in a similar fashion as you would do in Rails!



One other thing to bear in mind is that Merb apps default to port 4000 - however running different apps on that default port at differing times will cause issues because of the way the secret session key is managed. This will most likely be fixed in due course, but at the minute running a second app on the same port at a later date will often result in a secret key error - you can run each app on a different port, or simply find the cookie that represents the “lock” on that port by a specific application, and remove it; then a different application won’t have issues using that port. You may well find that re-using a Merb app port with a Rails app also causes an issue, again removing the cookie should fix this.



So that’s pretty much it - a very basic Merb app, some potential pitfalls found and sidestepped, and a powerful, lightweight web application framework at your fingertips. While it’s obvious Merb is a work in progress, it’s also obvious just how useful this framework might become, especially for those looking to create more streamlined, better performing applications.

Comments

Git A Load Of This Mar 12 2008

So it’s already made the rounds on a number of blogs, but having switched to Git about five weeks ago for all my code, I’ve now been using GitHub for the last three or so weeks, and it’s a really great service. The user interface is brilliant, and the integration with Git is incredibly simple. The fact that it’s still in beta means there’s lots more to come, and they’ve been very active at adding in new features over the last few weeks too, including most recently the beginnings of an API! I’m running a number of private repos at GitHub and it’s been nothing but a joy to use. They just announced their pricing plans for when they come out of beta, and it’s more than reasonable for the service they provide. Great job guys!

Comments

Page 2 of 3 | Next page | Previous page