pastiepacker 1.0.0
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.
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +38 -0
- data/README.txt +79 -0
- data/Rakefile +4 -0
- data/bin/pastiepacker +8 -0
- data/config/hoe.rb +83 -0
- data/config/requirements.rb +15 -0
- data/lib/pastiepacker.rb +26 -0
- data/lib/pastiepacker/command.rb +50 -0
- data/lib/pastiepacker/conversion.rb +53 -0
- data/lib/pastiepacker/fetch.rb +7 -0
- data/lib/pastiepacker/header.rb +25 -0
- data/lib/pastiepacker/io.rb +17 -0
- data/lib/pastiepacker/options.rb +56 -0
- data/lib/pastiepacker/upload.rb +57 -0
- data/lib/pastiepacker/version.rb +9 -0
- data/lib/ruby-ext/hash.rb +13 -0
- data/script/console +11 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/fixtures/private_pastie.html +263 -0
- data/test/fixtures/sample_app/History.txt +3 -0
- data/test/fixtures/sample_app/README.txt +1 -0
- data/test/fixtures/sample_app/lib/myapp.rb +3 -0
- data/test/test_app.rb +116 -0
- data/test/test_conversion.rb +29 -0
- data/test/test_helper.rb +60 -0
- data/website/index.html +174 -0
- data/website/index.txt +97 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.html.erb +48 -0
- metadata +117 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
desc 'Release the website and new gem version'
|
2
|
+
task :deploy => [:check_version, :website, :release] do
|
3
|
+
puts "Remember to create SVN tag:"
|
4
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
+
puts "Suggested comment:"
|
7
|
+
puts "Tagging release #{CHANGES}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
+
task :local_deploy => [:website_generate, :install_gem]
|
12
|
+
|
13
|
+
task :check_version do
|
14
|
+
unless ENV['VERSION']
|
15
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
unless ENV['VERSION'] == VERS
|
19
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
+
task :install_gem_no_doc => [:clean, :package] do
|
26
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :manifest do
|
30
|
+
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
+
task :refresh do
|
32
|
+
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
+
end
|
34
|
+
end
|
data/tasks/website.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
desc 'Generate website files'
|
2
|
+
task :website_generate => :ruby_env do
|
3
|
+
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
+
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Upload website files to rubyforge'
|
9
|
+
task :website_upload do
|
10
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
+
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
+
local_dir = 'website'
|
13
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate and upload website files'
|
17
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
@@ -0,0 +1,263 @@
|
|
1
|
+
<html>
|
2
|
+
<head id="head">
|
3
|
+
<title>Private Paste - Pastie</title>
|
4
|
+
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
|
8
|
+
<div id="topnews" style="display:none;">
|
9
|
+
<p>
|
10
|
+
Pastie now <a href="http://pastie.caboo.se/8763" class="subtle">auto-senses</a> if line-wrap is a bad or good idea. <a href="http://beast.caboo.se/forums/4">Feedback?</a>
|
11
|
+
</p>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div id="header">
|
15
|
+
|
16
|
+
<ul id="nav">
|
17
|
+
<li class="hot"><a href="/pastes/new">New</a></li>
|
18
|
+
|
19
|
+
<li style="display:none;" class="loggedinonly">
|
20
|
+
<!--
|
21
|
+
|
22
|
+
-->
|
23
|
+
<a href="" id="mine_nav_link">Mine</a>
|
24
|
+
|
25
|
+
<li >
|
26
|
+
<a href="/pastes">All</a>
|
27
|
+
|
28
|
+
</li>
|
29
|
+
|
30
|
+
<li><a href="#" onclick="$('search').show(); $('search_box').focus();">Search</a>
|
31
|
+
</li>
|
32
|
+
<li id="search" style="display:none;">
|
33
|
+
<form action="/search/">
|
34
|
+
<input type="text" style="font-size:0.85em;" size="15" id="search_box" name="q" value="">
|
35
|
+
</form>
|
36
|
+
</li>
|
37
|
+
|
38
|
+
<li ><a href="/why/">Why</a></li>
|
39
|
+
<li ><a href="/help/">Help</a></li>
|
40
|
+
|
41
|
+
<li class="login loggedinonly" style="display:none;" id="login_nick"></li>
|
42
|
+
|
43
|
+
</ul>
|
44
|
+
|
45
|
+
<script language="javascript">logged_in_setup();</script>
|
46
|
+
|
47
|
+
<h1>
|
48
|
+
|
49
|
+
<img src="/images/pastie.gif" />
|
50
|
+
Pastie
|
51
|
+
<span class="sub"><a href='http://www.pledgie.com/campaign/show/16'>Show Pastie some love</a></span>
|
52
|
+
<!--
|
53
|
+
<span class="sub">What'cha want for Christmas?</span>
|
54
|
+
<span class="count"> pasties and counting</span>
|
55
|
+
-->
|
56
|
+
</h1>
|
57
|
+
|
58
|
+
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<!-- <div id="news">
|
62
|
+
<p style="margin-bottom:0;">Now powered by <a href="http://www.sphinxsearch.com/">Sphinx</a>... Search doesn't suck anymore. :-) Give it a spin.</p>
|
63
|
+
</div> -->
|
64
|
+
|
65
|
+
<div id="container">
|
66
|
+
|
67
|
+
|
68
|
+
<div id="content">
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<!--
|
77
|
+
|
78
|
+
-->
|
79
|
+
|
80
|
+
<!--
|
81
|
+
<p class="private psmall" id="private">
|
82
|
+
<img src="/images/icons/mini/locked.gif" />
|
83
|
+
This paste is private.
|
84
|
+
</p>
|
85
|
+
-->
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<!-- only for someone who's logged in -->
|
94
|
+
<p class="smallutils" id="wrapoptions" style="display:none;">
|
95
|
+
|
96
|
+
<a href="http://pastie.caboo.se/175214/wrap?key=5hwfheniddqmyasmfcxaw">Wrap text</a>
|
97
|
+
|
98
|
+
</p>
|
99
|
+
|
100
|
+
<script language="javascript">
|
101
|
+
logged_in_setup();
|
102
|
+
if (logged_in_user && logged_in_user=="")
|
103
|
+
{ $('wrapoptions').show(); }
|
104
|
+
</script>
|
105
|
+
|
106
|
+
|
107
|
+
<div style="position:absolute; font-size:0.6em; color:#999; z-index:100; right:10px; top:10px;">
|
108
|
+
<label style="font-size:1em; color:#aaa">Theme:</label>
|
109
|
+
<select onchange="setActiveStyleSheet(this.value);" id="tm_theme_picker">
|
110
|
+
<option value="clean">Clean (Pastie)</option>
|
111
|
+
<option value="all_hallows_eve">All Hallow's Eve</option>
|
112
|
+
<option value="blackboard">Blackboard</option>
|
113
|
+
|
114
|
+
<option value="brilliance_black">Brilliance Black</option>
|
115
|
+
<option value="cobalt">Cobalt</option>
|
116
|
+
<option value="expreso_libre">Espresso Libre</option>
|
117
|
+
<option value="idle">IDLE</option>
|
118
|
+
<option value="mac_classic">Mac Classic</option>
|
119
|
+
<option value="magicwb_amiga">MagicWB (Amiga)</option>
|
120
|
+
<option value="pastels_on_dark">Pastels on Dark</option>
|
121
|
+
<option value="slate">Slate</option>
|
122
|
+
<option value="slush_and_poppies">Slush and Poppies</option>
|
123
|
+
|
124
|
+
<option value="sunburst">Sunburst</option>
|
125
|
+
<option value="sunburst_josh">Sunburst (Josh)</option>
|
126
|
+
<option value="twilight">Twilight</option>
|
127
|
+
<option value="vibrant_ink">Vibrant Ink</option>
|
128
|
+
</select>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<h2>about:pastiepacker </h2>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<div class="allcode">
|
144
|
+
<table cellpadding="0" cellspacing="0" border="0">
|
145
|
+
<tr>
|
146
|
+
<td>
|
147
|
+
|
148
|
+
<pre class="textmate-source-numbers">1
|
149
|
+
2
|
150
|
+
</pre>
|
151
|
+
|
152
|
+
</td>
|
153
|
+
<td>
|
154
|
+
<pre class="textmate-source"><pre class="sunburst"><span class='meta meta_paragraph meta_paragraph_text'>Files for pastiepacker uploaded by pastiepacker.
|
155
|
+
To unpack files see <span class='markup markup_underline markup_underline_link'>http://pastiepacker.rubyforge.org</span>
|
156
|
+
</pre></pre>
|
157
|
+
</td>
|
158
|
+
</tr>
|
159
|
+
</table>
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
<hr />
|
165
|
+
|
166
|
+
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<div id="right">
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<p>
|
176
|
+
<label>Pasted</label><br />
|
177
|
+
<span class="typo_date" title="Fri, 04 Apr 2008 12:09:37 GMT" id='paste_date'>April 04, 2008<br /> 7:09AM EDT</span>
|
178
|
+
<script language="javascript">
|
179
|
+
e=$('paste_date');
|
180
|
+
e.innerHTML=get_local_time_for_date(e.title);
|
181
|
+
</script>
|
182
|
+
|
183
|
+
</p>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<p style="margin-top:2em; font-size:0.75em;">
|
196
|
+
<a href="/pastes/175214/download?key=5hwfheniddqmyasmfcxaw" class="utility">Download</a>
|
197
|
+
<span class="pipe">|</span>
|
198
|
+
<a href="http://pastie.caboo.se/175214.txt?key=5hwfheniddqmyasmfcxaw" class="utility">View</a>
|
199
|
+
</p>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<p style="margin-top:2em;">
|
204
|
+
<a href="/pastes/175214/reply?key=5hwfheniddqmyasmfcxaw">Paste again</a>
|
205
|
+
|
206
|
+
</p>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<p style="margin-top:2em; display:none;" id="edit_link">
|
214
|
+
<a href="/pastes/175214/edit?key=5hwfheniddqmyasmfcxaw" class="utility remove">Edit paste</a>
|
215
|
+
</p>
|
216
|
+
|
217
|
+
<script language="javascript">
|
218
|
+
logged_in_setup();
|
219
|
+
pasties=readCookie("pasties");
|
220
|
+
if (logged_in_user && logged_in_user=="")
|
221
|
+
{ $('edit_link').show(); }
|
222
|
+
else if (pasties)
|
223
|
+
{
|
224
|
+
pasties=pasties.split("&");
|
225
|
+
if (pasties.include(175214))
|
226
|
+
{ $('edit_link').show(); }
|
227
|
+
}
|
228
|
+
</script>
|
229
|
+
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<br style="clear:both;" />
|
234
|
+
|
235
|
+
</div>
|
236
|
+
|
237
|
+
<div id="footer">
|
238
|
+
<p class="legal">
|
239
|
+
<a href="/legal/" style="color:#369;">Legal</a>
|
240
|
+
</p>
|
241
|
+
<p class="disclaim">
|
242
|
+
<strong>
|
243
|
+
|
244
|
+
Use Pastie in your quest to save humanity,<br /> not in your evil plots to take over the world!
|
245
|
+
</strong>
|
246
|
+
|
247
|
+
</p>
|
248
|
+
<p class="credit">
|
249
|
+
Created by <a href="http://www.workingwithrails.com/person/5337-josh-goebel">Josh Goebel</a>
|
250
|
+
<span class="pipe">|</span>
|
251
|
+
Hosted by <a href="http://railsmachine.com/">Rails Machine</a>
|
252
|
+
</p>
|
253
|
+
<br style="clear:both;" />
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
257
|
+
</script>
|
258
|
+
<script type="text/javascript">
|
259
|
+
_uacct = "UA-413537-1";
|
260
|
+
urchinTracker();
|
261
|
+
</script>
|
262
|
+
</body>
|
263
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
This is the readme.txt
|
data/test/test_app.rb
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class TestApp < Test::Unit::TestCase
|
4
|
+
attr_reader :base_folder, :target_folder
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@base_folder = File.dirname(__FILE__) + "/fixtures/sample_app"
|
8
|
+
@target_folder = File.dirname(__FILE__) + "/unpack"
|
9
|
+
FileUtils.mkdir_p target_folder
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
FileUtils.rm_rf target_folder
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_pack_current_folder
|
17
|
+
PastiePacker::API.any_instance.expects(:paste).
|
18
|
+
with($complete_pastie_and_header, 'ruby', false).
|
19
|
+
returns("http://pastie.caboo.se/123456")
|
20
|
+
FileUtils.cd base_folder do
|
21
|
+
PastiePacker.run
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_pack_with_file_names
|
26
|
+
PastiePacker::API.any_instance.expects(:paste).
|
27
|
+
with($some_files_and_header, 'ruby', false).
|
28
|
+
returns("http://pastie.caboo.se/123456")
|
29
|
+
files = ["README.txt\n", "lib/myapp.rb\n"]
|
30
|
+
PastiePacker.any_instance.expects(:input_lines).returns(files)
|
31
|
+
FileUtils.cd base_folder do
|
32
|
+
PastiePacker.run
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_pack_with_extra_comment
|
37
|
+
pastie = PastiePacker.new
|
38
|
+
pastie.extra_message = 'This is a bonus comment.'
|
39
|
+
PastiePacker::API.any_instance.expects(:paste).
|
40
|
+
with($complete_pastie_and_header_and_comment, nil, nil).
|
41
|
+
returns("http://pastie.caboo.se/123456")
|
42
|
+
FileUtils.cd base_folder do
|
43
|
+
pastie.do_pack
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_pack_but_output_to_stdout
|
48
|
+
pastie = PastiePacker.new
|
49
|
+
pastie.expects(:to_stdout?).returns(true)
|
50
|
+
PastiePacker::API.any_instance.expects(:paste).never
|
51
|
+
output = mock()
|
52
|
+
output.expects(:puts).with($complete_pastie_and_header)
|
53
|
+
pastie.stubs(:output_stream).returns(output)
|
54
|
+
FileUtils.cd base_folder do
|
55
|
+
pastie.do_pack
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_pack_but_no_header
|
60
|
+
pastie = PastiePacker.new
|
61
|
+
pastie.expects(:no_header?).returns(true)
|
62
|
+
PastiePacker::API.any_instance.expects(:paste).
|
63
|
+
with($complete_pastie, nil, nil).
|
64
|
+
returns("http://pastie.caboo.se/123456")
|
65
|
+
FileUtils.cd base_folder do
|
66
|
+
pastie.do_pack
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_unpack_within_current_folder
|
71
|
+
PastiePacker.any_instance.expects(:fetch_pastie).
|
72
|
+
with("http://pastie.caboo.se/123456").
|
73
|
+
returns($complete_pastie_and_header)
|
74
|
+
PastiePacker.any_instance.expects(:parse_options)
|
75
|
+
PastiePacker.any_instance.expects(:args).returns(["http://pastie.caboo.se/123456"])
|
76
|
+
FileUtils.cd target_folder do
|
77
|
+
PastiePacker.run("http://pastie.caboo.se/123456")
|
78
|
+
end
|
79
|
+
assert(File.directory?("#{target_folder}/123456"), "/123456 folder not created")
|
80
|
+
diff = `diff -ur #{base_folder} #{target_folder}/123456`
|
81
|
+
assert_equal("", diff)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_unpack_within_current_folder_raw_txt
|
85
|
+
PastiePacker.any_instance.expects(:fetch_pastie).
|
86
|
+
with("http://pastie.caboo.se/123456").
|
87
|
+
returns($complete_pastie_and_header)
|
88
|
+
PastiePacker.any_instance.expects(:parse_options)
|
89
|
+
PastiePacker.any_instance.expects(:args).returns(["http://pastie.caboo.se/123456.txt"])
|
90
|
+
FileUtils.cd target_folder do
|
91
|
+
PastiePacker.run("http://pastie.caboo.se/123456.txt")
|
92
|
+
end
|
93
|
+
assert(File.directory?("#{target_folder}/123456"), "/123456 folder not created")
|
94
|
+
diff = `diff -ur #{base_folder} #{target_folder}/123456`
|
95
|
+
assert_equal("", diff)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_unpack_private_pastie
|
99
|
+
PastiePacker.any_instance.expects(:args).
|
100
|
+
returns(["http://pastie.caboo.se/private/5hwfheniddqmyasmfcxaw"])
|
101
|
+
private_pastie_html = open(File.dirname(__FILE__) + "/fixtures/private_pastie.html")
|
102
|
+
PastiePacker.any_instance.expects(:fetch_pastie).
|
103
|
+
with("http://pastie.caboo.se/private/5hwfheniddqmyasmfcxaw").
|
104
|
+
returns(private_pastie_html)
|
105
|
+
PastiePacker.any_instance.expects(:fetch_pastie).
|
106
|
+
with("http://pastie.caboo.se/175214.txt?key=5hwfheniddqmyasmfcxaw").
|
107
|
+
returns($complete_pastie_and_header)
|
108
|
+
PastiePacker.any_instance.expects(:parse_options)
|
109
|
+
FileUtils.cd target_folder do
|
110
|
+
PastiePacker.run("http://pastie.caboo.se/private/5hwfheniddqmyasmfcxaw")
|
111
|
+
end
|
112
|
+
assert(File.directory?("#{target_folder}/5hwfheniddqmyasmfcxaw"), "/5hwfheniddqmyasmfcxaw folder not created")
|
113
|
+
diff = `diff -ur #{base_folder} #{target_folder}/5hwfheniddqmyasmfcxaw`
|
114
|
+
assert_equal("", diff)
|
115
|
+
end
|
116
|
+
end
|