ruga 0.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.
data/bin/ruga ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'ruga'
5
+
6
+
7
+ print "Insert gallery name: "
8
+ name = STDIN.gets.chomp
9
+ print "Insert gallery url: "
10
+ url = STDIN.gets.chomp
11
+ path = Dir.pwd + "/#{name}"
12
+
13
+ mygallery = Ruga.new(name, path, url)
14
+ mygallery.create
data/lib/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/tasklib'
4
+ require 'rugatasks'
5
+
6
+ Ruga::Rugatasks.new
data/lib/gallery.rb ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby
2
+
3
+ class Gallery
4
+
5
+ attr_reader :title, :creation_date, :lastedit_date, :url, :images_list#, :desc
6
+
7
+ def initialize
8
+
9
+ require 'yaml'
10
+
11
+ @yamlfile = YAML::load( File.open( 'ruga.yaml' ))
12
+
13
+ @title = @yamlfile["gallery_name"]
14
+ # @desc = @yamlfile["gallery_desc"]
15
+ @creation_date = @yamlfile["gallery_creationdate"]
16
+ @lastedit_date = @yamlfile["gallery_lasteditdate"]
17
+ @url = @yamlfile["gallery_url"]
18
+ @images_list = `ls images/*.{jpg,JPG,png,PNG,gif,GIF} 2>/dev/null`.to_a
19
+ @thumbs_list = `ls thumbs`.to_a
20
+
21
+ end
22
+
23
+ def get_binding
24
+ binding
25
+ end
26
+
27
+ end #class
data/lib/image.rb ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby
2
+
3
+ class Image
4
+
5
+ attr_reader :filename, :title, :desc, :date
6
+
7
+ def initialize(photo, title, desc)
8
+ @title = title
9
+ @desc = desc
10
+ @month = Time.now.month.to_s
11
+ @day = Time.now.day.to_s
12
+ @year = Time.now.year.to_s
13
+ @date = @day + @month + @year
14
+ @filename = photo
15
+ @last_filename = @date + "_" + photo
16
+ end
17
+
18
+ def get_binding
19
+ binding
20
+ end
21
+
22
+ end #class
data/lib/ruga.rb ADDED
@@ -0,0 +1,45 @@
1
+ class Ruga
2
+
3
+ attr_reader :gallery_name, :gallery_path, :gallery_url
4
+
5
+ def initialize(name, path, url)
6
+ @gallery_name = name
7
+ @gallery_path = path
8
+ @gallery_url = url
9
+ end
10
+
11
+ def create
12
+
13
+ require 'yaml'
14
+
15
+ Dir.mkdir(@gallery_name)
16
+ Dir.mkdir("#{@gallery_name}/images")
17
+ Dir.mkdir("#{@gallery_name}/thumbs")
18
+
19
+ month = Time.now.month.to_s
20
+ day = Time.now.day.to_s
21
+ year = Time.now.year.to_s
22
+ date = day + "/" + month + "/" + year
23
+
24
+ @Rkf = Gem.source_index.search("ruga").last.full_gem_path + "/lib/Rakefile"
25
+ @footer = Gem.source_index.search("ruga").last.full_gem_path + "/templates/footer"
26
+ @header = Gem.source_index.search("ruga").last.full_gem_path + "/templates/header.jpg"
27
+ @indexcss = Gem.source_index.search("ruga").last.full_gem_path + "/templates/style.css"
28
+ @imagecss = Gem.source_index.search("ruga").last.full_gem_path + "/templates/image.css"
29
+
30
+ `cp #{@Rkf} #{@gallery_name}/Rakefile`
31
+ `cp #{@header} #{@gallery_name}/images`
32
+ `cp #{@footer} -r #{@gallery_name}/images`
33
+ `cp #{@indexcss} #{@gallery_name}/`
34
+ `cp #{@imagecss} #{@gallery_name}/images`
35
+
36
+ File.open("#{@gallery_name}/ruga.yaml", "w") do |filepointer|
37
+ filepointer.puts( {"gallery_name" => "#{@gallery_name}",
38
+ #"gallery_desc" => "#{@gallery_desc}",
39
+ "gallery_creationdate" => "#{date}",
40
+ "gallery_lasteditdate" => "#{date}",
41
+ "gallery_url" => "#{@gallery_url}"}.to_yaml )
42
+ end
43
+ end
44
+
45
+ end
data/lib/rugatasks.rb ADDED
@@ -0,0 +1,98 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/tasklib'
4
+
5
+ module Ruga
6
+
7
+ class Rugatasks < Rake::TaskLib
8
+
9
+
10
+ def initialize
11
+
12
+ @template_dir = Gem.source_index.search("ruga").last.full_gem_path + "/templates/"
13
+
14
+ # richiamare la funzione che definisce i task
15
+ define_subtasks
16
+ end #initialize
17
+
18
+ private
19
+ def define_subtasks
20
+
21
+ task :default => :usage
22
+
23
+ task :usage do
24
+ print "\n\tRuGa usage:\n\n"
25
+ print "\t- rake add_photo -> to create a new image\n"
26
+ print "\t- rake generate -> to generate the gallery\n"
27
+ print "\t- rake publish -> to publish the gallery on the url you put in ruga.yaml\n\n"
28
+ end
29
+
30
+ task :add_photo do
31
+
32
+ require 'image'
33
+ require 'erb'
34
+
35
+ print "Insert photo name with path: "
36
+ @photo = STDIN.gets.chomp
37
+ print "Insert a title for the photo: "
38
+ @title = STDIN.gets.chomp
39
+ print "Insert a little description: "
40
+ @desc = STDIN.gets.chomp
41
+
42
+ @myphoto = Image.new(`basename #{@photo}`, @title, @desc)
43
+
44
+ # I define the file that I'm goin' to use or generate
45
+ @output_file = "images/" + @myphoto.date + "_" + @myphoto.filename.chomp[0..-4] + "html"
46
+ @image_file = "images/" + @myphoto.date + "_" + @myphoto.filename
47
+ @thumb_file = "thumbs/" + @myphoto.date + "_" + @myphoto.filename
48
+ @template_file = @template_dir + "image.rhtml"
49
+
50
+ # Now I generate the output
51
+ @template = File.new(@template_file, "r").read
52
+ @rhtml = ERB.new(@template)
53
+ @output = File.new(@output_file, "w")
54
+ @output.puts @rhtml.result(@myphoto.get_binding)
55
+ @output.close
56
+
57
+ # ...and finally I copy the image into the right directory
58
+ `cp #{@photo} #{@image_file}`
59
+
60
+ # I generate the thumbnail
61
+ `convert #{@photo} -resize 200x200 #{@thumb_file}`
62
+
63
+ end #task add_photo
64
+
65
+ task :generate do
66
+
67
+ require 'erb'
68
+ require 'gallery'
69
+
70
+ @output_file = "index.html"
71
+ @template_file = @template_dir + "index.rhtml"
72
+
73
+ # istanzio la classe gallery
74
+ @mygallery = Gallery.new
75
+
76
+ # deve aprire il template
77
+ # e con erb deve generare il file index.html
78
+ @template = File.new(@template_file, "r").read
79
+ @rhtml = ERB.new(@template)
80
+ @output = File.new(@output_file, "w")
81
+ @output.puts @rhtml.result(@mygallery.get_binding)
82
+ @output.close
83
+
84
+ end #task generate
85
+
86
+ task :publish do
87
+
88
+ require 'gallery'
89
+
90
+ # leggere dal file di configurazione l'url
91
+ @mygallery = Gallery.new
92
+ @url = @mygallery.url
93
+ `rsync -avr images/ thumbs/ index.html style.css ruga.yaml #{@url}`
94
+
95
+ end #task publish
96
+ end #define_subtasks
97
+ end #class
98
+ end #module
Binary file
Binary file
Binary file
@@ -0,0 +1,182 @@
1
+ body {
2
+ font-family:Verdana, Arial, Helvetica, sans-serif;
3
+ font-size: 0.8em;
4
+ margin: 0;
5
+ padding: 0;
6
+ background-color:#303752;
7
+ }
8
+
9
+ .conteneur {
10
+ margin-top: 10px;
11
+ position: absolute;
12
+ width: 740px;
13
+ left: 50%;
14
+ margin-left: -370px;
15
+ border:0px solid #182801;
16
+ color: #303752;
17
+ background-color:#737a96;
18
+ }
19
+
20
+
21
+ .header {
22
+ background-image: url("images/header.jpg");
23
+ background-repeat: no-repeat;
24
+ height:160px;
25
+ padding-left:50px;
26
+ padding-top:40px;
27
+ max-width:740px;
28
+ border-bottom:1px solid #182801;
29
+ color: #1d698c;
30
+ background-color:#182801;
31
+ }
32
+
33
+ .menu {
34
+ float:right;
35
+ margin: 0px;
36
+ padding:0px;
37
+ margin-left:20px;
38
+ border-left:1px solid #FFFFFF;
39
+ }
40
+
41
+ .buttons {
42
+ position:absolute;
43
+ padding: 0px;
44
+ top: 192px;
45
+ left:50%;
46
+ margin-left: -370px;
47
+ width:740px;
48
+
49
+
50
+ }
51
+
52
+ .buttons img {
53
+ margin: 1px;
54
+ border: 0px;
55
+ }
56
+
57
+ * html .menu {
58
+ margin-left: -3px;
59
+ }
60
+
61
+ .centre {
62
+ padding:20px;
63
+ padding-left:40px;
64
+ text-align:left;
65
+ max-width:490px;
66
+ }
67
+
68
+ .pied {
69
+ float: right;
70
+ margin-bottom: 0px;
71
+ height: 25px;
72
+ text-align:right;
73
+ position: relative;
74
+ width: 740px;
75
+ background-color:#7A9431;
76
+ }
77
+
78
+ .pied div {
79
+ width: 740px;
80
+ }
81
+
82
+ .pied * {
83
+ margin-right: 4px;
84
+ background-color:#737a96;
85
+ }
86
+
87
+ .menu-list {
88
+ list-style-type: none;
89
+ margin:0px 0px 0px 0px;
90
+ padding:0px;
91
+ }
92
+
93
+ * html .menu li{
94
+ margin-bottom:-3px;
95
+ }
96
+
97
+ .menu li {
98
+ margin:0px;
99
+ border-bottom:1px solid #182801;
100
+ color: #D9CEB8;
101
+ font-size: 0.9em;
102
+ text-decoration: none;
103
+ background-color:#FFFFFF;
104
+ padding:0px;
105
+ width:199px;
106
+ }
107
+
108
+ .menu li a {
109
+ margin:0px;
110
+ display: block;
111
+ color: #3668a6;
112
+ font-size: 1.1em;
113
+ text-decoration: none;
114
+ border-left:5px solid #FFFFFF;
115
+ padding:5px;
116
+ }
117
+
118
+ .menu li a:hover {
119
+ text-decoration: none;
120
+ background-color:#FFFFFF;
121
+ }
122
+
123
+ .menu-section-title {
124
+ background-color: #FFFFFF;
125
+ color: #3668a6;
126
+ width: 100%;
127
+ display: block;
128
+ }
129
+
130
+ h4{
131
+ margin-left:-20px;
132
+ margin-top:15px;
133
+ padding-left:5px;
134
+ font-size: 1.0em;
135
+ color: #578594;
136
+ font-weight:normal;
137
+ }
138
+
139
+ h3{
140
+ margin-left:-20px;
141
+ margin-top:15px;
142
+ padding-left:5px;
143
+ font-size: 1.2em;
144
+ color: #578594;
145
+ font-weight:normal;
146
+ }
147
+
148
+
149
+ h1{
150
+ margin-left:-30px;
151
+ margin-top:5px;
152
+ padding-left:5px;
153
+ font-size: 2.5em;
154
+ color: #FFFFFF;
155
+ font-weight:normal;
156
+ }
157
+
158
+ .header-title {
159
+ font-size:2.3em;
160
+ border-top:2px solid #F5F8EF;
161
+ }
162
+
163
+ .header-title-two {
164
+ font-size:1.1em;
165
+ padding-bottom:3px;
166
+ border-bottom:1px solid #F5F8EF;
167
+ }
168
+
169
+ a{
170
+ color:#F5F8EF;
171
+ text-decoration:none;
172
+ }
173
+
174
+ a:hover{
175
+ text-decoration:underline;
176
+ }
177
+
178
+ pre {
179
+ background-color:rgb(142, 168, 69);
180
+ padding : 3px;
181
+ border-left:2px solid #faff5b;
182
+ }
@@ -0,0 +1,26 @@
1
+ <html>
2
+
3
+ <head>
4
+ <title><%= @title %></title>
5
+ <link rel="stylesheet" type="text/css" href="image.css">
6
+ </head>
7
+
8
+ <body>
9
+ <div align="center">
10
+ <h1><%= @title %></h1>
11
+ <b>Descrizione: </b><%= @desc %><br>
12
+ <b>Data: </b><%= @date %><p>
13
+ <a href="<%= @last_filename.chomp %>"><img src="<%= @last_filename.chomp %>" width=500></a><br>
14
+ <hr width="70%">
15
+ <font size="-2"><i>This gallery has been built using Ruga 0.1 - <a href="http://ruga.rubyforge.net">ruga.rubyforge.net</a></i></font></p>
16
+ <img src="footer/ruby_powered.png">
17
+ <img src="footer/gnulinux_powered.png">
18
+ <img src="footer/copyleft_powered.png">
19
+ <p>
20
+ </div>
21
+ </body>
22
+
23
+ </html>
24
+ <html>
25
+
26
+
@@ -0,0 +1,34 @@
1
+ <html>
2
+
3
+ <head>
4
+ <title><%= @title %></title>
5
+ <link rel="stylesheet" type="text/css" href="style.css">
6
+ </head>
7
+
8
+ <body>
9
+ <div class="conteneur">
10
+
11
+ <div class="header">
12
+ <h1><%= @title %></h1>
13
+ <b>Data di creazione: </b><%= @lastedit_date %><p>
14
+ <b>Data di ultima modifica: </b><%= @creation_date %><p>
15
+ </div>
16
+
17
+ <div class="center">
18
+ <div align="center">
19
+ <% @thumbs_list.each do |image| %>
20
+ <a href="<%= "images/" + image[0..-5] + "html" %>"><img src="<%= "thumbs/" + image %>" height="150" width="150"></a>
21
+ <% end %>
22
+ <hr width="70%">
23
+ <font size="-2"><i>This gallery has been built using Ruga 0.1 - <a href="http://ruga.rubyforge.net">ruga.rubyforge.net</a></i></font></p>
24
+ <img src="images/footer/ruby_powered.png">
25
+ <img src="images/footer/gnulinux_powered.png">
26
+ <img src="images/footer/copyleft_powered.png">
27
+ </div>
28
+ <p>
29
+ </div>
30
+
31
+ </div>
32
+ </body>
33
+
34
+ </html>
@@ -0,0 +1,172 @@
1
+ body {
2
+ font-family:Verdana, Arial, Helvetica, sans-serif;
3
+ font-size: 0.8em;
4
+ margin: 0;
5
+ padding: 0;
6
+ background-color:#303752;
7
+ }
8
+
9
+ .conteneur {
10
+ margin-top: 10px;
11
+ position: absolute;
12
+ width: 740px;
13
+ left: 50%;
14
+ margin-left: -370px;
15
+ border:0px solid #182801;
16
+ color: #303752;
17
+ background-color:#737a96;
18
+ }
19
+
20
+
21
+ .header {
22
+ background-image: url("images/header.jpg");
23
+ background-repeat: no-repeat;
24
+ height:160px;
25
+ padding-left:50px;
26
+ padding-top:40px;
27
+ max-width:740px;
28
+ border-bottom:1px solid #182801;
29
+ color: #1d698c;
30
+ background-color:#182801;
31
+ }
32
+
33
+ .menu {
34
+ float:right;
35
+ margin: 0px;
36
+ padding:0px;
37
+ margin-left:20px;
38
+ border-left:1px solid #000000;
39
+ }
40
+
41
+ .buttons {
42
+ position:absolute;
43
+ padding: 0px;
44
+ top: 192px;
45
+ left:50%;
46
+ margin-left: -370px;
47
+ width:740px;
48
+
49
+
50
+ }
51
+
52
+ .buttons img {
53
+ margin: 1px;
54
+ border: 0px;
55
+ }
56
+
57
+ * html .menu {
58
+ margin-left: -3px;
59
+ }
60
+
61
+ .centre {
62
+ padding:20px;
63
+ padding-left:40px;
64
+ text-align:left;
65
+ max-width:490px;
66
+ }
67
+
68
+ .pied {
69
+ float: right;
70
+ margin-bottom: 0px;
71
+ height: 25px;
72
+ text-align:right;
73
+ position: relative;
74
+ width: 740px;
75
+ background-color:#7A9431;
76
+ }
77
+
78
+ .pied div {
79
+ width: 740px;
80
+ }
81
+
82
+ .pied * {
83
+ margin-right: 4px;
84
+ background-color:#737a96;
85
+ }
86
+
87
+ .menu-list {
88
+ list-style-type: none;
89
+ margin:0px 0px 0px 0px;
90
+ padding:0px;
91
+ }
92
+
93
+ * html .menu li{
94
+ margin-bottom:-3px;
95
+ }
96
+
97
+ .menu li {
98
+ margin:0px;
99
+ border-bottom:1px solid #182801;
100
+ color: #D9CEB8;
101
+ font-size: 0.9em;
102
+ text-decoration: none;
103
+ background-color:#FFFFFF;
104
+ padding:0px;
105
+ width:199px;
106
+ }
107
+
108
+ .menu li a {
109
+ margin:0px;
110
+ display: block;
111
+ color: #3668a6;
112
+ font-size: 1.1em;
113
+ text-decoration: none;
114
+ border-left:5px solid #FFFFFF;
115
+ padding:5px;
116
+ }
117
+
118
+ .menu li a:hover {
119
+ text-decoration: none;
120
+ background-color:#000000;
121
+ }
122
+
123
+ .menu-section-title {
124
+ background-color: #FFFFFF;
125
+ color: #3668a6;
126
+ width: 100%;
127
+ display: block;
128
+ }
129
+
130
+ h2{
131
+ margin-left:-20px;
132
+ margin-top:15px;
133
+ padding-left:5px;
134
+ font-size: 1.2em;
135
+ color: #F5F8EF;
136
+ font-weight:normal;
137
+ }
138
+
139
+ h1{
140
+ margin-left:-30px;
141
+ margin-top:5px;
142
+ padding-left:5px;
143
+ font-size: 2.5em;
144
+ color: #000000;
145
+ font-weight:normal;
146
+ }
147
+
148
+ .header-title {
149
+ font-size:2.3em;
150
+ border-top:2px solid #F5F8EF;
151
+ }
152
+
153
+ .header-title-two {
154
+ font-size:1.1em;
155
+ padding-bottom:3px;
156
+ border-bottom:1px solid #F5F8EF;
157
+ }
158
+
159
+ a{
160
+ color:#F5F8EF;
161
+ text-decoration:none;
162
+ }
163
+
164
+ a:hover{
165
+ text-decoration:underline;
166
+ }
167
+
168
+ pre {
169
+ background-color:rgb(142, 168, 69);
170
+ padding : 3px;
171
+ border-left:2px solid #faff5b;
172
+ }
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: ruga
5
+ version: !ruby/object:Gem::Version
6
+ version: "0.1"
7
+ date: 2007-01-20 00:00:00 +01:00
8
+ summary: Some script useful to build a web gallery
9
+ require_paths:
10
+ - lib
11
+ email: fabioviola@how-tux.com
12
+ homepage: http://ruga.rubyforge.org/
13
+ rubyforge_project:
14
+ description: ruga is a static web gallery builder
15
+ autorequire: ruga
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Fabio Viola
31
+ files:
32
+ - lib/gallery.rb
33
+ - lib/Rakefile
34
+ - lib/ruga.rb
35
+ - lib/image.rb
36
+ - lib/rugatasks.rb
37
+ - bin/ruga
38
+ - templates/style.css
39
+ - templates/image.rhtml
40
+ - templates/footer
41
+ - templates/image.css
42
+ - templates/header.jpg
43
+ - templates/index.rhtml
44
+ - templates/footer/cc_powered.png
45
+ - templates/footer/ruby_powered.png
46
+ - templates/footer/copyleft_powered.png
47
+ - templates/footer/gnulinux_powered.png
48
+ test_files: []
49
+
50
+ rdoc_options: []
51
+
52
+ extra_rdoc_files: []
53
+
54
+ executables:
55
+ - ruga
56
+ extensions: []
57
+
58
+ requirements: []
59
+
60
+ dependencies:
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ version_requirement:
64
+ version_requirements: !ruby/object:Gem::Version::Requirement
65
+ requirements:
66
+ - - ">"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.0.0
69
+ version: