dynarex-usersblog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dynarex-usersblog.rb +33 -0
  2. metadata +55 -0
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # file: dynarex-usersblog.rb
4
+
5
+ require 'dynarex-blog'
6
+ require 'fileutils'
7
+
8
+ class DynarexUsersBlog
9
+
10
+ def initialize(user)
11
+ @current_user = user
12
+
13
+ user_file_path = 'users/' + @current_user
14
+ FileUtils.mkdir_p user_file_path
15
+
16
+ @user_blog = DynarexBlog.new user_file_path
17
+ @master_blog = DynarexBlog.new
18
+
19
+ super()
20
+ end
21
+
22
+ def create_entry(blog_params={})
23
+ blog_params.merge!({user: @current_user})
24
+ @user_blog.create_entry blog_params
25
+ @master_blog.id = @user_blog.id.to_i - 1
26
+ @master_blog.create_entry blog_params
27
+ end
28
+
29
+ def delete(id=0)
30
+ @user_blog.delete id
31
+ @master_blog.delete id
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dynarex-usersblog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors: []
7
+
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-06-23 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email:
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/dynarex-usersblog.rb
26
+ has_rdoc: true
27
+ homepage:
28
+ licenses: []
29
+
30
+ post_install_message:
31
+ rdoc_options: []
32
+
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: "0"
40
+ version:
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ requirements: []
48
+
49
+ rubyforge_project:
50
+ rubygems_version: 1.3.5
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: dynarex-usersblog
54
+ test_files: []
55
+