Skip to content

Commit

Permalink
switch to datamapper version 1.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Jun 14, 2010
1 parent c2e7a52 commit f6243dd
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
/pkg
*~
*~
target
19 changes: 0 additions & 19 deletions Manifest.txt

This file was deleted.

9 changes: 2 additions & 7 deletions Rakefile
@@ -1,19 +1,14 @@
# -*- ruby -*-

require 'rubygems'
require 'hoe'
require './lib/rack_datamapper/version.rb'

require 'spec'
require 'spec/rake/spectask'
require 'pathname'
require 'yard'

Hoe.spec('rack-datamapper') do |p|
p.developer('mkristian', 'm.kristian@web.de')
p.extra_deps = [['dm-core', '>0.9.10']]
p.rspec_options << '--options' << 'spec/spec.opts'
end
desc "Run specs"
Spec::Rake::SpecTask.new('spec')

desc 'Install the package as a gem.'
task :install => [:clean, :package] do
Expand Down
9 changes: 9 additions & 0 deletions gemspec_to_pom.rb
@@ -0,0 +1,9 @@
#!/bin/ruby
require 'rubygems'

raise "needs rubygems version >=1.3.6" if Gem::VERSION < "1.3.6"
load '../jruby-maven-plugins/gem-proxy/src/main/resources/gem_artifacts.rb'
m = Maven::LocalRepository.new
File.open("pom.xml", "w") do |f|
f << m.to_pomxml('rack_datamapper.gemspec')
end
4 changes: 1 addition & 3 deletions lib/rack_datamapper/identity_maps.rb
Expand Up @@ -6,11 +6,9 @@ def initialize(app, name = :default)
end

def call(env)
status, headers, response = nil, nil, nil
DataMapper.repository(@name) do
status, headers, response = @app.call(env)
@app.call(env)
end
[status, headers, response]
end
end
end
4 changes: 2 additions & 2 deletions lib/rack_datamapper/session/abstract/store.rb
Expand Up @@ -101,9 +101,9 @@ def self.default_storage_name

property :session_id, String, :key => true

property :data, Text, :nullable => false, :default => ::Base64.encode64(Marshal.dump({}))
property :data, Text, :required => true, :default => ::Base64.encode64(Marshal.dump({}))

property :updated_at, DateTime, :nullable => true, :index => true
property :updated_at, DateTime, :required => false, :index => true

def data=(data)
attribute_set(:data, ::Base64.encode64(Marshal.dump(data)))
Expand Down
2 changes: 1 addition & 1 deletion lib/rack_datamapper/version.rb
@@ -1,5 +1,5 @@
module Rack
module DataMapper
VERSION = '0.2.5'.freeze
VERSION = '0.3.0'.freeze
end
end
91 changes: 91 additions & 0 deletions pom.xml
@@ -0,0 +1,91 @@
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>rubygems</groupId>
<artifactId>rack-datamapper</artifactId>
<version>0.3.0</version>
<packaging>gem</packaging>
<name><![CDATA[this collection of plugins helps to add datamapper functionality to Rack]]></name>
<description><![CDATA[this collection of plugins helps to add datamapper functionality to Rack. there is a IdentityMaps plugin which wrappes the request and with it all database actions are using that identity map. the transaction related plugin TransactionBoundaries and RestfulTransactions wrappes the request into a transaction. for using datamapper to store session data there is the DatamapperStore.]]></description>
<url>http://github.com/mkristian/rack_datamapper</url>
<dependencies>
<dependency>
<groupId>rubygems</groupId>
<artifactId>dm-core</artifactId>
<version>[1.0.0,1.0.99999.99999)</version>
<type>gem</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>rack</artifactId>
<version>[1.0.0,1.99999.99999)</version>
<type>gem</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>dm-migrations</artifactId>
<version>[1.0.0,1.0.99999.99999)</version>
<type>gem</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>dm-transactions</artifactId>
<version>[1.0.0,1.0.99999.99999)</version>
<type>gem</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>dm-sqlite-adapter</artifactId>
<version>[1.0.0,1.0.99999.99999)</version>
<type>gem</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>rspec</artifactId>
<version>[1.3.0,1.3.99999.99999)</version>
<type>gem</type>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>rubygems</id>
<url>http://gems.saumya.de/releases</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jruby.plugins.version>0.12.1-SNAPSHOT</jruby.plugins.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>rspec-maven-plugin</artifactId>
<version>${jruby.plugins.version}</version>
</plugin>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>${jruby.plugins.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
33 changes: 33 additions & 0 deletions rack_datamapper.gemspec
@@ -0,0 +1,33 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{rack-datamapper}
s.version = "0.3.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["mkristian"]
s.date = %q{2010-06-13}
s.description = %q{this collection of plugins helps to add datamapper functionality to Rack. there is a IdentityMaps plugin which wrappes the request and with it all database actions are using that identity map. the transaction related plugin TransactionBoundaries and RestfulTransactions wrappes the request into a transaction. for using datamapper to store session data there is the DatamapperStore.}
s.email = ["m.kristian@web.de"]
s.extra_rdoc_files = ["History.txt", "README.txt"]
s.files = ["History.txt", "MIT-LICENSE", "README.txt", "Rakefile"]
s.files = s.files +
Dir.glob("lib/*jar") +
Dir.glob("lib/**/*rb")
s.test_files = Dir.glob("spec/**/*.rb")
s.homepage = %q{http://github.com/mkristian/rack_datamapper}
s.rdoc_options = ["--main", "README.txt"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{rack-datamapper}
s.rubygems_version = %q{1.3.5}
s.summary = %q{this collection of plugins helps to add datamapper functionality to Rack}

s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0"])
s.add_runtime_dependency(%q<rack>, ["~> 1.0"])

s.add_development_dependency(%q<dm-migrations>, ["~> 1.0.0"])
s.add_development_dependency(%q<dm-transactions>, ["~> 1.0.0"])
s.add_development_dependency(%q<dm-sqlite-adapter>, ["~> 1.0.0"])
s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
end

3 changes: 2 additions & 1 deletion spec/spec_helper.rb
@@ -1,9 +1,10 @@
require 'pathname'
require 'rubygems'
#gem 'dm-core', '0.9.10'
$LOAD_PATH << Pathname(__FILE__).dirname.parent.expand_path + 'lib'
require 'rack_datamapper'
require 'dm-core/version'
require 'dm-migrations'
require 'dm-transactions'
p DataMapper::VERSION
def load_driver(name, default_uri)
return false if ENV['ADAPTER'] != name.to_s
Expand Down

0 comments on commit f6243dd

Please sign in to comment.