tdiary-io-mongodb 0.0.2 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 114f562916eb47fba2815a72cb0a4aed1a028f5e
4
- data.tar.gz: f41a5913047cf0c763f6831f6c64a2fbeb98476d
3
+ metadata.gz: cd626291a08fa158deffecdd80c5c7d97c155df6
4
+ data.tar.gz: 6daee2e028071f83a88d8079efb2fdcc7f781e94
5
5
  SHA512:
6
- metadata.gz: f64701eff4db012e0d29403ae3213a90e49168f25aca9ff8e619719f0b0e8f616afb6ebc8969b4a68c2b158e42d849717593bbda0e6c085ee55dc44370442f5a
7
- data.tar.gz: 30e2ff164dee5657d62e0baceac33a53a98daa7df64894839cbf413d55edeffd42853021fb3bd85dbbcb352787563002e9bdc85b24c3acaf80de0e30a6f403e1
6
+ metadata.gz: f8a761e3561fce36d15c3e154e3c33305bd3d4a018e51ac303f4b30aeed143444dbe05e9f15f10d28e9b5f9f04f3c9776cf29e6905640159bf8d986c4ffb8dd0
7
+ data.tar.gz: 57170406c2ede48bb2a61eaf38c13349b5f83a79195292f7c217655b45b554029a3de4aad52b2b7119b511f58dcaf3e659a7c286f748a68a20678308fe341092
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "tdiary-io-mongodb"
7
- spec.version = "0.0.2"
7
+ spec.version = "4.1.0"
8
8
  spec.authors = ["TADA Tadashi"]
9
9
  spec.email = ["t@tdtds.jp"]
10
10
  spec.description = %q{MongoDB adapter for tDiary}
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "mongoid"
21
- spec.add_dependency "hikidoc"
22
21
 
23
22
  spec.add_development_dependency "bundler", "~> 1.3"
24
23
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-io-mongodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TADA Tadashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2014-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: hikidoc
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -97,8 +83,7 @@ dependencies:
97
83
  description: MongoDB adapter for tDiary
98
84
  email:
99
85
  - t@tdtds.jp
100
- executables:
101
- - tdiary-mongodb-convert
86
+ executables: []
102
87
  extensions: []
103
88
  extra_rdoc_files: []
104
89
  files:
@@ -108,7 +93,6 @@ files:
108
93
  - LICENSE.txt
109
94
  - README.md
110
95
  - Rakefile
111
- - bin/tdiary-mongodb-convert
112
96
  - lib/tdiary/io/mongodb.rb
113
97
  - spec/spec_helper.rb
114
98
  - spec/tdiary/io/mongodb_spec.rb
@@ -133,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
117
  version: '0'
134
118
  requirements: []
135
119
  rubyforge_project:
136
- rubygems_version: 2.4.5
120
+ rubygems_version: 2.2.2
137
121
  signing_key:
138
122
  specification_version: 4
139
123
  summary: MongoDB adapter for tDiary
@@ -1,88 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'optparse'
4
- require 'erb'
5
- require 'tdiary/view_helper'
6
- require 'tdiary/base'
7
- require 'tdiary/comment'
8
- require 'tdiary/comment_manager'
9
- require 'tdiary/referer_manager'
10
- require 'tdiary/style'
11
- require 'tdiary/cache/file'
12
- require 'ostruct'
13
-
14
- def load_diaries(data_path, style_path)
15
- require 'tdiary/io/default'
16
-
17
- options = {
18
- 'style.path' => style_path
19
- }
20
- conf = OpenStruct.new({
21
- data_path: "#{data_path}/",
22
- options: options
23
- })
24
- tdiary = OpenStruct.new({conf: conf})
25
- default_io = TDiary::IO::Default.new(tdiary)
26
-
27
- default_io.calendar.each do |y, ms|
28
- ms.each do |m|
29
- puts "loading #{y}-#{m}"
30
- month = Time.local(y.to_i, m.to_i)
31
- default_io.transaction(month) do |diaries|
32
- yield month, diaries
33
- TDiary::TDiaryBase::DIRTY_NONE
34
- end
35
- end
36
- end
37
- end
38
-
39
- def update_diaries(mongodb_io, month, new_diaries)
40
- mongodb_io.transaction(month) do |diaries|
41
- diaries.update(new_diaries)
42
- TDiary::TDiaryBase::DIRTY_DIARY | TDiary::TDiaryBase::DIRTY_COMMENT
43
- end
44
- end
45
-
46
- def store_diaries(data_path, style_path, mongo_url = nil)
47
- require 'tdiary/io/mongodb'
48
-
49
- options = {'style.path' => [style_path]}
50
- conf = OpenStruct.new({options: options, database_url: mongo_url})
51
- tdiary = OpenStruct.new({conf: conf})
52
- TDiary::IO::MongoDB.load_cgi_conf(conf)
53
- mongodb_io = TDiary::IO::MongoDB.new(tdiary)
54
-
55
- load_diaries(data_path, style_path) do |month, diaries|
56
- update_diaries(mongodb_io, month, diaries)
57
- end
58
- end
59
-
60
- def store_conf(conf_path, mongo_url = nil)
61
- require 'tdiary/io/mongodb'
62
-
63
- conf = OpenStruct.new({options: {}, database_url: mongo_url})
64
- tdiary = OpenStruct.new({conf: conf})
65
-
66
- TDiary::IO::MongoDB.save_cgi_conf(conf, open(conf_path, &:read))
67
- end
68
-
69
- args = {}
70
- OptionParser.new do |opts|
71
- opts.banner = 'Usage: tdiary-mongodb-convert [options] <data_path>'
72
- opts.on('-c CONF', '--conf=CONF', 'store only tdiary.conf'){|v| args[:conf] = v}
73
- opts.on('-s PATH', '--style=STYLE', 'style path'){|v| args[:style] = v}
74
- opts.on('-m URL', '--mongo=URL', 'URL of mongoDB'){|v| args[:mongo] = v}
75
- opts.parse!(ARGV)
76
-
77
- args[:data] = ARGV.shift
78
- unless args[:data] || args[:conf]
79
- $stderr.print opts.help
80
- exit 1
81
- end
82
- end
83
-
84
- if args[:conf]
85
- store_conf(args[:conf], args[:mongo])
86
- else
87
- store_diaries(args[:data], args[:style], args[:mongo])
88
- end