teamon-rubber 0.0.5 → 0.0.6
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/README.markdown +43 -0
- data/Rakefile +3 -3
- data/bin/rubber +0 -1
- data/lib/new_entry.html.sample +1 -0
- data/lib/rubber.rb +7 -3
- data/lib/server.ru +23 -10
- metadata +5 -4
- data/README.textile +0 -46
data/README.markdown
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
rubber v. 0.0.5
|
2
|
+
===============
|
3
|
+
Edytor szablonów Joggera
|
4
|
+
|
5
|
+
Instalacja
|
6
|
+
----------
|
7
|
+
gem sources -a http://gems.github.com
|
8
|
+
sudo gem install teamon-rubber
|
9
|
+
|
10
|
+
|
11
|
+
Konfiguracja
|
12
|
+
------------
|
13
|
+
mkdir my_jogger
|
14
|
+
cd my_jogger
|
15
|
+
rubber configure
|
16
|
+
|
17
|
+
|
18
|
+
Pobranie plików z Joggera
|
19
|
+
-------------------------
|
20
|
+
rubber download
|
21
|
+
|
22
|
+
|
23
|
+
Wysłanie zmodyfikowanych plików na Joggera
|
24
|
+
------------------------------------------
|
25
|
+
rubber upload files/my_file.html
|
26
|
+
|
27
|
+
|
28
|
+
Wysłanie wszystkich plików na Joggera
|
29
|
+
-------------------------------------
|
30
|
+
rubber upload files/*
|
31
|
+
|
32
|
+
|
33
|
+
Uruchomienie serwera
|
34
|
+
--------------------
|
35
|
+
rubber server
|
36
|
+
|
37
|
+
|
38
|
+
Twój jogger jest dostępny pod adresem http://localhost:1337
|
39
|
+
Przykładowe treści można zmienić w pliku content.yml
|
40
|
+
|
41
|
+
Podgląd nowego wpisu
|
42
|
+
--------------------
|
43
|
+
Dodając plik do folderu posty o nazwie np. "nowy post.html" będzie on dostępny pod adresem http://localhost:1337/nowy%20post
|
data/Rakefile
CHANGED
@@ -3,10 +3,10 @@ require 'rake/gempackagetask'
|
|
3
3
|
|
4
4
|
PLUGIN = "rubber"
|
5
5
|
GEM_NAME = "rubber"
|
6
|
-
GEM_VERSION = "0.0.
|
6
|
+
GEM_VERSION = "0.0.6"
|
7
7
|
AUTHOR = "Tymon Tobolski"
|
8
8
|
EMAIL = "i@teamon.eu"
|
9
|
-
HOMEPAGE = "http://teamon.eu/projekty/"
|
9
|
+
HOMEPAGE = "http://blog.teamon.eu/projekty/"
|
10
10
|
SUMMARY = "Edytor szablonów Joggera"
|
11
11
|
|
12
12
|
spec = Gem::Specification.new do |s|
|
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
|
|
21
21
|
s.require_path = 'lib'
|
22
22
|
s.bindir = 'bin'
|
23
23
|
s.executables = %w( rubber )
|
24
|
-
s.files = %w( LICENSE README.
|
24
|
+
s.files = %w( LICENSE README.markdown Rakefile ) + Dir.glob("{bin,lib}/**/*")
|
25
25
|
s.add_dependency('mechanize', '>= 0.9.0')
|
26
26
|
s.add_dependency('thin')
|
27
27
|
s.add_dependency('ezcrypto', '>= 0.7.0')
|
data/bin/rubber
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
<p>Blah blah blah</p>
|
data/lib/rubber.rb
CHANGED
@@ -81,6 +81,10 @@ class Rubber
|
|
81
81
|
File.open(filename, 'w') {|f| f.write @agent.get("https://login.jogger.pl#{url}").forms.first.templatesContent }
|
82
82
|
end
|
83
83
|
end
|
84
|
+
|
85
|
+
# posty
|
86
|
+
Dir.mkdir("posty") unless File.exists?("posty")
|
87
|
+
File.open(File.join("posty", "new_one.html"), 'w') {|f| f.write File.read(File.join(File.dirname(__FILE__), "new_entry.html.sample"))} unless File.exists?(File.join("posty", "new_one.html"))
|
84
88
|
end
|
85
89
|
|
86
90
|
def upload(files = [])
|
@@ -129,9 +133,9 @@ class Rubber
|
|
129
133
|
|
130
134
|
def get_pagesmap
|
131
135
|
@pagesmap = Hash[*@agent.get('https://login.jogger.pl/templates/edit/').links.select{|e| e.href =~ %r[/templates/edit/\?page_id] }.map {|e| ["strony/#{e.text}.html", e.href]}.flatten]
|
132
|
-
@pagesmap["
|
133
|
-
@pagesmap["
|
134
|
-
@pagesmap["
|
136
|
+
@pagesmap["Szablon_wpisow.html"] ='/templates/edit/?file=entries'
|
137
|
+
@pagesmap["Szablon_komentarzy.html"] ='/templates/edit/?file=comments'
|
138
|
+
@pagesmap["Szablon_logowania.html"] ='/templates/edit/?file=login'
|
135
139
|
end
|
136
140
|
|
137
141
|
def get_filemap
|
data/lib/server.ru
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'rack/response'
|
2
|
-
|
2
|
+
require 'uri'
|
3
3
|
|
4
4
|
MONTHS = %w(stycznia lutego marca kwietnia maja czerwca lipa sierpnia września pażdziernika listopada grudnia)
|
5
5
|
|
6
|
+
def colorize(content)
|
7
|
+
content.gsub!(%r|\{geshi +lang=(.+?)\}(.+?)\{/geshi\}|m) { "<pre>#{$2}</pre>" }
|
8
|
+
end
|
9
|
+
|
6
10
|
def tag(body, pattern, replacement)
|
7
11
|
body.gsub! %r|<#{pattern}/>|, replacement.to_s
|
8
12
|
body.gsub! %r|&#{pattern};|, replacement.to_s
|
@@ -42,9 +46,9 @@ def parse_with_entry(body, entry, counter = 0)
|
|
42
46
|
tag body, "ENTRY_ID", rand(100)
|
43
47
|
tag body, "ENTRY_LEVEL", rand(3)
|
44
48
|
|
45
|
-
tag body, "ENTRY_CONTENT", entry[:content].sub(%r|<EXCERPT>|, "")
|
46
|
-
tag body, "ENTRY_CONTENT_LONG", entry[:content].split(%r|<EXCERPT>|).last
|
47
|
-
tag body, "ENTRY_CONTENT_SHORT", entry[:content].split(%r|<EXCERPT>|).first
|
49
|
+
tag body, "ENTRY_CONTENT", colorize(entry[:content].sub(%r|<EXCERPT>|, ""))
|
50
|
+
tag body, "ENTRY_CONTENT_LONG", colorize(entry[:content].split(%r|<EXCERPT>|).last)
|
51
|
+
tag body, "ENTRY_CONTENT_SHORT", colorize(entry[:content].split(%r|<EXCERPT>|).first)
|
48
52
|
body.gsub!(%r|<ENTRY_CONTENT_SHORT_EXIST>(.+?)</ENTRY_CONTENT_SHORT_EXIST>|m) { entry[:content]["<EXCERPT>"] ? parse_with_entry($1, entry) : "" }
|
49
53
|
body.gsub!(%r|<ENTRY_CONTENT_SHORT_NOT_EXIST>(.+?)</ENTRY_CONTENT_SHORT_NOT_EXIST>|m) { entry[:content]["<EXCERPT>"] ? "" : parse_with_entry($1, entry) }
|
50
54
|
|
@@ -328,18 +332,27 @@ app = Proc.new do |env|
|
|
328
332
|
|
329
333
|
content = case path
|
330
334
|
when "/"
|
331
|
-
parse :entries, File.read("
|
335
|
+
parse :entries, File.read("Szablon_wpisow.html")
|
332
336
|
when "/entry"
|
333
|
-
parse :comments, File.read("
|
337
|
+
parse :comments, File.read("Szablon_komentarzy.html")
|
334
338
|
when "/login"
|
335
|
-
parse :login, File.read("
|
339
|
+
parse :login, File.read("Szablon_logowanie.html")
|
336
340
|
else
|
337
|
-
|
338
|
-
|
339
|
-
|
341
|
+
page_path = "strony/#{path.gsub('-', ' ').gsub('/', '').capitalize}.html"
|
342
|
+
title = URI.unescape(path.gsub('/', ''))
|
343
|
+
entry_path = "posty/#{title}.html"
|
344
|
+
|
345
|
+
if File.exists?(page_path)
|
346
|
+
parse :page, File.read(page_path)
|
347
|
+
elsif File.exists?(entry_path)
|
348
|
+
@Jogger[:entries][0][:subject] = title
|
349
|
+
@Jogger[:entries][0][:content] = File.read(entry_path)
|
350
|
+
parse :comments, File.read("Szablon_komentarzy.html")
|
351
|
+
|
340
352
|
else
|
341
353
|
"NotFound"
|
342
354
|
end
|
355
|
+
|
343
356
|
end
|
344
357
|
|
345
358
|
[200, {"Content-type" => "text/html"}, content || ""]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamon-rubber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tymon Tobolski
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-29 00:00:00 -07:00
|
13
13
|
default_executable: rubber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -52,14 +52,15 @@ extra_rdoc_files: []
|
|
52
52
|
|
53
53
|
files:
|
54
54
|
- LICENSE
|
55
|
-
- README.
|
55
|
+
- README.markdown
|
56
56
|
- Rakefile
|
57
57
|
- bin/rubber
|
58
58
|
- lib/content.yml.sample
|
59
|
+
- lib/new_entry.html.sample
|
59
60
|
- lib/rubber.rb
|
60
61
|
- lib/server.ru
|
61
62
|
has_rdoc: false
|
62
|
-
homepage: http://teamon.eu/projekty/
|
63
|
+
homepage: http://blog.teamon.eu/projekty/
|
63
64
|
post_install_message:
|
64
65
|
rdoc_options: []
|
65
66
|
|
data/README.textile
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
h2. rubber v. 0.0.5
|
2
|
-
|
3
|
-
Edytor szablonów Joggera
|
4
|
-
|
5
|
-
h3. Instalacja
|
6
|
-
|
7
|
-
<pre><code>
|
8
|
-
gem sources -a http://gems.github.com
|
9
|
-
sudo gem install teamon-rubber
|
10
|
-
</pre></code>
|
11
|
-
|
12
|
-
h3. Inicjalizacja
|
13
|
-
|
14
|
-
<pre><code>
|
15
|
-
mkdir my_jogger
|
16
|
-
cd my_jogger
|
17
|
-
rubber configure
|
18
|
-
</pre></code>
|
19
|
-
|
20
|
-
h3. Pobranie plików z Joggera
|
21
|
-
|
22
|
-
<pre><code>
|
23
|
-
rubber download
|
24
|
-
</pre></code>
|
25
|
-
|
26
|
-
h3. Wysłanie zmodyfikowanych plików na Joggera
|
27
|
-
|
28
|
-
<pre><code>
|
29
|
-
rubber upload files/my_file.html
|
30
|
-
</pre></code>
|
31
|
-
|
32
|
-
h3. Wysłanie wszystkich plików na Joggera
|
33
|
-
|
34
|
-
<pre><code>
|
35
|
-
rubber upload files/*
|
36
|
-
</pre></code>
|
37
|
-
|
38
|
-
h3. Uruchomienie serwera
|
39
|
-
|
40
|
-
<pre><code>
|
41
|
-
rubber server
|
42
|
-
</pre></code>
|
43
|
-
|
44
|
-
Twój jogger jest dostępny pod adresem http://localhost:1337
|
45
|
-
|
46
|
-
Przykładowe treści można zmienić w pliku content.yml
|