entp-astrotrain 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +26 -0
- data/LICENSE +20 -0
- data/README +47 -0
- data/Rakefile +145 -0
- data/VERSION +1 -0
- data/astrotrain.gemspec +96 -0
- data/config/sample.rb +12 -0
- data/lib/astrotrain/api.rb +53 -0
- data/lib/astrotrain/logged_mail.rb +41 -0
- data/lib/astrotrain/mapping/http_post.rb +18 -0
- data/lib/astrotrain/mapping/jabber.rb +23 -0
- data/lib/astrotrain/mapping/transport.rb +55 -0
- data/lib/astrotrain/mapping.rb +157 -0
- data/lib/astrotrain/message.rb +313 -0
- data/lib/astrotrain/tmail.rb +48 -0
- data/lib/astrotrain.rb +55 -0
- data/lib/vendor/rest-client/README.rdoc +104 -0
- data/lib/vendor/rest-client/Rakefile +84 -0
- data/lib/vendor/rest-client/bin/restclient +65 -0
- data/lib/vendor/rest-client/foo.diff +66 -0
- data/lib/vendor/rest-client/lib/rest_client/net_http_ext.rb +21 -0
- data/lib/vendor/rest-client/lib/rest_client/payload.rb +185 -0
- data/lib/vendor/rest-client/lib/rest_client/request_errors.rb +75 -0
- data/lib/vendor/rest-client/lib/rest_client/resource.rb +103 -0
- data/lib/vendor/rest-client/lib/rest_client.rb +189 -0
- data/lib/vendor/rest-client/rest-client.gemspec +18 -0
- data/lib/vendor/rest-client/spec/base.rb +5 -0
- data/lib/vendor/rest-client/spec/master_shake.jpg +0 -0
- data/lib/vendor/rest-client/spec/payload_spec.rb +71 -0
- data/lib/vendor/rest-client/spec/request_errors_spec.rb +44 -0
- data/lib/vendor/rest-client/spec/resource_spec.rb +52 -0
- data/lib/vendor/rest-client/spec/rest_client_spec.rb +219 -0
- data/tasks/doc.thor +149 -0
- data/tasks/merb.thor +2020 -0
- data/test/api_test.rb +28 -0
- data/test/fixtures/apple_multipart.txt +100 -0
- data/test/fixtures/basic.txt +14 -0
- data/test/fixtures/custom.txt +15 -0
- data/test/fixtures/fwd.txt +0 -0
- data/test/fixtures/gb2312_encoding.txt +16 -0
- data/test/fixtures/gb2312_encoding_invalid.txt +15 -0
- data/test/fixtures/html.txt +16 -0
- data/test/fixtures/iso-8859-1.txt +13 -0
- data/test/fixtures/mapped.txt +13 -0
- data/test/fixtures/multipart.txt +213 -0
- data/test/fixtures/multipart2.txt +213 -0
- data/test/fixtures/multiple.txt +13 -0
- data/test/fixtures/multiple_delivered_to.txt +14 -0
- data/test/fixtures/multiple_with_body_recipients.txt +15 -0
- data/test/fixtures/reply.txt +16 -0
- data/test/fixtures/utf-8.txt +13 -0
- data/test/logged_mail_test.rb +63 -0
- data/test/mapping_test.rb +129 -0
- data/test/message_test.rb +424 -0
- data/test/test_helper.rb +54 -0
- data/test/transport_test.rb +111 -0
- metadata +115 -0
data/tasks/doc.thor
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
$: << File.join("doc")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rdoc/rdoc'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'erb'
|
6
|
+
|
7
|
+
module Merb
|
8
|
+
|
9
|
+
class GemNotFoundException < Exception
|
10
|
+
end
|
11
|
+
|
12
|
+
module DocMethods
|
13
|
+
def setup_gem_path
|
14
|
+
if File.directory?(gems_dir = File.join(File.dirname(__FILE__), 'gems'))
|
15
|
+
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(gems_dir)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_more
|
20
|
+
libs = []
|
21
|
+
more_library = find_library("merb-more")
|
22
|
+
File.open("#{more_library}/lib/merb-more.rb").read.each_line do |line|
|
23
|
+
if line['require']
|
24
|
+
libs << line.gsub("require '", '').gsub("'\n", '')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
return libs
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate_documentation(file_list, destination, arguments = [])
|
31
|
+
output_dir = File.join("/../doc", "rdoc", destination)
|
32
|
+
FileUtils.rm_rf(output_dir)
|
33
|
+
|
34
|
+
arguments += [
|
35
|
+
"--fmt", "merb",
|
36
|
+
"--op", output_dir
|
37
|
+
]
|
38
|
+
RDoc::RDoc.new.document(arguments + file_list)
|
39
|
+
AdvancedDoc.new.index
|
40
|
+
end
|
41
|
+
|
42
|
+
def find_library(directory_snippet)
|
43
|
+
gem_dir = nil
|
44
|
+
Gem.path.find do |path|
|
45
|
+
dir = Dir.glob("#{path}/gems/#{directory_snippet}*")
|
46
|
+
dir.empty? ? false : gem_dir = dir.last
|
47
|
+
end
|
48
|
+
raise GemNotFoundException if gem_dir.nil?
|
49
|
+
return gem_dir
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_file_list(directory_snippet)
|
53
|
+
gem_dir = find_library(directory_snippet)
|
54
|
+
files = Dir.glob("#{gem_dir}/**/lib/**/*.rb")
|
55
|
+
files += ["#{gem_dir}/README"] if File.exists?("#{gem_dir}/README")
|
56
|
+
return files
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class AdvancedDoc < Thor
|
61
|
+
|
62
|
+
group 'core'
|
63
|
+
include DocMethods
|
64
|
+
|
65
|
+
def initialize
|
66
|
+
super
|
67
|
+
setup_gem_path
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'index', "Regenerate the index file for your framework documentation"
|
71
|
+
def index
|
72
|
+
@directories = Dir.entries(File.join(File.dirname(__FILE__) + "/../", "doc", "rdoc"))
|
73
|
+
@directories.delete(".")
|
74
|
+
@directories.delete("..")
|
75
|
+
@directories.delete("generators")
|
76
|
+
@directories.delete("index.html")
|
77
|
+
index_template = File.read(File.join("doc", "rdoc", "generators", "template", "merb", "index.html.erb"))
|
78
|
+
|
79
|
+
File.open(File.join("doc", "rdoc", "index.html"), "w") do |file|
|
80
|
+
file.write(ERB.new(index_template).result(binding))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
desc 'plugins', 'Generate the rdoc for each merb-plugins seperatly'
|
85
|
+
def plugins
|
86
|
+
libs = ["merb_activerecord", "merb_builder", "merb_jquery", "merb_laszlo", "merb_parts", "merb_screw_unit", "merb_sequel", "merb_stories", "merb_test_unit"]
|
87
|
+
|
88
|
+
libs.each do |lib|
|
89
|
+
options[:gem] = lib
|
90
|
+
gem
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
desc 'more', 'Generate the rdoc for each merb-more gem seperatly'
|
95
|
+
def more
|
96
|
+
libs = get_more
|
97
|
+
libs.each do |lib|
|
98
|
+
options[:gem] = lib
|
99
|
+
gem
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
desc 'core', 'Generate the rdoc for merb-core'
|
104
|
+
def core
|
105
|
+
options[:gem] = "merb-core"
|
106
|
+
gem
|
107
|
+
end
|
108
|
+
|
109
|
+
desc 'gem', 'Generate the rdoc for a specific gem'
|
110
|
+
method_options "--gem" => :required
|
111
|
+
def gem
|
112
|
+
file_list = get_file_list(options[:gem])
|
113
|
+
readme = File.join(find_library("merb-core"), "README")
|
114
|
+
generate_documentation(file_list, options[:gem], ["-m", readme])
|
115
|
+
rescue GemNotFoundException
|
116
|
+
puts "Can not find the gem in the gem path #{options[:gem]}"
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
class Doc < Thor
|
122
|
+
|
123
|
+
include DocMethods
|
124
|
+
|
125
|
+
def initialize
|
126
|
+
super
|
127
|
+
setup_gem_path
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
desc 'stack', 'Generate the rdoc for merb-core, merb-more merged together'
|
132
|
+
def stack
|
133
|
+
libs = ["merb"]
|
134
|
+
|
135
|
+
file_list = []
|
136
|
+
libs.each do |gem_name|
|
137
|
+
begin
|
138
|
+
file_list += get_file_list(gem_name)
|
139
|
+
rescue GemNotFoundException
|
140
|
+
puts "Could not find #{gem_name} in #{Gem.path}. Continuing with out it."
|
141
|
+
end
|
142
|
+
end
|
143
|
+
readme = File.join(find_library("merb"), "README")
|
144
|
+
generate_documentation(file_list, "stack", ["-m", readme])
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|