RuGPost 0.1.0.1.beta → 0.1.1

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.
Files changed (43) hide show
  1. data/Gemfile +6 -6
  2. data/Gemfile.lock +34 -5
  3. data/README.rdoc +43 -3
  4. data/Rakefile +13 -39
  5. data/RuGPost.gemspec +54 -12
  6. data/VERSION +1 -1
  7. data/bin/rugpost +9 -0
  8. data/lib/RuGPost.rb +26 -0
  9. data/lib/rugpost/commands.rb +15 -0
  10. data/lib/rugpost/commands/post_commands.rb +20 -0
  11. data/lib/rugpost/commands/project_commands.rb +23 -0
  12. data/lib/rugpost/on_error.rb +6 -0
  13. data/lib/rugpost/post.rb +96 -0
  14. data/lib/rugpost/prepost.rb +10 -0
  15. data/lib/rugpost/project.rb +34 -0
  16. data/lib/rugpost/site.rb +6 -0
  17. data/lib/rugpost/utilis.rb +27 -0
  18. data/rdoc/classes/RuGPost.html +200 -0
  19. data/rdoc/classes/RuGPost/Post.html +462 -0
  20. data/rdoc/classes/RuGPost/Project.html +210 -0
  21. data/rdoc/classes/RuGPost/Site.html +111 -0
  22. data/rdoc/classes/RuGPost/Utilis.html +196 -0
  23. data/rdoc/created.rid +1 -0
  24. data/rdoc/files/README_rdoc.html +204 -0
  25. data/rdoc/files/lib/RuGPost_rb.html +113 -0
  26. data/rdoc/files/lib/rugpost/commands/post_commands_rb.html +101 -0
  27. data/rdoc/files/lib/rugpost/commands/project_commands_rb.html +101 -0
  28. data/rdoc/files/lib/rugpost/commands_rb.html +108 -0
  29. data/rdoc/files/lib/rugpost/on_error_rb.html +101 -0
  30. data/rdoc/files/lib/rugpost/post_rb.html +101 -0
  31. data/rdoc/files/lib/rugpost/prepost_rb.html +101 -0
  32. data/rdoc/files/lib/rugpost/project_rb.html +101 -0
  33. data/rdoc/files/lib/rugpost/site_rb.html +101 -0
  34. data/rdoc/files/lib/rugpost/utilis_rb.html +101 -0
  35. data/rdoc/fr_class_index.html +31 -0
  36. data/rdoc/fr_file_index.html +37 -0
  37. data/rdoc/fr_method_index.html +43 -0
  38. data/rdoc/index.html +26 -0
  39. data/rdoc/rdoc-style.css +208 -0
  40. data/spec/post_spec.rb +76 -0
  41. data/spec/project_spec.rb +40 -0
  42. data/spec/spec_helper.rb +24 -0
  43. metadata +100 -33
data/spec/post_spec.rb ADDED
@@ -0,0 +1,76 @@
1
+ describe Post do
2
+
3
+ context "creating a draft" do
4
+
5
+ it "should add a new blank file into the indicated repository" do
6
+ Post.draft( ['helloworld'], {:site=>"rugpost", :markup=>"textile"} )
7
+ File.exists?( DRAFT ).should be true
8
+ # should raise exception if file already exists in source or output folder
9
+ end
10
+
11
+ end
12
+
13
+ context "creating new post instance" do
14
+ before(:all) do
15
+ @post = Post.new( [DRAFT_NAME], {:site=>"rugpost"} )
16
+ end
17
+
18
+ it "should have metadata" do
19
+ @post.metaops[:title].should == "Hello World"
20
+ @post.metaops[:tags].should == ["Hello World", RuGPost::VERSION]
21
+ @post.metaops[:gmail].should == "project"
22
+ end
23
+
24
+ it "should have body" do
25
+ @post.src_body.should == "Hello from new *RuGPost* (#{RuGPost::VERSION}) user!"
26
+ end
27
+
28
+ it "should have html output" do
29
+ @post.html_o.should == "<p>Hello from new <strong>RuGPost</strong> (#{RuGPost::VERSION}) user!</p>"
30
+ end
31
+
32
+ it "should write right subject from metadata" do
33
+ @post.subject.should == "Hello World ((tags:Hello World,#{RuGPost::VERSION}))"
34
+ end
35
+
36
+ end
37
+
38
+ context "sending mail" do
39
+ it "should be able to send mail" do
40
+ Mail.defaults do
41
+ delivery_method :test
42
+ end
43
+ Mail::TestMailer.deliveries.length.should == 0
44
+ email = Mail.deliver do
45
+ to 'mikel@me.com'
46
+ from 'you@you.com'
47
+ subject 'testing'
48
+ body 'hello'
49
+ end
50
+ email.body.should == 'hello'
51
+ Mail::TestMailer.deliveries.length.should == 1
52
+ Mail::TestMailer.deliveries.first.should equal email
53
+ Mail::TestMailer.deliveries.clear
54
+ Mail::TestMailer.deliveries.length.should == 0
55
+ end
56
+ end
57
+
58
+ context "publishing a draft" do
59
+ before(:all) do
60
+ @post = Post.new( [DRAFT_NAME], {:site=>"rugpost"} )
61
+ end
62
+
63
+ it "should move html to published/output folder" do
64
+ @post.move_html
65
+ html = SAMPLE/'rugpost'/'published/output'/DRAFT_NAME + ".html"
66
+ File.exists?(html).should be true
67
+ end
68
+
69
+ it "should move source to published/source" do
70
+ @post.move_source
71
+ File.exists?(SAMPLE/'rugpost'/'published/source'/DRAFT_NAME+'.'+DRAFT_MARKUP).should be true
72
+ end
73
+
74
+ end
75
+
76
+ end
@@ -0,0 +1,40 @@
1
+ describe Project do
2
+
3
+ context 'A project' do
4
+ before(:all) do
5
+ Dir.mkdir( SAMPLE )
6
+ Dir.chdir( SAMPLE )
7
+ end
8
+
9
+ it 'should have template and configuration files' do
10
+ RuGPost::Project.init( [SAMPLE] )
11
+ File.exists?( SAMPLE ).should be true
12
+ File.exists?( CONFIG ).should be true
13
+ File.exists?( TEMPLATE ).should be true
14
+ ( YAML.load_file( TEMPLATE ).to_yaml ).should match template_meta
15
+ end
16
+
17
+ it 'should set configuration value' do
18
+ RuGPost::Project.config([],{:gmail=>'mygmail'})
19
+ YAML.load_file( CONFIG )[:gmail].should match 'mygmail'
20
+ RuGPost::Project.config([],{:gmail=>'project'})
21
+ YAML.load_file( CONFIG )[:gmail].should match 'project'
22
+ end
23
+ end
24
+
25
+ context 'Creating a repository' do
26
+ it 'should create rugpost repo' do
27
+ RuGPost::Project.add_repo(['rugpost'])
28
+ items=Dir.glob("*")
29
+ items.should include('rugpost')
30
+ substruct = Dir.glob("*/*")
31
+ substruct.should include('rugpost/drafts')
32
+ substruct.should include('rugpost/published')
33
+ published = Dir.glob("*/*/*")
34
+ published.should include('rugpost/published/source')
35
+ published.should include('rugpost/published/output')
36
+ lambda {RuGPost::Project.add_repo( ['rugpost'] )}.should raise_exception
37
+ lambda {RuGPost::Project.add_repo( [] )}.should raise_exception
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+
5
+ require 'rugpost'
6
+ require 'rspec'
7
+ require 'mail'
8
+
9
+ RUG = File.expand_path(File.dirname(__FILE__)+'/../')
10
+
11
+ $: << RUG
12
+
13
+ include RuGPost
14
+ include RuGPost::Utilis
15
+
16
+ SAMPLE = RUG+'/spec/sample'
17
+ DRAFT_NAME = 'helloworld'
18
+ DRAFT_MARKUP = 'textile'
19
+ DRAFT = SAMPLE+'/RuGPost/drafts/'+DRAFT_NAME+"."+DRAFT_MARKUP
20
+
21
+ FileUtils.remove_dir( SAMPLE, true ) if File.exists?( SAMPLE )
22
+
23
+ require RUG+'/spec/project_spec.rb'
24
+ require RUG+'/spec/post_spec.rb'
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RuGPost
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31098277
5
- prerelease: 8
4
+ hash: 25
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
9
  - 1
11
- - beta
12
- version: 0.1.0.1.beta
10
+ version: 0.1.1
13
11
  platform: ruby
14
12
  authors:
15
13
  - emime
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2011-05-08 00:00:00 Z
18
+ date: 2011-06-01 00:00:00 Z
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
23
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -25,32 +23,66 @@ dependencies:
25
23
  requirements:
26
24
  - - ">="
27
25
  - !ruby/object:Gem::Version
28
- hash: 3
26
+ hash: 27
29
27
  segments:
28
+ - 1
29
+ - 3
30
30
  - 0
31
- version: "0"
32
- type: :development
31
+ version: 1.3.0
32
+ type: :runtime
33
33
  prerelease: false
34
34
  requirement: *id001
35
- name: shoulda
35
+ name: gli
36
36
  - !ruby/object:Gem::Dependency
37
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
39
39
  requirements:
40
- - - ~>
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
- hash: 23
42
+ hash: 57
43
43
  segments:
44
- - 1
45
- - 0
46
- - 0
47
- version: 1.0.0
48
- type: :development
44
+ - 4
45
+ - 2
46
+ - 7
47
+ version: 4.2.7
48
+ type: :runtime
49
49
  prerelease: false
50
50
  requirement: *id002
51
- name: bundler
51
+ name: RedCloth
52
52
  - !ruby/object:Gem::Dependency
53
53
  version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 15
59
+ segments:
60
+ - 0
61
+ - 4
62
+ - 0
63
+ version: 0.4.0
64
+ type: :runtime
65
+ prerelease: false
66
+ requirement: *id003
67
+ name: gmail
68
+ - !ruby/object:Gem::Dependency
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 37
75
+ segments:
76
+ - 0
77
+ - 9
78
+ - 15
79
+ version: 0.9.15
80
+ type: :runtime
81
+ prerelease: false
82
+ requirement: *id004
83
+ name: extlib
84
+ - !ruby/object:Gem::Dependency
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
54
86
  none: false
55
87
  requirements:
56
88
  - - ~>
@@ -63,26 +95,28 @@ dependencies:
63
95
  version: 1.6.0
64
96
  type: :development
65
97
  prerelease: false
66
- requirement: *id003
98
+ requirement: *id005
67
99
  name: jeweler
68
100
  - !ruby/object:Gem::Dependency
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
101
+ version_requirements: &id006 !ruby/object:Gem::Requirement
70
102
  none: false
71
103
  requirements:
72
- - - ">="
104
+ - - ~>
73
105
  - !ruby/object:Gem::Version
74
- hash: 3
106
+ hash: 27
75
107
  segments:
108
+ - 2
109
+ - 5
76
110
  - 0
77
- version: "0"
111
+ version: 2.5.0
78
112
  type: :development
79
113
  prerelease: false
80
- requirement: *id004
81
- name: rcov
114
+ requirement: *id006
115
+ name: rspec
82
116
  description: Ru(by) G(mail) Post(erous) command line facility
83
117
  email: e.141592@gmail.com
84
- executables: []
85
-
118
+ executables:
119
+ - rugpost
86
120
  extensions: []
87
121
 
88
122
  extra_rdoc_files:
@@ -97,7 +131,42 @@ files:
97
131
  - Rakefile
98
132
  - RuGPost.gemspec
99
133
  - VERSION
134
+ - bin/rugpost
100
135
  - lib/RuGPost.rb
136
+ - lib/rugpost/commands.rb
137
+ - lib/rugpost/commands/post_commands.rb
138
+ - lib/rugpost/commands/project_commands.rb
139
+ - lib/rugpost/on_error.rb
140
+ - lib/rugpost/post.rb
141
+ - lib/rugpost/prepost.rb
142
+ - lib/rugpost/project.rb
143
+ - lib/rugpost/site.rb
144
+ - lib/rugpost/utilis.rb
145
+ - rdoc/classes/RuGPost.html
146
+ - rdoc/classes/RuGPost/Post.html
147
+ - rdoc/classes/RuGPost/Project.html
148
+ - rdoc/classes/RuGPost/Site.html
149
+ - rdoc/classes/RuGPost/Utilis.html
150
+ - rdoc/created.rid
151
+ - rdoc/files/README_rdoc.html
152
+ - rdoc/files/lib/RuGPost_rb.html
153
+ - rdoc/files/lib/rugpost/commands/post_commands_rb.html
154
+ - rdoc/files/lib/rugpost/commands/project_commands_rb.html
155
+ - rdoc/files/lib/rugpost/commands_rb.html
156
+ - rdoc/files/lib/rugpost/on_error_rb.html
157
+ - rdoc/files/lib/rugpost/post_rb.html
158
+ - rdoc/files/lib/rugpost/prepost_rb.html
159
+ - rdoc/files/lib/rugpost/project_rb.html
160
+ - rdoc/files/lib/rugpost/site_rb.html
161
+ - rdoc/files/lib/rugpost/utilis_rb.html
162
+ - rdoc/fr_class_index.html
163
+ - rdoc/fr_file_index.html
164
+ - rdoc/fr_method_index.html
165
+ - rdoc/index.html
166
+ - rdoc/rdoc-style.css
167
+ - spec/post_spec.rb
168
+ - spec/project_spec.rb
169
+ - spec/spec_helper.rb
101
170
  - test/helper.rb
102
171
  - test/test_RuGPost.rb
103
172
  homepage: http://github.com/3mime/RuGPost
@@ -120,14 +189,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
189
  required_rubygems_version: !ruby/object:Gem::Requirement
121
190
  none: false
122
191
  requirements:
123
- - - ">"
192
+ - - ">="
124
193
  - !ruby/object:Gem::Version
125
- hash: 25
194
+ hash: 3
126
195
  segments:
127
- - 1
128
- - 3
129
- - 1
130
- version: 1.3.1
196
+ - 0
197
+ version: "0"
131
198
  requirements: []
132
199
 
133
200
  rubyforge_project: