ohm 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -47
- data/test/references_test.rb +29 -0
- metadata +4 -3
data/Rakefile
CHANGED
@@ -1,16 +1,10 @@
|
|
1
|
-
require 'rake/clean'
|
2
1
|
require "rake/testtask"
|
3
2
|
require 'rake/gempackagetask'
|
4
3
|
|
5
4
|
task :default => :test
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def gem_spec
|
12
|
-
$gem_spec ||= eval(File.read(gem_spec_file)) rescue nil
|
13
|
-
end
|
6
|
+
gem_spec_file = 'ohm.gemspec'
|
7
|
+
gem_spec = eval(File.read(gem_spec_file)) rescue nil
|
14
8
|
|
15
9
|
desc 'Run all tests'
|
16
10
|
Rake::TestTask.new(:test) do |t|
|
@@ -37,42 +31,3 @@ desc "Builds and installs the gem."
|
|
37
31
|
task :install => :repackage do
|
38
32
|
`sudo gem install pkg/#{gem_spec.name}-#{gem_spec.version}.gem`
|
39
33
|
end
|
40
|
-
|
41
|
-
def package(ext='')
|
42
|
-
"pkg/ohm-#{gem_spec.version}" + ext
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'Build packages'
|
46
|
-
task :package => %w[.gem .tar.gz].map {|e| package(e)}
|
47
|
-
|
48
|
-
desc 'Build and install as local gem'
|
49
|
-
task :install => package('.gem') do
|
50
|
-
sh "gem install #{package('.gem')}"
|
51
|
-
end
|
52
|
-
|
53
|
-
directory 'pkg/'
|
54
|
-
CLOBBER.include('pkg')
|
55
|
-
|
56
|
-
file package('.gem') => %w[pkg/ ohm.gemspec] + gem_spec.files do |f|
|
57
|
-
sh "gem build ohm.gemspec"
|
58
|
-
mv File.basename(f.name), f.name
|
59
|
-
end
|
60
|
-
|
61
|
-
file package('.tar.gz') => %w[pkg/] + gem_spec.files do |f|
|
62
|
-
sh <<-SH
|
63
|
-
git archive \
|
64
|
-
--prefix=ohm-#{gem_spec.version}/ \
|
65
|
-
--format=tar \
|
66
|
-
HEAD | gzip > #{f.name}
|
67
|
-
SH
|
68
|
-
end
|
69
|
-
|
70
|
-
# Rubyforge Release / Publish Tasks ==================================
|
71
|
-
|
72
|
-
desc 'Publish gem and tarball to rubyforge'
|
73
|
-
task 'release' => [package('.gem'), package('.tar.gz')] do |t|
|
74
|
-
sh <<-end
|
75
|
-
rubyforge add_release ohm ohm #{gem_spec.version} #{package('.gem')} &&
|
76
|
-
rubyforge add_file ohm ohm #{gem_spec.version} #{package('.tar.gz')}
|
77
|
-
end
|
78
|
-
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
module Ohm
|
4
|
+
class Reference
|
5
|
+
attr :model, :id
|
6
|
+
|
7
|
+
def initialize(model, id)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.marshal_load(*args)
|
11
|
+
1
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class ReferencesTest < Test::Unit::TestCase
|
17
|
+
class Referee < Ohm::Model
|
18
|
+
end
|
19
|
+
|
20
|
+
test "dump" do
|
21
|
+
model = Referee.new.create
|
22
|
+
|
23
|
+
ref = Ohm::Reference.new(Referee, 1)
|
24
|
+
|
25
|
+
$redis["foo"] = ref
|
26
|
+
|
27
|
+
#assert_equal Referee[1], $redis["foo"]
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens, Damian Janowski
|
@@ -13,14 +13,14 @@ date: 2009-03-13 00:00:00 -02:00
|
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: redis
|
16
|
+
name: ezmobius-redis-rb
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.0.3
|
24
24
|
version:
|
25
25
|
description:
|
26
26
|
email: michel@soveran.com
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- test/db/dump.rdb
|
41
41
|
- test/db/redis.pid
|
42
42
|
- test/model_test.rb
|
43
|
+
- test/references_test.rb
|
43
44
|
- test/test.conf
|
44
45
|
- test/test_helper.rb
|
45
46
|
- test/validations_test.rb
|