Yesterday I posted about RPoint for the first time and I showed you a simple script to create a site structure. All of that code is working today. I wanted to keep the example simple and show you something that was actually functional.
Today I want to dream a little. Here are a few scripts I want RPoint to be able to support.
Creating a List Template
This script would create a list template.
class Milestones
include ListTemplateMixin
name "Milestones"
description "A Simple Milestone List"
column "Milestone", Text, :is_title => true, :required => true
column "Description", RichText
column "Date", Date, :required => true, :default => :today
view "All Milestones" do
show_columns "Milestone", "Date"
end
view "Overdue Milestones" do
show_columns "Milestone", "Date"
where :date => less_than(:today)
order_by :date => :descending
end
end
Once you had defined your template, you could use it in a few different ways. First, you could use it in a site creation script:
at "http://localhost" do
create_list "My Milestones", Milestones
end
Second, and possibly cooler, you could generate a list definition:
>ir generate.rb list_definition --source MilestoneTemplate.rb
Migrations
Migrations in Rails is a great pre-defined structure for handling your database schema and changes to it over time. It may not be anything too ground-breaking on its own, but it enforces a discipline when it comes to managing your database. You are encouraged to think about situations where you want to change your database but data already exists. You can write scripts to migrate existing data to your new structure and it’s all managed within source control as an ordered list of steps to execute.
I want to be able to do something similar with RPoint.
# first migration - create my site collection
class CreateSiteMigration
at :webapp => "http://localhost" do
create_site "My Site", TeamSite
end
end
# second migration - add a list and add a lookup to that list on an existing list
class AddIssuesMigration
at "http://localhost/sites/mysite" do
create_list "Issues", Issues
update_list "Tasks" do
add_column "Related Issue", Lookup("Issues", :field => :title)
end
end
end
Okay – that’s enough dreaming for now. Just incase anyone missed the intro THIS CODE DOES NOT WORK. It is completely imaginary. I am hoping that something along these lines will become reality. And I hope that you will agree that this would be a much nicer way to create SharePoint solutions than slogging through hundreds of lines of XML.