ejdraper.com

  • About
  • Contact
  • Archive
  • RSS
  • Ask me anything

Setup Feather to run as a slice within a Merb app

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.

    • #feather
    • #github
    • #merb
    • #ruby
    • #slice
    • #slices
  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

ReCover

I’ve just pushed out the second version of Cover-Up, and so it should be available via gem within a few hours.

Version 0.2 includes the following:

  • fixed a couple of bugs
  • added the option to provide your own logger to the code coverage run (see README)
  • few improvements to try and speed the code coverage execution up a bit

The speed improvements will be fairly useful as the initial version was a bit sluggish, although I still have more work I’d like to do in this area to try and speed up the code coverage even further.

The logger is useful for those that want to run their own traces over the code during the code coverage run, or simply for tracking down a problem that isn’t obvious in the results that Cover-Up returns already. Obviously any code you add in as a logger will potentially slow the code coverage run down further though.

So if anyone is interested, please take a look, and any questions, comments, or suggestions, please let me know! It’s still a work in progress but it is getting better all the time!

    • #code-coverage
    • #cover-up
    • #ruby
  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Cover-Up

I started writing a new tool on Monday, a flexible, dynamic code coverage gem written in Ruby, for Ruby code. rcov is useful, but I needed the ability to easily wrap any Ruby code in coverage, dynamically at runtime, and I wanted more flexibility in the results that come back. There are probably ways to achieve both of these with rcov given the right options, but I wanted something that offered this out of the box, in an easy to use manner. I also thought it’d be fun to write something that’d work out the coverage of any Ruby code you give it.

Introducing… Cover-Up! Hosted over at GitHub It’s a really straightforward code coverage tool, and once installed, you simply need to do the following:

# load the gem
gem "cover-up"
require "cover-up"

# initiate the coverage, specifying a pattern for the files to be covered
results = coverage(:include => "app/*/**.rb") do
    # execute the code to be covered
    run_my_tests
end

results # this will contain the code coverage results

In the above example, the coverage would execute the “run_my_tests” method, and would match the code executed against the files specified with the input pattern, in this case, any Ruby files within a subfolder of “app”. It would then produce the statistics to say how many of the lines within those files were hit, how many weren’t, and how many were excluded (such as comments and whitespace etc).

All of those statistics are within the results object that comes back, and can be accessed as a whole, or on a file-by-file basis. This makes it really easy not just to run coverage over tests, but over other ad-hoc Ruby code too, to see what code is being executed by a given action. It also makes it really easy to hook up to your app, and to format the results however you want.

It’s only a couple of days old at the minute, and so is unlikely to be perfect - but I think it’s a good start, and even has tests of it’s own, so feel free to grab the gem which should be available depending upon the gem server mirrors over the next few hours:

sudo gem install cover-up

Or grab it from GitHub. Feel free to fork and improve the source too, patches very much welcome! I’m going to keep improving it over the coming days, so keep an eye on the code!

    • #code-coverage
    • #cover-up
    • #gem
    • #github
    • #ruby
    • #rubyforge
  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Changes

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.

    • #-net
    • #feather
    • #job
    • #ruby
    • #work
  • 4 years ago
  • Comments
  • Permalink
  • Share
    Tweet

RIDE-ME, one time

So, RIDE-ME has hit version one, and I’m proud to say I was able to be a part of it. In fact this is the first release that has some of my work in it, namely the add-in architecture, and the console add-in built on top of that. It’s shaping up pretty nicely now, and recently I’ve been working on a Rails project using RM with almost no problems. I know I’m a bit behind the times blogging about the release, but come on people, please digg it - we are getting plenty of downloads but a spot on the digg.com frontpage wouldn’t go a miss ;-)

    • #coding
    • #el
    • #eldiablo
    • #ruby
    • #tech
    • #web-20
  • 5 years ago
  • Comments
  • Permalink
  • Share
    Tweet
← Newer • Older →
Page 3 of 7

About

Elliott Draper runs KickCode Ltd, a web and mobile development company specialising in Ruby on Rails.

Elsewhere

  • ejdraper on Forrst
  • @ejdraper on Twitter
  • Facebook Profile
  • ejdraper on Last.fm
  • My Skype Info
  • ejdraper on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr