RuGPost 0.1.0 → 0.1.0.1.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/Gemfile +6 -6
  2. data/Gemfile.lock +5 -34
  3. data/README.rdoc +3 -37
  4. data/Rakefile +39 -13
  5. data/RuGPost.gemspec +12 -54
  6. data/VERSION +1 -1
  7. data/lib/RuGPost.rb +0 -25
  8. metadata +33 -100
  9. data/bin/rugpost +0 -7
  10. data/lib/rugpost/commands/post_commands.rb +0 -19
  11. data/lib/rugpost/commands/project_commands.rb +0 -24
  12. data/lib/rugpost/commands.rb +0 -4
  13. data/lib/rugpost/on_error.rb +0 -6
  14. data/lib/rugpost/post.rb +0 -92
  15. data/lib/rugpost/prepost.rb +0 -10
  16. data/lib/rugpost/project.rb +0 -37
  17. data/lib/rugpost/site.rb +0 -6
  18. data/lib/rugpost/utilis.rb +0 -20
  19. data/rdoc/classes/RuGPost/Post.html +0 -473
  20. data/rdoc/classes/RuGPost/Project.html +0 -212
  21. data/rdoc/classes/RuGPost/Site.html +0 -111
  22. data/rdoc/classes/RuGPost/Utilis.html +0 -169
  23. data/rdoc/classes/RuGPost.html +0 -200
  24. data/rdoc/created.rid +0 -1
  25. data/rdoc/files/README_rdoc.html +0 -194
  26. data/rdoc/files/lib/RuGPost_rb.html +0 -113
  27. data/rdoc/files/lib/rugpost/commands/post_commands_rb.html +0 -101
  28. data/rdoc/files/lib/rugpost/commands/project_commands_rb.html +0 -101
  29. data/rdoc/files/lib/rugpost/commands_rb.html +0 -108
  30. data/rdoc/files/lib/rugpost/on_error_rb.html +0 -101
  31. data/rdoc/files/lib/rugpost/post_rb.html +0 -101
  32. data/rdoc/files/lib/rugpost/prepost_rb.html +0 -101
  33. data/rdoc/files/lib/rugpost/project_rb.html +0 -101
  34. data/rdoc/files/lib/rugpost/site_rb.html +0 -101
  35. data/rdoc/files/lib/rugpost/utilis_rb.html +0 -101
  36. data/rdoc/fr_class_index.html +0 -31
  37. data/rdoc/fr_file_index.html +0 -37
  38. data/rdoc/fr_method_index.html +0 -43
  39. data/rdoc/index.html +0 -24
  40. data/rdoc/rdoc-style.css +0 -208
  41. data/spec/post_spec.rb +0 -77
  42. data/spec/project_spec.rb +0 -41
  43. data/spec/spec_helper.rb +0 -24
data/Gemfile CHANGED
@@ -1,13 +1,13 @@
1
1
  source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
+ # gem "activesupport", ">= 2.3.5"
4
5
 
5
- gem "gli", ">= 1.3.0"
6
- gem "RedCloth", ">= 4.2.7"
7
- gem "gmail", ">= 0.4.0"
8
- gem "extlib", ">= 0.9.15"
9
-
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
10
8
  group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
11
  gem "jeweler", "~> 1.6.0"
12
- gem "rspec", "~> 2.5.0"
12
+ gem "rcov", ">= 0"
13
13
  end
data/Gemfile.lock CHANGED
@@ -1,49 +1,20 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- RedCloth (4.2.7)
5
- diff-lcs (1.1.2)
6
- extlib (0.9.15)
7
4
  git (1.2.5)
8
- gli (1.3.0)
9
- gmail (0.4.0)
10
- gmail_xoauth (>= 0.3.0)
11
- mail (>= 2.2.1)
12
- mime (>= 0.1)
13
- gmail_xoauth (0.3.0)
14
- oauth (>= 0.3.6)
15
- i18n (0.5.0)
16
5
  jeweler (1.6.0)
17
6
  bundler (~> 1.0.0)
18
7
  git (>= 1.2.5)
19
8
  rake
20
- mail (2.3.0)
21
- i18n (>= 0.4.0)
22
- mime-types (~> 1.16)
23
- treetop (~> 1.4.8)
24
- mime (0.1)
25
- mime-types (1.16)
26
- oauth (0.4.4)
27
- polyglot (0.3.1)
28
9
  rake (0.8.7)
29
- rspec (2.5.0)
30
- rspec-core (~> 2.5.0)
31
- rspec-expectations (~> 2.5.0)
32
- rspec-mocks (~> 2.5.0)
33
- rspec-core (2.5.2)
34
- rspec-expectations (2.5.0)
35
- diff-lcs (~> 1.1.2)
36
- rspec-mocks (2.5.0)
37
- treetop (1.4.9)
38
- polyglot (>= 0.3.1)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
39
12
 
40
13
  PLATFORMS
41
14
  ruby
42
15
 
43
16
  DEPENDENCIES
44
- RedCloth (>= 4.2.7)
45
- extlib (>= 0.9.15)
46
- gli (>= 1.3.0)
47
- gmail (>= 0.4.0)
17
+ bundler (~> 1.0.0)
48
18
  jeweler (~> 1.6.0)
49
- rspec (~> 2.5.0)
19
+ rcov
20
+ shoulda
data/README.rdoc CHANGED
@@ -1,41 +1,6 @@
1
1
  = RuGPost
2
2
 
3
- RuGPost (RubyGmailPosterous) is a command line which allows to create posts on your own posterous sites using your GMail account. You start creating you repo (corresponding to a posterous site), and then adding your drafts using **textile** lightweight markup. When your draft is ready, you just use the _publish_ feature to have you draft converted to **html** and posted to the posterous site.
4
-
5
-
6
- = Installation
7
-
8
- gem install RuGPost
9
-
10
- = Usage
11
-
12
- Create a RuGPost project:
13
-
14
- rugpost new RuGPost
15
-
16
- Add a repository (must have same name of the posterous site):
17
-
18
- rugpost repo RuGPost
19
-
20
- Create your first draft:
21
-
22
- rugpost draft helloworld --site RuGPost
23
-
24
- Publish your draft:
25
-
26
- rugpost publish helloworld --site RuGpost
27
-
28
- That's all. Note that if you follow the above steps as is, you should be able to post in a minute a nice 'helloworld' on rugpost.posterous.com.
29
-
30
- = Help
31
-
32
- For help about the available commands use:
33
-
34
- rugpost --help
35
-
36
- For help about a specific command use:
37
-
38
- rugpost --help <command>
3
+ Description goes here.
39
4
 
40
5
  == Contributing to RuGPost
41
6
 
@@ -49,5 +14,6 @@ For help about a specific command use:
49
14
 
50
15
  == Copyright
51
16
 
52
- Copyright (c) 2011 empo. See LICENSE.txt for
17
+ Copyright (c) 2011 emime. See LICENSE.txt for
53
18
  further details.
19
+
data/Rakefile CHANGED
@@ -1,27 +1,53 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
4
12
  require 'rake'
5
13
 
6
14
  require 'jeweler'
7
15
  Jeweler::Tasks.new do |gem|
8
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
9
- gem.name = "RuGPost"
10
- gem.homepage = "http://github.com/3mime/RuGPost"
11
- gem.license = "MIT"
12
- gem.summary = %Q{Ru(by) G(mail) Post(erous) command line facility for creating posts on Posterous}
13
- gem.description = %Q{Ru(by) G(mail) Post(erous) command line facility}
14
- gem.email = "e.141592@gmail.com"
15
- gem.authors = ["emime"]
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "RuGPost"
18
+ gem.homepage = "http://github.com/3mime/RuGPost"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Ru(by) G(mail) Post(erous) command line facility for creating posts on Posterous}
21
+ gem.description = %Q{Ru(by) G(mail) Post(erous) command line facility}
22
+ gem.email = "e.141592@gmail.com"
23
+ gem.authors = ["emime"]
24
+ # dependencies defined in Gemfile
16
25
  end
17
26
  Jeweler::RubygemsDotOrgTasks.new
18
27
 
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
19
44
 
20
45
  require 'rake/rdoctask'
21
46
  Rake::RDocTask.new do |rdoc|
22
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
23
- rdoc.rdoc_dir = 'rdoc'
24
- rdoc.title = "RuGPost #{version}"
25
- rdoc.rdoc_files.include('README*')
26
- rdoc.rdoc_files.include('lib/**/*.rb')
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "RuGPost #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
27
53
  end
data/RuGPost.gemspec CHANGED
@@ -5,14 +5,13 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{RuGPost}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.0.1.beta"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{emime}]
12
- s.date = %q{2011-05-10}
12
+ s.date = %q{2011-05-08}
13
13
  s.description = %q{Ru(by) G(mail) Post(erous) command line facility}
14
14
  s.email = %q{e.141592@gmail.com}
15
- s.executables = [%q{rugpost}]
16
15
  s.extra_rdoc_files = [
17
16
  "LICENSE.txt",
18
17
  "README.rdoc"
@@ -26,42 +25,7 @@ Gem::Specification.new do |s|
26
25
  "Rakefile",
27
26
  "RuGPost.gemspec",
28
27
  "VERSION",
29
- "bin/rugpost",
30
28
  "lib/RuGPost.rb",
31
- "lib/rugpost/commands.rb",
32
- "lib/rugpost/commands/post_commands.rb",
33
- "lib/rugpost/commands/project_commands.rb",
34
- "lib/rugpost/on_error.rb",
35
- "lib/rugpost/post.rb",
36
- "lib/rugpost/prepost.rb",
37
- "lib/rugpost/project.rb",
38
- "lib/rugpost/site.rb",
39
- "lib/rugpost/utilis.rb",
40
- "rdoc/classes/RuGPost.html",
41
- "rdoc/classes/RuGPost/Post.html",
42
- "rdoc/classes/RuGPost/Project.html",
43
- "rdoc/classes/RuGPost/Site.html",
44
- "rdoc/classes/RuGPost/Utilis.html",
45
- "rdoc/created.rid",
46
- "rdoc/files/README_rdoc.html",
47
- "rdoc/files/lib/RuGPost_rb.html",
48
- "rdoc/files/lib/rugpost/commands/post_commands_rb.html",
49
- "rdoc/files/lib/rugpost/commands/project_commands_rb.html",
50
- "rdoc/files/lib/rugpost/commands_rb.html",
51
- "rdoc/files/lib/rugpost/on_error_rb.html",
52
- "rdoc/files/lib/rugpost/post_rb.html",
53
- "rdoc/files/lib/rugpost/prepost_rb.html",
54
- "rdoc/files/lib/rugpost/project_rb.html",
55
- "rdoc/files/lib/rugpost/site_rb.html",
56
- "rdoc/files/lib/rugpost/utilis_rb.html",
57
- "rdoc/fr_class_index.html",
58
- "rdoc/fr_file_index.html",
59
- "rdoc/fr_method_index.html",
60
- "rdoc/index.html",
61
- "rdoc/rdoc-style.css",
62
- "spec/post_spec.rb",
63
- "spec/project_spec.rb",
64
- "spec/spec_helper.rb",
65
29
  "test/helper.rb",
66
30
  "test/test_RuGPost.rb"
67
31
  ]
@@ -75,27 +39,21 @@ Gem::Specification.new do |s|
75
39
  s.specification_version = 3
76
40
 
77
41
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
78
- s.add_runtime_dependency(%q<gli>, [">= 1.3.0"])
79
- s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.7"])
80
- s.add_runtime_dependency(%q<gmail>, [">= 0.4.0"])
81
- s.add_runtime_dependency(%q<extlib>, [">= 0.9.15"])
42
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
43
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
82
44
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
83
- s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
45
+ s.add_development_dependency(%q<rcov>, [">= 0"])
84
46
  else
85
- s.add_dependency(%q<gli>, [">= 1.3.0"])
86
- s.add_dependency(%q<RedCloth>, [">= 4.2.7"])
87
- s.add_dependency(%q<gmail>, [">= 0.4.0"])
88
- s.add_dependency(%q<extlib>, [">= 0.9.15"])
47
+ s.add_dependency(%q<shoulda>, [">= 0"])
48
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
89
49
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
90
- s.add_dependency(%q<rspec>, ["~> 2.5.0"])
50
+ s.add_dependency(%q<rcov>, [">= 0"])
91
51
  end
92
52
  else
93
- s.add_dependency(%q<gli>, [">= 1.3.0"])
94
- s.add_dependency(%q<RedCloth>, [">= 4.2.7"])
95
- s.add_dependency(%q<gmail>, [">= 0.4.0"])
96
- s.add_dependency(%q<extlib>, [">= 0.9.15"])
53
+ s.add_dependency(%q<shoulda>, [">= 0"])
54
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
97
55
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
98
- s.add_dependency(%q<rspec>, ["~> 2.5.0"])
56
+ s.add_dependency(%q<rcov>, [">= 0"])
99
57
  end
100
58
  end
101
59
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.0.1.beta
data/lib/RuGPost.rb CHANGED
@@ -1,25 +0,0 @@
1
- require 'rubygems'
2
- require 'gli'
3
- require 'redcloth'
4
- require 'gmail'
5
- require 'pathname'
6
- require 'extlib'
7
- module RuGPost
8
-
9
- # directory containing RuGPost library files
10
- LIB = Pathname(__FILE__).dirname.expand_path/'rugpost'
11
-
12
- # requires
13
- require LIB/'utilis'
14
- require LIB/'site'
15
- require LIB/'project'
16
- require LIB/'post'
17
-
18
- include RuGPost::Utilis
19
-
20
- # project configuration file
21
- CONFIG = 'config.yaml'
22
- TEMPLATE = 'template'
23
- VERSION = '0.1.0.beta'
24
-
25
- end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RuGPost
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
4
+ hash: 31098277
5
+ prerelease: 8
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
9
  - 0
10
- version: 0.1.0
10
+ - 1
11
+ - beta
12
+ version: 0.1.0.1.beta
11
13
  platform: ruby
12
14
  authors:
13
15
  - emime
@@ -15,7 +17,7 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2011-05-10 00:00:00 Z
20
+ date: 2011-05-08 00:00:00 Z
19
21
  dependencies:
20
22
  - !ruby/object:Gem::Dependency
21
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -23,66 +25,32 @@ dependencies:
23
25
  requirements:
24
26
  - - ">="
25
27
  - !ruby/object:Gem::Version
26
- hash: 27
28
+ hash: 3
27
29
  segments:
28
- - 1
29
- - 3
30
30
  - 0
31
- version: 1.3.0
32
- type: :runtime
31
+ version: "0"
32
+ type: :development
33
33
  prerelease: false
34
34
  requirement: *id001
35
- name: gli
35
+ name: shoulda
36
36
  - !ruby/object:Gem::Dependency
37
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
39
39
  requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 57
43
- segments:
44
- - 4
45
- - 2
46
- - 7
47
- version: 4.2.7
48
- type: :runtime
49
- prerelease: false
50
- requirement: *id002
51
- name: RedCloth
52
- - !ruby/object:Gem::Dependency
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
40
+ - - ~>
57
41
  - !ruby/object:Gem::Version
58
- hash: 15
42
+ hash: 23
59
43
  segments:
44
+ - 1
60
45
  - 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
46
  - 0
77
- - 9
78
- - 15
79
- version: 0.9.15
80
- type: :runtime
47
+ version: 1.0.0
48
+ type: :development
81
49
  prerelease: false
82
- requirement: *id004
83
- name: extlib
50
+ requirement: *id002
51
+ name: bundler
84
52
  - !ruby/object:Gem::Dependency
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
86
54
  none: false
87
55
  requirements:
88
56
  - - ~>
@@ -95,28 +63,26 @@ dependencies:
95
63
  version: 1.6.0
96
64
  type: :development
97
65
  prerelease: false
98
- requirement: *id005
66
+ requirement: *id003
99
67
  name: jeweler
100
68
  - !ruby/object:Gem::Dependency
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
102
70
  none: false
103
71
  requirements:
104
- - - ~>
72
+ - - ">="
105
73
  - !ruby/object:Gem::Version
106
- hash: 27
74
+ hash: 3
107
75
  segments:
108
- - 2
109
- - 5
110
76
  - 0
111
- version: 2.5.0
77
+ version: "0"
112
78
  type: :development
113
79
  prerelease: false
114
- requirement: *id006
115
- name: rspec
80
+ requirement: *id004
81
+ name: rcov
116
82
  description: Ru(by) G(mail) Post(erous) command line facility
117
83
  email: e.141592@gmail.com
118
- executables:
119
- - rugpost
84
+ executables: []
85
+
120
86
  extensions: []
121
87
 
122
88
  extra_rdoc_files:
@@ -131,42 +97,7 @@ files:
131
97
  - Rakefile
132
98
  - RuGPost.gemspec
133
99
  - VERSION
134
- - bin/rugpost
135
100
  - 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
170
101
  - test/helper.rb
171
102
  - test/test_RuGPost.rb
172
103
  homepage: http://github.com/3mime/RuGPost
@@ -189,12 +120,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
120
  required_rubygems_version: !ruby/object:Gem::Requirement
190
121
  none: false
191
122
  requirements:
192
- - - ">="
123
+ - - ">"
193
124
  - !ruby/object:Gem::Version
194
- hash: 3
125
+ hash: 25
195
126
  segments:
196
- - 0
197
- version: "0"
127
+ - 1
128
+ - 3
129
+ - 1
130
+ version: 1.3.1
198
131
  requirements: []
199
132
 
200
133
  rubyforge_project:
data/bin/rugpost DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
4
- require 'rugpost'
5
- require 'rugpost/commands'
6
-
7
- GLI.run(ARGV)
@@ -1,19 +0,0 @@
1
- desc 'Create a new draft on the indicated site repository.'
2
- arg_name '<post-name>'
3
- command :draft do |c|
4
- c.desc 'Target site repository where the post draft will be created.'
5
- c.flag [:site]
6
- c.action do |glob, ops, args|
7
- Post.draft(args,ops)
8
- end
9
- end
10
-
11
- desc 'Publish a repository draft on the corresponding posterous site.'
12
- arg_name '<draft-name>'
13
- command :publish do |c|
14
- c.desc 'Repository where the draft is stored.'
15
- c.flag [:site]
16
- c.action do |glob, ops, args|
17
- Post.publish(Post.new(args, ops))
18
- end
19
- end
@@ -1,24 +0,0 @@
1
- desc 'Create a new RuGPost project.'
2
- arg_name '<project-name>'
3
- command :new do |c|
4
- c.action do |glob, ops, args|
5
- Project.create(args)
6
- end
7
- end
8
-
9
- desc 'Create a repo for a posterous site.'
10
- arg_name '<site-name>'
11
- command :repo do |c|
12
- c.action do |glob, ops, args|
13
- Project.add_repo(args)
14
- end
15
- end
16
-
17
- desc 'Configure project global options'
18
- command :config do |c|
19
- c.desc 'Configure gmail account used to post on posterous sites. Needs the gmail (without @gmail).'
20
- c.flag [:gmail]
21
- c.action do |glob,ops,args|
22
- Project.config(args,ops)
23
- end
24
- end
@@ -1,4 +0,0 @@
1
- include GLI
2
-
3
- require RuGPost::LIB/'commands/project_commands'
4
- require RuGPost::LIB/'commands/post_commands'
@@ -1,6 +0,0 @@
1
- on_error do |exception|
2
- # Error logic here
3
- # return false to skip default error handling
4
- puts exception.backtrace
5
- true
6
- end
data/lib/rugpost/post.rb DELETED
@@ -1,92 +0,0 @@
1
- module RuGPost
2
-
3
- META = /--- \n.*\n---\n/m
4
-
5
- DRAFTS = 'drafts'
6
- PUBLISHED = 'published'
7
- SOURCE = PUBLISHED/'source'
8
- OUTPUT = PUBLISHED/'output'
9
-
10
- class Post
11
-
12
- attr_accessor :src_body, :draft, :subject, :html_o, :metaops
13
-
14
- def initialize(args,ops)
15
- @draftid = args[0]
16
- @draft = Dir.glob(ops[:site]/DRAFTS/@draftid+".*")
17
- raise "Draft not found! Searched for '#{args[0]}' in '#{ops[:site]}/drafts'" unless @draft
18
- @draft = @draft[0]
19
- set_body
20
- set_html
21
- set_meta ops
22
- set_subj
23
- end
24
-
25
- def set_meta ops
26
- projectops = YAML.load_file(CONFIG)
27
- @metaops = YAML.load_file(@draft)
28
- @metaops.merge! projectops
29
- @metaops.merge! ops
30
- end
31
-
32
- def set_subj
33
- @subject = "#{@metaops[:title]} ((tags:#{@metaops[:tags].join(',')})) ((delay:#{@metaops[:delay]}))"
34
- end
35
-
36
- def set_body
37
- cnt = ""
38
- File.open( @draft, 'r' ) { |str| cnt << str.read() }
39
- @src_body = cnt.sub META, ""
40
- end
41
-
42
- def set_html
43
- @html_o = RedCloth.new(@src_body).to_html
44
- end
45
-
46
- def get_pwd
47
- puts "Please type gmail account password:"
48
- gets.chomp
49
- end
50
-
51
- def send_gmail(gmail)
52
- gmail.deliver do
53
- to "#{@metaops[:site]}@posterous.com"
54
- subject post.subject
55
- text_part do
56
- body post.html_o
57
- end
58
- end
59
- gmail.logout
60
- end
61
-
62
- def move_source
63
- FileUtils.mv(@draft,@metaops[:site]/SOURCE)
64
- end
65
-
66
- def move_html
67
- target = @metaops[:site]/OUTPUT/@draftid+'.html'
68
- File.open( target, 'w' ) {|f| f.write(@html_o)}
69
- end
70
-
71
- def remove
72
- FileUtils.remove_file(@draft)
73
- end
74
-
75
- def Post.draft(args,ops)
76
- target_file = ops[:site]/'drafts'/args[0]+'.textile'
77
- raise "File already exists!\n\t#{target_file}\n\tPlease indicate a different draft name." if File.exists?(target_file)
78
- FileUtils.copy_file(TEMPLATE, target_file)
79
- end
80
-
81
- def Post.publish(post)
82
- account = post.meta[:gmail]
83
- gmail = Gmail.new(account,get_pwd)
84
- post.send_gmail(gmail)
85
- post.move_source
86
- post.move_html
87
- post.remove
88
- end
89
-
90
- end
91
-
92
- end