jm81-dm-svn 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/dm-svn.gemspec +82 -0
- data/lib/dm-svn.rb +4 -3
- data/lib/dm-svn/model.rb +1 -1
- data/lib/dm-svn/svn.rb +2 -2
- data/lib/dm-svn/svn/sync.rb +2 -2
- data/spec/dm-svn/config_spec.rb +1 -1
- data/spec/dm-svn/mock_models.rb +53 -0
- data/spec/dm-svn/model_spec.rb +1 -1
- data/spec/dm-svn/spec_helper.rb +0 -3
- data/spec/dm-svn/svn/categorized_spec.rb +2 -1
- data/spec/dm-svn/svn/changeset_spec.rb +2 -1
- data/spec/dm-svn/svn/node_spec.rb +2 -1
- data/spec/dm-svn/svn/sync_spec.rb +2 -1
- data/spec/dm-svn/svn_spec.rb +6 -5
- data/spec/spec_helper.rb +0 -3
- metadata +12 -12
- data/spec/dm-svn/fixtures/fiction_site.rb +0 -84
- data/spec/dm-svn/fixtures/news_site.rb +0 -55
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -9,9 +9,9 @@ begin
|
|
9
9
|
gem.email = "jmorgan@morgancreative.net"
|
10
10
|
gem.homepage = "http://github.com/jm81/dm-svn"
|
11
11
|
gem.authors = ["Jared Morgan"]
|
12
|
-
gem.add_dependency('dm-core')
|
13
|
-
gem.add_dependency('dm-aggregates')
|
14
|
-
gem.add_dependency('dm-validations')
|
12
|
+
gem.add_dependency('dm-core', '>= 0.10.0')
|
13
|
+
gem.add_dependency('dm-aggregates', '>= 0.10.0')
|
14
|
+
gem.add_dependency('dm-validations', '>= 0.10.0')
|
15
15
|
gem.add_dependency('jm81-svn-fixture', '>= 0.1.1')
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/dm-svn.gemspec
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{dm-svn}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jared Morgan"]
|
12
|
+
s.date = %q{2009-09-19}
|
13
|
+
s.email = %q{jmorgan@morgancreative.net}
|
14
|
+
s.files = [
|
15
|
+
".gitignore",
|
16
|
+
"Rakefile",
|
17
|
+
"VERSION",
|
18
|
+
"dm-svn.gemspec",
|
19
|
+
"lib/dm-svn.rb",
|
20
|
+
"lib/dm-svn/config.rb",
|
21
|
+
"lib/dm-svn/model.rb",
|
22
|
+
"lib/dm-svn/svn.rb",
|
23
|
+
"lib/dm-svn/svn/categorized.rb",
|
24
|
+
"lib/dm-svn/svn/changeset.rb",
|
25
|
+
"lib/dm-svn/svn/node.rb",
|
26
|
+
"lib/dm-svn/svn/sync.rb",
|
27
|
+
"spec/dm-svn/config_spec.rb",
|
28
|
+
"spec/dm-svn/database.yml",
|
29
|
+
"spec/dm-svn/fixtures/articles_comments.rb",
|
30
|
+
"spec/dm-svn/mock_models.rb",
|
31
|
+
"spec/dm-svn/model_spec.rb",
|
32
|
+
"spec/dm-svn/spec_helper.rb",
|
33
|
+
"spec/dm-svn/svn/categorized_spec.rb",
|
34
|
+
"spec/dm-svn/svn/changeset_spec.rb",
|
35
|
+
"spec/dm-svn/svn/node_spec.rb",
|
36
|
+
"spec/dm-svn/svn/sync_spec.rb",
|
37
|
+
"spec/dm-svn/svn_spec.rb",
|
38
|
+
"spec/spec.opts",
|
39
|
+
"spec/spec_helper.rb"
|
40
|
+
]
|
41
|
+
s.has_rdoc = true
|
42
|
+
s.homepage = %q{http://github.com/jm81/dm-svn}
|
43
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = %q{1.3.1}
|
46
|
+
s.summary = %q{Sync content from a Subversion repository to a DataMapper model}
|
47
|
+
s.test_files = [
|
48
|
+
"spec/dm-svn/config_spec.rb",
|
49
|
+
"spec/dm-svn/fixtures/articles_comments.rb",
|
50
|
+
"spec/dm-svn/mock_models.rb",
|
51
|
+
"spec/dm-svn/model_spec.rb",
|
52
|
+
"spec/dm-svn/spec_helper.rb",
|
53
|
+
"spec/dm-svn/svn/categorized_spec.rb",
|
54
|
+
"spec/dm-svn/svn/changeset_spec.rb",
|
55
|
+
"spec/dm-svn/svn/node_spec.rb",
|
56
|
+
"spec/dm-svn/svn/sync_spec.rb",
|
57
|
+
"spec/dm-svn/svn_spec.rb",
|
58
|
+
"spec/spec_helper.rb"
|
59
|
+
]
|
60
|
+
|
61
|
+
if s.respond_to? :specification_version then
|
62
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
63
|
+
s.specification_version = 2
|
64
|
+
|
65
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
66
|
+
s.add_runtime_dependency(%q<dm-core>, [">= 0.10.0"])
|
67
|
+
s.add_runtime_dependency(%q<dm-aggregates>, [">= 0.10.0"])
|
68
|
+
s.add_runtime_dependency(%q<dm-validations>, [">= 0.10.0"])
|
69
|
+
s.add_runtime_dependency(%q<jm81-svn-fixture>, [">= 0.1.1"])
|
70
|
+
else
|
71
|
+
s.add_dependency(%q<dm-core>, [">= 0.10.0"])
|
72
|
+
s.add_dependency(%q<dm-aggregates>, [">= 0.10.0"])
|
73
|
+
s.add_dependency(%q<dm-validations>, [">= 0.10.0"])
|
74
|
+
s.add_dependency(%q<jm81-svn-fixture>, [">= 0.1.1"])
|
75
|
+
end
|
76
|
+
else
|
77
|
+
s.add_dependency(%q<dm-core>, [">= 0.10.0"])
|
78
|
+
s.add_dependency(%q<dm-aggregates>, [">= 0.10.0"])
|
79
|
+
s.add_dependency(%q<dm-validations>, [">= 0.10.0"])
|
80
|
+
s.add_dependency(%q<jm81-svn-fixture>, [">= 0.1.1"])
|
81
|
+
end
|
82
|
+
end
|
data/lib/dm-svn.rb
CHANGED
@@ -5,8 +5,9 @@ require 'dm-validations'
|
|
5
5
|
require 'svn/client'
|
6
6
|
|
7
7
|
module DmSvn
|
8
|
+
VERSION = '0.2.0'
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
require 'dm-svn/config'
|
12
|
+
require 'dm-svn/svn'
|
13
|
+
require 'dm-svn/model'
|
data/lib/dm-svn/model.rb
CHANGED
data/lib/dm-svn/svn.rb
CHANGED
data/lib/dm-svn/svn/sync.rb
CHANGED
@@ -34,13 +34,13 @@ module DmSvn
|
|
34
34
|
c.process
|
35
35
|
# Update model_row.revision
|
36
36
|
row_update = @model_row.class.get(@model_row.id)
|
37
|
-
row_update.
|
37
|
+
row_update.update(:revision => c.revision)
|
38
38
|
end
|
39
39
|
|
40
40
|
# Ensure that @model_row.revision is now set to the latest (even if there
|
41
41
|
# weren't applicable changes in the latest revision).
|
42
42
|
row_update = @model_row.class.get(@model_row.id)
|
43
|
-
row_update.
|
43
|
+
row_update.update(:revision => @repos.latest_revnum)
|
44
44
|
return true
|
45
45
|
end
|
46
46
|
|
data/spec/dm-svn/config_spec.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dm-svn'
|
3
|
+
|
4
|
+
class MockArticle
|
5
|
+
include DataMapper::Resource
|
6
|
+
include DmSvn::Svn
|
7
|
+
|
8
|
+
property :id, Serial
|
9
|
+
property :title, String
|
10
|
+
property :contents, Text, :body_property => true
|
11
|
+
end
|
12
|
+
|
13
|
+
class MockArticleNoSvn
|
14
|
+
include DataMapper::Resource
|
15
|
+
|
16
|
+
property :id, Serial
|
17
|
+
property :title, String
|
18
|
+
property :contents, Text
|
19
|
+
end
|
20
|
+
|
21
|
+
class MockSyncModel
|
22
|
+
include DataMapper::Resource
|
23
|
+
include DmSvn::Svn
|
24
|
+
|
25
|
+
property :id, Serial
|
26
|
+
property :title, String
|
27
|
+
property :body, Text, :body_property => true
|
28
|
+
property :published_at, DateTime
|
29
|
+
property :random_number, Integer # because some tests need a non-datetime prop
|
30
|
+
end
|
31
|
+
|
32
|
+
class MockCategory
|
33
|
+
include DataMapper::Resource
|
34
|
+
include DmSvn::Svn
|
35
|
+
has n, :mock_categorized_articles
|
36
|
+
|
37
|
+
property :id, Serial
|
38
|
+
property :title, String
|
39
|
+
property :random_number, Integer
|
40
|
+
end
|
41
|
+
|
42
|
+
class MockCategorizedArticle
|
43
|
+
include DataMapper::Resource
|
44
|
+
include DmSvn::Svn
|
45
|
+
belongs_to :mock_category, :svn => true
|
46
|
+
|
47
|
+
property :id, Serial
|
48
|
+
property :title, String
|
49
|
+
property :article, String
|
50
|
+
property :body, Text, :body_property => true
|
51
|
+
property :published_at, DateTime
|
52
|
+
property :random_number, Integer # because some tests need a non-datetime prop
|
53
|
+
end
|
data/spec/dm-svn/model_spec.rb
CHANGED
data/spec/dm-svn/spec_helper.rb
CHANGED
data/spec/dm-svn/svn_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dm-svn/mock_models'
|
2
3
|
|
3
4
|
describe DmSvn::Svn do
|
4
5
|
before(:all) do
|
@@ -13,7 +14,7 @@ describe DmSvn::Svn do
|
|
13
14
|
it "should add svn_* properties" do
|
14
15
|
fields = %w{name created_at updated_at created_rev updated_rev created_by updated_by}
|
15
16
|
fields.each do | field |
|
16
|
-
|
17
|
+
MockArticleNoSvn.properties["svn_#{field}"].should be_nil
|
17
18
|
MockArticle.properties["svn_#{field}"].should be_kind_of(DataMapper::Property)
|
18
19
|
end
|
19
20
|
end
|
@@ -53,7 +54,7 @@ describe DmSvn::Svn do
|
|
53
54
|
end
|
54
55
|
|
55
56
|
it 'should update path, body and other properties' do
|
56
|
-
@node.should_receive(:body).twice.and_return('body')
|
57
|
+
@node.should_receive(:body).twice.and_return('body')
|
57
58
|
@node.should_receive(:short_path).and_return('short/path')
|
58
59
|
@node.should_receive(:properties).and_return(
|
59
60
|
{'title' => 'Title', 'svn_updated_by' => 'jmorgan'}
|
@@ -61,8 +62,8 @@ describe DmSvn::Svn do
|
|
61
62
|
|
62
63
|
@article.should_receive(:attribute_set).with(:svn_name, 'short/path')
|
63
64
|
@article.should_receive(:attribute_set).with('contents', 'body')
|
64
|
-
@article.should_receive(:
|
65
|
-
@article.should_receive(:
|
65
|
+
@article.should_receive(:title=).with('Title')
|
66
|
+
@article.should_receive(:svn_updated_by=).with('jmorgan')
|
66
67
|
|
67
68
|
@article.should_receive(:save)
|
68
69
|
@article.update_from_svn(@node)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jm81-dm-svn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Morgan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-19 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.10.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: dm-aggregates
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.10.0
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: dm-validations
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 0.10.0
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: jm81-svn-fixture
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- .gitignore
|
65
65
|
- Rakefile
|
66
66
|
- VERSION
|
67
|
+
- dm-svn.gemspec
|
67
68
|
- lib/dm-svn.rb
|
68
69
|
- lib/dm-svn/config.rb
|
69
70
|
- lib/dm-svn/model.rb
|
@@ -75,8 +76,7 @@ files:
|
|
75
76
|
- spec/dm-svn/config_spec.rb
|
76
77
|
- spec/dm-svn/database.yml
|
77
78
|
- spec/dm-svn/fixtures/articles_comments.rb
|
78
|
-
- spec/dm-svn/
|
79
|
-
- spec/dm-svn/fixtures/news_site.rb
|
79
|
+
- spec/dm-svn/mock_models.rb
|
80
80
|
- spec/dm-svn/model_spec.rb
|
81
81
|
- spec/dm-svn/spec_helper.rb
|
82
82
|
- spec/dm-svn/svn/categorized_spec.rb
|
@@ -86,8 +86,9 @@ files:
|
|
86
86
|
- spec/dm-svn/svn_spec.rb
|
87
87
|
- spec/spec.opts
|
88
88
|
- spec/spec_helper.rb
|
89
|
-
has_rdoc:
|
89
|
+
has_rdoc: true
|
90
90
|
homepage: http://github.com/jm81/dm-svn
|
91
|
+
licenses:
|
91
92
|
post_install_message:
|
92
93
|
rdoc_options:
|
93
94
|
- --charset=UTF-8
|
@@ -108,15 +109,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
requirements: []
|
109
110
|
|
110
111
|
rubyforge_project:
|
111
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.3.5
|
112
113
|
signing_key:
|
113
|
-
specification_version:
|
114
|
+
specification_version: 2
|
114
115
|
summary: Sync content from a Subversion repository to a DataMapper model
|
115
116
|
test_files:
|
116
117
|
- spec/dm-svn/config_spec.rb
|
117
118
|
- spec/dm-svn/fixtures/articles_comments.rb
|
118
|
-
- spec/dm-svn/
|
119
|
-
- spec/dm-svn/fixtures/news_site.rb
|
119
|
+
- spec/dm-svn/mock_models.rb
|
120
120
|
- spec/dm-svn/model_spec.rb
|
121
121
|
- spec/dm-svn/spec_helper.rb
|
122
122
|
- spec/dm-svn/svn/categorized_spec.rb
|
@@ -1,84 +0,0 @@
|
|
1
|
-
SvnFixture.repo('fiction_site') do
|
2
|
-
revision(1, 'Create basic directory structure (including articles, app and public)',
|
3
|
-
:date => Time.parse("2008-08-01")) do
|
4
|
-
dir 'articles'
|
5
|
-
dir 'app' do
|
6
|
-
dir 'views' do
|
7
|
-
dir 'ads'
|
8
|
-
dir 'articles'
|
9
|
-
dir 'layouts'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
dir 'public' do
|
14
|
-
dir 'images'
|
15
|
-
dir 'javascripts'
|
16
|
-
dir 'stylesheets'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
revision(2, 'Create scifi, fantasy, and western categories',
|
21
|
-
:date => Time.parse("2008-08-02")) do
|
22
|
-
dir 'articles' do
|
23
|
-
dir 'scifi' do
|
24
|
-
prop 'ws:name', 'Science Fiction'
|
25
|
-
end
|
26
|
-
|
27
|
-
dir 'fantasy' do
|
28
|
-
prop 'ws:name', 'Fantasy'
|
29
|
-
end
|
30
|
-
|
31
|
-
dir 'western' do
|
32
|
-
prop 'ws:name', 'Western'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
revision(3, 'Add two stories in scifi',
|
38
|
-
:date => Time.parse("2008-08-03")) do
|
39
|
-
dir 'articles' do
|
40
|
-
dir 'scifi' do
|
41
|
-
file 'aliens.txt' do
|
42
|
-
prop 'ws:title', 'Alien Story'
|
43
|
-
prop 'ws:published_at', '2008-08-04 12:00:00'
|
44
|
-
body "My first story featuring aliens."
|
45
|
-
end
|
46
|
-
|
47
|
-
file 'spaceships.txt' do
|
48
|
-
prop 'ws:title', 'Spaceship'
|
49
|
-
prop 'ws:published_at', '2008-08-06 12:00:00'
|
50
|
-
body "This one's just about spaceships."
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
revision(4, 'Add scifi/alien subcategory and move aliens.txt there',
|
57
|
-
:date => Time.parse("2008-08-04")) do
|
58
|
-
dir 'articles' do
|
59
|
-
dir 'scifi' do
|
60
|
-
dir 'alien' do
|
61
|
-
file 'meta.yml' do
|
62
|
-
body "name: Alien Stories"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
move 'aliens.txt', 'alien/first.txt'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
revision(5, 'Add unpublished fantasy story',
|
72
|
-
:date => Time.parse("2008-08-06")) do
|
73
|
-
dir 'articles' do
|
74
|
-
dir 'fantasy' do
|
75
|
-
file 'knights.txt' do
|
76
|
-
prop 'ws:title', 'Knights'
|
77
|
-
body "A story...with knights!"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
SvnFixture.repo('fiction_site').commit
|
@@ -1,55 +0,0 @@
|
|
1
|
-
SvnFixture::repo('news_site') do
|
2
|
-
revision(1, 'Create basic directory structure (including articles, app and public)',
|
3
|
-
:date => Time.parse("2008-08-01")) do
|
4
|
-
dir 'articles'
|
5
|
-
dir 'app' do
|
6
|
-
dir 'views' do
|
7
|
-
dir 'ads'
|
8
|
-
dir 'articles'
|
9
|
-
dir 'layouts'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
dir 'public' do
|
14
|
-
dir 'images'
|
15
|
-
dir 'javascripts'
|
16
|
-
dir 'stylesheets'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
revision(2, 'Create categories',
|
21
|
-
:date => Time.parse("2008-08-02")) do
|
22
|
-
dir 'articles' do
|
23
|
-
dir 'sports' do
|
24
|
-
prop 'ws:name', 'Sports'
|
25
|
-
end
|
26
|
-
|
27
|
-
dir 'politics' do
|
28
|
-
prop 'ws:name', 'Politics'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
revision(3, 'Add two articles',
|
34
|
-
:date => Time.parse("2008-08-03")) do
|
35
|
-
dir 'articles' do
|
36
|
-
dir 'sports' do
|
37
|
-
file 'football.txt' do
|
38
|
-
prop 'ws:title', 'Football'
|
39
|
-
prop 'ws:published_at', '2008-08-04 12:00:00'
|
40
|
-
body "A football story."
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
dir 'politics' do
|
45
|
-
file 'election.txt' do
|
46
|
-
prop 'ws:title', 'Election Review'
|
47
|
-
prop 'ws:published_at', '2008-08-04 12:00:00'
|
48
|
-
body "The election seems to go on for a long time."
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
SvnFixture.repo('news_site').commit
|