plasmoid 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -6
- data/VERSION +1 -1
- data/bin/plasmoid +1 -1
- data/lib/plasmoid.rb +4 -0
- data/lib/plasmoid/generator.rb +2 -31
- data/lib/plasmoid/generator/options.rb +11 -1
- data/lib/plasmoid/generator/template_helper.rb +9 -1
- data/lib/plasmoid/generator/templates/{Rakefile → ruby/Rakefile} +0 -0
- data/lib/plasmoid/generator/templates/ruby/contents/code/main.rb +34 -0
- data/lib/plasmoid/generator/templates/ruby/metadata.desktop +19 -0
- data/lib/plasmoid/generator/templates/webkit/Rakefile +3 -0
- data/lib/plasmoid/generator/templates/{contents → webkit/contents}/code/application.js +0 -0
- data/lib/plasmoid/generator/templates/{contents → webkit/contents}/code/main.html +0 -0
- data/lib/plasmoid/generator/templates/{contents → webkit/contents}/code/style.css +0 -0
- data/lib/plasmoid/generator/templates/{metadata.desktop → webkit/metadata.desktop} +0 -0
- data/lib/plasmoid/ruby_generator.rb +19 -0
- data/lib/plasmoid/webkit_generator.rb +30 -0
- data/plasmoid.gemspec +15 -14
- metadata +28 -26
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,18 +2,15 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
git (1.2.5)
|
5
|
-
jeweler (1.
|
5
|
+
jeweler (1.6.0)
|
6
6
|
bundler (~> 1.0.0)
|
7
7
|
git (>= 1.2.5)
|
8
8
|
rake
|
9
|
-
rake (0.
|
9
|
+
rake (0.9.1)
|
10
10
|
|
11
11
|
PLATFORMS
|
12
12
|
ruby
|
13
13
|
|
14
14
|
DEPENDENCIES
|
15
15
|
bundler (~> 1.0.0)
|
16
|
-
jeweler
|
17
|
-
|
18
|
-
METADATA
|
19
|
-
version: 1.0.6
|
16
|
+
jeweler (= 1.6.0)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/plasmoid
CHANGED
data/lib/plasmoid.rb
CHANGED
data/lib/plasmoid/generator.rb
CHANGED
@@ -35,7 +35,7 @@ module Plasmoid
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.run!(*args)
|
38
|
-
options =
|
38
|
+
options = self::Options.new(args)
|
39
39
|
|
40
40
|
if options[:invalid_argument]
|
41
41
|
$stderr.puts options[:invalid_argument]
|
@@ -52,7 +52,7 @@ module Plasmoid
|
|
52
52
|
return 1
|
53
53
|
end
|
54
54
|
|
55
|
-
generator =
|
55
|
+
generator = options[:generator].new(options)
|
56
56
|
generator.run
|
57
57
|
return 0
|
58
58
|
end
|
@@ -63,34 +63,6 @@ module Plasmoid
|
|
63
63
|
$stdout.puts "Your plasmoid is ready at #{target_dir}\ntype `rake -T` to see the available actions"
|
64
64
|
end
|
65
65
|
|
66
|
-
private
|
67
|
-
def create_files
|
68
|
-
puts "Creating files in #{target_dir}"
|
69
|
-
FileUtils.mkpath(target_dir)
|
70
|
-
|
71
|
-
Find.find(template_dir) do |path|
|
72
|
-
dest = path.sub(template_dir, "")
|
73
|
-
|
74
|
-
next if path =~ /^\.+$/ || dest.empty? || path =~ /~$/
|
75
|
-
if File.directory?(path)
|
76
|
-
mkdir(dest)
|
77
|
-
else
|
78
|
-
write_template(dest, dest)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
if options[:use_haml]
|
83
|
-
Dir.chdir(target_dir) do
|
84
|
-
Dir.glob(File.join("contents/**/**/*.html")) do |path|
|
85
|
-
dest = path + ".haml"
|
86
|
-
puts dest
|
87
|
-
system("html2haml '#{path}' '#{dest}'")
|
88
|
-
File.unlink path
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
66
|
def create_version_control
|
95
67
|
Dir.chdir(target_dir) do
|
96
68
|
begin
|
@@ -108,7 +80,6 @@ module Plasmoid
|
|
108
80
|
begin
|
109
81
|
@repo.commit "Initial commit to #{project_name}."
|
110
82
|
rescue Git::GitExecuteError => e
|
111
|
-
raise
|
112
83
|
end
|
113
84
|
end
|
114
85
|
end
|
@@ -8,6 +8,8 @@ module Plasmoid
|
|
8
8
|
def initialize(args)
|
9
9
|
super()
|
10
10
|
|
11
|
+
self[:generator] = Plasmoid::WebkitGenerator
|
12
|
+
|
11
13
|
@argv = args.clone
|
12
14
|
@parser = OptionParser.new do |o|
|
13
15
|
o.banner = "Usage: #{File.basename($0)} [options] name\ne.g. #{File.basename($0)} weba"
|
@@ -16,7 +18,15 @@ module Plasmoid
|
|
16
18
|
self[:directory] = directory
|
17
19
|
end
|
18
20
|
|
19
|
-
o.
|
21
|
+
o.on("--ruby", "generate ruby plasmoid") do |o|
|
22
|
+
self[:generator] = Plasmoid::RubyGenerator
|
23
|
+
end
|
24
|
+
|
25
|
+
o.separator "Webkit Options:"
|
26
|
+
|
27
|
+
o.on("--webkit", "generate webkit plasmoid") do |o|
|
28
|
+
self[:generator] = Plasmoid::WebkitGenerator
|
29
|
+
end
|
20
30
|
|
21
31
|
o.on('--haml', 'enable haml') do |o|
|
22
32
|
self[:use_haml] = true
|
@@ -7,7 +7,15 @@ module Plasmoid
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def template_dir
|
10
|
-
@template_dir ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
@template_dir ||= File.join(File.dirname(__FILE__), 'templates', prefix_dir)
|
11
|
+
end
|
12
|
+
|
13
|
+
def prefix_dir
|
14
|
+
if self.class == Plasmoid::WebkitGenerator
|
15
|
+
"webkit"
|
16
|
+
elsif self.class == Plasmoid::RubyGenerator
|
17
|
+
"ruby"
|
18
|
+
end
|
11
19
|
end
|
12
20
|
|
13
21
|
def render_template(source)
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'plasma_applet'
|
2
|
+
|
3
|
+
Qt::WebSettings::globalSettings.setAttribute(Qt::WebSettings::PluginsEnabled, true)
|
4
|
+
Qt::WebSettings::globalSettings.setAttribute(Qt::WebSettings::JavascriptEnabled, true)
|
5
|
+
|
6
|
+
module <%= options[:project_name].capitalize %>
|
7
|
+
class Main < PlasmaScripting::Applet
|
8
|
+
def initialize(parent)
|
9
|
+
super parent
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def init
|
15
|
+
self.has_configuration_interface = false
|
16
|
+
self.aspect_ratio_mode = Plasma::IgnoreAspectRatio
|
17
|
+
|
18
|
+
resize 380, 500
|
19
|
+
|
20
|
+
@layout = Qt::GraphicsLinearLayout.new Qt::Vertical, self
|
21
|
+
self.layout = @layout
|
22
|
+
|
23
|
+
@web_page = Plasma::WebView.new(self)
|
24
|
+
|
25
|
+
#set white BG to ignore system palette
|
26
|
+
@web_page.page.setPalette Qt::Palette.new(Qt::Color.new 255,255,255)
|
27
|
+
@layout.add_item @web_page
|
28
|
+
|
29
|
+
@web_page.url = KDE::Url.new("http://www.kde.org")
|
30
|
+
end
|
31
|
+
|
32
|
+
public
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
[Desktop Entry]
|
2
|
+
Encoding=UTF-8
|
3
|
+
Name=<%= options[:project_name] %>
|
4
|
+
Name[nl]=<%= options[:project_name] %>
|
5
|
+
Type=Service
|
6
|
+
ServiceTypes=Plasma/Applet
|
7
|
+
Icon=chronometer
|
8
|
+
X-Plasma-API=ruby-script
|
9
|
+
X-Plasma-MainScript=code/main.rb
|
10
|
+
X-KDE-PluginInfo-Author=<%= options[:user_name] %>
|
11
|
+
X-KDE-PluginInfo-Email=<%= options[:project_email] %>
|
12
|
+
X-KDE-PluginInfo-Name=<%= options[:project_name] %>
|
13
|
+
X-KDE-PluginInfo-Version=1.0
|
14
|
+
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
15
|
+
X-KDE-PluginInfo-Category=Web Based
|
16
|
+
X-KDE-PluginInfo-Depends=
|
17
|
+
X-KDE-PluginInfo-License=GPL
|
18
|
+
X-KDE-PluginInfo-EnabledByDefault=true
|
19
|
+
X-Plasma-DefaultSize=380,500
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Plasmoid
|
2
|
+
class RubyGenerator < Generator
|
3
|
+
def create_files
|
4
|
+
puts "Creating files in #{target_dir}"
|
5
|
+
FileUtils.mkpath(target_dir)
|
6
|
+
|
7
|
+
Find.find(template_dir) do |path|
|
8
|
+
dest = path.sub(template_dir, "")
|
9
|
+
|
10
|
+
next if path =~ /^\.+$/ || dest.empty? || path =~ /~$/
|
11
|
+
if File.directory?(path)
|
12
|
+
mkdir(dest)
|
13
|
+
else
|
14
|
+
write_template(dest, dest)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Plasmoid
|
2
|
+
class WebkitGenerator < Generator
|
3
|
+
def create_files
|
4
|
+
puts "Creating files in #{target_dir}"
|
5
|
+
FileUtils.mkpath(target_dir)
|
6
|
+
|
7
|
+
Find.find(template_dir) do |path|
|
8
|
+
dest = path.sub(template_dir, "")
|
9
|
+
|
10
|
+
next if path =~ /^\.+$/ || dest.empty? || path =~ /~$/
|
11
|
+
if File.directory?(path)
|
12
|
+
mkdir(dest)
|
13
|
+
else
|
14
|
+
write_template(dest, dest)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if options[:use_haml]
|
19
|
+
Dir.chdir(target_dir) do
|
20
|
+
Dir.glob(File.join("contents/**/**/*.html")) do |path|
|
21
|
+
dest = path + ".haml"
|
22
|
+
puts dest
|
23
|
+
system("html2haml '#{path}' '#{dest}'")
|
24
|
+
File.unlink path
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/plasmoid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{plasmoid}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David A. Cuadrado"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-06-04}
|
13
13
|
s.default_executable = %q{plasmoid}
|
14
14
|
s.description = %q{ruby gem to build and work with KDE plasmoids}
|
15
15
|
s.email = %q{krawek@gmail.com}
|
@@ -33,14 +33,19 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/plasmoid/generator.rb",
|
34
34
|
"lib/plasmoid/generator/options.rb",
|
35
35
|
"lib/plasmoid/generator/template_helper.rb",
|
36
|
-
"lib/plasmoid/generator/templates/Rakefile",
|
37
|
-
"lib/plasmoid/generator/templates/contents/code/
|
38
|
-
"lib/plasmoid/generator/templates/
|
39
|
-
"lib/plasmoid/generator/templates/
|
40
|
-
"lib/plasmoid/generator/templates/
|
36
|
+
"lib/plasmoid/generator/templates/ruby/Rakefile",
|
37
|
+
"lib/plasmoid/generator/templates/ruby/contents/code/main.rb",
|
38
|
+
"lib/plasmoid/generator/templates/ruby/metadata.desktop",
|
39
|
+
"lib/plasmoid/generator/templates/webkit/Rakefile",
|
40
|
+
"lib/plasmoid/generator/templates/webkit/contents/code/application.js",
|
41
|
+
"lib/plasmoid/generator/templates/webkit/contents/code/main.html",
|
42
|
+
"lib/plasmoid/generator/templates/webkit/contents/code/style.css",
|
43
|
+
"lib/plasmoid/generator/templates/webkit/metadata.desktop",
|
41
44
|
"lib/plasmoid/haml.rb",
|
42
45
|
"lib/plasmoid/package.rb",
|
46
|
+
"lib/plasmoid/ruby_generator.rb",
|
43
47
|
"lib/plasmoid/tasks.rb",
|
48
|
+
"lib/plasmoid/webkit_generator.rb",
|
44
49
|
"plasmoid.gemspec",
|
45
50
|
"spec/plasmoid_spec.rb",
|
46
51
|
"spec/spec_helper.rb"
|
@@ -50,24 +55,20 @@ Gem::Specification.new do |s|
|
|
50
55
|
s.require_paths = ["lib"]
|
51
56
|
s.rubygems_version = %q{1.3.7}
|
52
57
|
s.summary = %q{ruby gem to work with KDE plasmoids}
|
53
|
-
s.test_files = [
|
54
|
-
"spec/plasmoid_spec.rb",
|
55
|
-
"spec/spec_helper.rb"
|
56
|
-
]
|
57
58
|
|
58
59
|
if s.respond_to? :specification_version then
|
59
60
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
60
61
|
s.specification_version = 3
|
61
62
|
|
62
63
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
63
|
-
s.add_runtime_dependency(%q<jeweler>, ["
|
64
|
+
s.add_runtime_dependency(%q<jeweler>, ["= 1.6.0"])
|
64
65
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
65
66
|
else
|
66
|
-
s.add_dependency(%q<jeweler>, ["
|
67
|
+
s.add_dependency(%q<jeweler>, ["= 1.6.0"])
|
67
68
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
68
69
|
end
|
69
70
|
else
|
70
|
-
s.add_dependency(%q<jeweler>, ["
|
71
|
+
s.add_dependency(%q<jeweler>, ["= 1.6.0"])
|
71
72
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
72
73
|
end
|
73
74
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plasmoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- David A. Cuadrado
|
@@ -15,39 +14,39 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-06-04 00:00:00 -05:00
|
19
18
|
default_executable: plasmoid
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
21
|
+
name: jeweler
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
hash: 3
|
28
27
|
segments:
|
28
|
+
- 1
|
29
|
+
- 6
|
29
30
|
- 0
|
30
|
-
version:
|
31
|
-
requirement: *id001
|
32
|
-
prerelease: false
|
31
|
+
version: 1.6.0
|
33
32
|
type: :runtime
|
34
|
-
|
33
|
+
prerelease: false
|
34
|
+
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
36
|
+
name: bundler
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
38
|
none: false
|
38
39
|
requirements:
|
39
40
|
- - ~>
|
40
41
|
- !ruby/object:Gem::Version
|
41
|
-
hash: 23
|
42
42
|
segments:
|
43
43
|
- 1
|
44
44
|
- 0
|
45
45
|
- 0
|
46
46
|
version: 1.0.0
|
47
|
-
requirement: *id002
|
48
|
-
prerelease: false
|
49
47
|
type: :development
|
50
|
-
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: *id002
|
51
50
|
description: ruby gem to build and work with KDE plasmoids
|
52
51
|
email: krawek@gmail.com
|
53
52
|
executables:
|
@@ -72,14 +71,19 @@ files:
|
|
72
71
|
- lib/plasmoid/generator.rb
|
73
72
|
- lib/plasmoid/generator/options.rb
|
74
73
|
- lib/plasmoid/generator/template_helper.rb
|
75
|
-
- lib/plasmoid/generator/templates/Rakefile
|
76
|
-
- lib/plasmoid/generator/templates/contents/code/
|
77
|
-
- lib/plasmoid/generator/templates/
|
78
|
-
- lib/plasmoid/generator/templates/
|
79
|
-
- lib/plasmoid/generator/templates/
|
74
|
+
- lib/plasmoid/generator/templates/ruby/Rakefile
|
75
|
+
- lib/plasmoid/generator/templates/ruby/contents/code/main.rb
|
76
|
+
- lib/plasmoid/generator/templates/ruby/metadata.desktop
|
77
|
+
- lib/plasmoid/generator/templates/webkit/Rakefile
|
78
|
+
- lib/plasmoid/generator/templates/webkit/contents/code/application.js
|
79
|
+
- lib/plasmoid/generator/templates/webkit/contents/code/main.html
|
80
|
+
- lib/plasmoid/generator/templates/webkit/contents/code/style.css
|
81
|
+
- lib/plasmoid/generator/templates/webkit/metadata.desktop
|
80
82
|
- lib/plasmoid/haml.rb
|
81
83
|
- lib/plasmoid/package.rb
|
84
|
+
- lib/plasmoid/ruby_generator.rb
|
82
85
|
- lib/plasmoid/tasks.rb
|
86
|
+
- lib/plasmoid/webkit_generator.rb
|
83
87
|
- plasmoid.gemspec
|
84
88
|
- spec/plasmoid_spec.rb
|
85
89
|
- spec/spec_helper.rb
|
@@ -97,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
101
|
requirements:
|
98
102
|
- - ">="
|
99
103
|
- !ruby/object:Gem::Version
|
100
|
-
hash:
|
104
|
+
hash: -805994551903766880
|
101
105
|
segments:
|
102
106
|
- 0
|
103
107
|
version: "0"
|
@@ -106,7 +110,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
110
|
requirements:
|
107
111
|
- - ">="
|
108
112
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 3
|
110
113
|
segments:
|
111
114
|
- 0
|
112
115
|
version: "0"
|
@@ -117,6 +120,5 @@ rubygems_version: 1.3.7
|
|
117
120
|
signing_key:
|
118
121
|
specification_version: 3
|
119
122
|
summary: ruby gem to work with KDE plasmoids
|
120
|
-
test_files:
|
121
|
-
|
122
|
-
- spec/spec_helper.rb
|
123
|
+
test_files: []
|
124
|
+
|