ruby_do_plugin_power_management_upower 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "ruby_do"
7
+ gem "knjrbfw"
8
+
9
+ # Add dependencies to develop your gem here.
10
+ # Include everything needed to run rake, tests, features, etc.
11
+ group :development do
12
+ gem "rspec", "~> 2.8.0"
13
+ gem "rdoc", "~> 3.12"
14
+ gem "bundler", ">= 1.0.0"
15
+ gem "jeweler", "~> 1.8.4"
16
+ end
@@ -0,0 +1,61 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ atk (1.1.3)
5
+ glib2 (>= 1.1.3)
6
+ cairo (1.12.2)
7
+ pkg-config
8
+ diff-lcs (1.1.3)
9
+ gdk_pixbuf2 (1.1.3)
10
+ glib2 (>= 1.1.3)
11
+ gettext (2.2.1)
12
+ locale
13
+ git (1.2.5)
14
+ glib2 (1.1.3)
15
+ pkg-config
16
+ gtk2 (1.1.3)
17
+ atk (>= 1.1.3)
18
+ gdk_pixbuf2 (>= 1.1.3)
19
+ pango (>= 1.1.3)
20
+ jeweler (1.8.4)
21
+ bundler (~> 1.0)
22
+ git (>= 1.2.5)
23
+ rake
24
+ rdoc
25
+ json (1.7.3)
26
+ knjrbfw (0.0.59)
27
+ tsafe
28
+ wref
29
+ locale (2.0.5)
30
+ pango (1.1.3)
31
+ cairo (>= 1.10.0)
32
+ glib2 (>= 1.1.3)
33
+ pkg-config (1.1.3)
34
+ rake (0.9.2.2)
35
+ rdoc (3.12)
36
+ json (~> 1.4)
37
+ rspec (2.8.0)
38
+ rspec-core (~> 2.8.0)
39
+ rspec-expectations (~> 2.8.0)
40
+ rspec-mocks (~> 2.8.0)
41
+ rspec-core (2.8.0)
42
+ rspec-expectations (2.8.0)
43
+ diff-lcs (~> 1.1.2)
44
+ rspec-mocks (2.8.0)
45
+ ruby_do (0.0.0)
46
+ gettext
47
+ gtk2
48
+ knjrbfw
49
+ tsafe (0.0.1)
50
+ wref (0.0.4)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ bundler (>= 1.0.0)
57
+ jeweler (~> 1.8.4)
58
+ knjrbfw
59
+ rdoc (~> 3.12)
60
+ rspec (~> 2.8.0)
61
+ ruby_do
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Kasper Johansen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ = ruby_do_plugin_power_management_upower
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to ruby_do_plugin_power_management_upower
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Kasper Johansen. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "ruby_do_plugin_power_management_upower"
18
+ gem.homepage = "http://github.com/kaspernj/ruby_do_plugin_power_management_upower"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{A plugin for Ruby-Do that can log out, suspend, hibernate and shut the computer down.}
21
+ gem.description = %Q{A plugin for Ruby-Do that can log out, suspend, hibernate and shut the computer down.}
22
+ gem.email = "k@spernj.org"
23
+ gem.authors = ["Kasper Johansen"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "ruby_do_plugin_power_management_upower #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,56 @@
1
+ class Ruby_do_plugin_power_management_upower < Ruby_do::Plugin::Base
2
+ def start
3
+ self.register_static_result(
4
+ :id_str => "suspend",
5
+ :title => _("Suspend"),
6
+ :descr => _("Suspend the computer to RAM."),
7
+ :icon_path => File.realpath("#{File.dirname(__FILE__)}/../gfx/system-suspend.png"),
8
+ :data => {
9
+ :mode => :suspend
10
+ }
11
+ )
12
+ self.register_static_result(
13
+ :id_str => "shutdown",
14
+ :title => _("Shutdown"),
15
+ :descr => _("Shutdown the computer."),
16
+ :icon_path => File.realpath("#{File.dirname(__FILE__)}/../gfx/system-shutdown.png"),
17
+ :data => {
18
+ :mode => :shutdown
19
+ }
20
+ )
21
+ self.register_static_result(
22
+ :id_str => "reboot",
23
+ :title => _("Reboot"),
24
+ :descr => _("Reboot the computer."),
25
+ :icon_path => File.realpath("#{File.dirname(__FILE__)}/../gfx/system-reboot.png"),
26
+ :data => {
27
+ :mode => :shutdown
28
+ }
29
+ )
30
+ self.register_static_result(
31
+ :id_str => "hibernate",
32
+ :title => _("Hibernate"),
33
+ :descr => _("Suspend to computer to harddrive."),
34
+ :icon_path => File.realpath("#{File.dirname(__FILE__)}/../gfx/system-suspend-hibernate.png"),
35
+ :data => {
36
+ :mode => :shutdown
37
+ }
38
+ )
39
+ end
40
+
41
+ def execute_static_result(args)
42
+ if args[:sres].data[:mode] == :suspend
43
+ Knj::Os.subproc("dbus-send --system --print-reply --dest=\"org.freedesktop.UPower\" /org/freedesktop/UPower org.freedesktop.UPower.Suspend")
44
+ elsif args[:sres].data[:mode] == :shutdown
45
+ Knj::Os.subproc("dbus-send --system --print-reply --dest=\"org.freedesktop.UPower\" /org/freedesktop/UPower org.freedesktop.UPower.Shutdown")
46
+ elsif args[:sres].data[:mode] == :reboot
47
+ Knj::Os.subproc("dbus-send --system --print-reply --dest=\"org.freedesktop.UPower\" /org/freedesktop/UPower org.freedesktop.UPower.Reboot")
48
+ elsif args[:sres].data[:mode] == :hibernate
49
+ Knj::Os.subproc("dbus-send --system --print-reply --dest=\"org.freedesktop.UPower\" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate")
50
+ else
51
+ raise sprintf(_("Unknown mode: '%s'."), args[:sres].data[:mode])
52
+ end
53
+
54
+ return :close_win_main
55
+ end
56
+ end
@@ -0,0 +1,71 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{ruby_do_plugin_power_management_upower}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Kasper Johansen"]
12
+ s.date = %q{2012-07-16}
13
+ s.description = %q{A plugin for Ruby-Do that can log out, suspend, hibernate and shut the computer down.}
14
+ s.email = %q{k@spernj.org}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "gfx/system-log-out.png",
29
+ "gfx/system-reboot.png",
30
+ "gfx/system-shutdown.png",
31
+ "gfx/system-suspend-hibernate.png",
32
+ "gfx/system-suspend.png",
33
+ "lib/ruby_do_plugin_power_management_upower.rb",
34
+ "ruby_do_plugin_power_management_upower.gemspec",
35
+ "spec/ruby_do_plugin_power_management_upower_spec.rb",
36
+ "spec/spec_helper.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/kaspernj/ruby_do_plugin_power_management_upower}
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.6.2}
42
+ s.summary = %q{A plugin for Ruby-Do that can log out, suspend, hibernate and shut the computer down.}
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<ruby_do>, [">= 0"])
49
+ s.add_runtime_dependency(%q<knjrbfw>, [">= 0"])
50
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
51
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
52
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
53
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
54
+ else
55
+ s.add_dependency(%q<ruby_do>, [">= 0"])
56
+ s.add_dependency(%q<knjrbfw>, [">= 0"])
57
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
58
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
60
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
61
+ end
62
+ else
63
+ s.add_dependency(%q<ruby_do>, [">= 0"])
64
+ s.add_dependency(%q<knjrbfw>, [">= 0"])
65
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
66
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
68
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
69
+ end
70
+ end
71
+
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "RubyDoPluginPowerManagementUpower" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'ruby_do_plugin_power_management_upower'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_do_plugin_power_management_upower
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Kasper Johansen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-07-16 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: ruby_do
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: knjrbfw
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.8.0
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rdoc
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: "3.12"
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: bundler
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.0.0
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: jeweler
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 1.8.4
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: *id006
82
+ description: A plugin for Ruby-Do that can log out, suspend, hibernate and shut the computer down.
83
+ email: k@spernj.org
84
+ executables: []
85
+
86
+ extensions: []
87
+
88
+ extra_rdoc_files:
89
+ - LICENSE.txt
90
+ - README.rdoc
91
+ files:
92
+ - .document
93
+ - .rspec
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - LICENSE.txt
97
+ - README.rdoc
98
+ - Rakefile
99
+ - VERSION
100
+ - gfx/system-log-out.png
101
+ - gfx/system-reboot.png
102
+ - gfx/system-shutdown.png
103
+ - gfx/system-suspend-hibernate.png
104
+ - gfx/system-suspend.png
105
+ - lib/ruby_do_plugin_power_management_upower.rb
106
+ - ruby_do_plugin_power_management_upower.gemspec
107
+ - spec/ruby_do_plugin_power_management_upower_spec.rb
108
+ - spec/spec_helper.rb
109
+ has_rdoc: true
110
+ homepage: http://github.com/kaspernj/ruby_do_plugin_power_management_upower
111
+ licenses:
112
+ - MIT
113
+ post_install_message:
114
+ rdoc_options: []
115
+
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ hash: -4104341263129529421
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: "0"
133
+ requirements: []
134
+
135
+ rubyforge_project:
136
+ rubygems_version: 1.6.2
137
+ signing_key:
138
+ specification_version: 3
139
+ summary: A plugin for Ruby-Do that can log out, suspend, hibernate and shut the computer down.
140
+ test_files: []
141
+