pomodoro-gui 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 10e40696fa2c35f20f05a927f79886584b8ab177
4
+ data.tar.gz: 7bbdf3e8f49f31a3a2de438a4e897dfb915cb9eb
5
+ SHA512:
6
+ metadata.gz: 5d52bdd47088a396f1aebde7057affb87fa56956b54929aa0fa4cdbdc94bc7f1ec5abdbed5227debfa827ea9bbefe25b06945b27b5c4d64acb15bd96f83bbbe3
7
+ data.tar.gz: 1571c0b76c66e8418cdb7303f2c6aac0fa17059c55df3c920f7bced5d55d8b4e51445f1d6864fef5faded4fc72235b0fbad2f44be7b967f9ad4431cf8c218e73
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at ivan@simplelogica.net. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pomodoro-gui.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Ivan Gonzalez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # Pomodoro::Gui
2
+
3
+ [![GemVersion](https://badge.fury.io/rb/pomodoro-gui.svg)](http://badge.fury.io/rb/pomodoro-gui)
4
+
5
+ Just a simple Pomodoro with a minimal graphical interface made in Ruby with the help of Gosu made for fun.
6
+
7
+ ## About
8
+
9
+ The Pomodoro Technique is a time management method developed by Francesco Cirillo in the late 1980s. The technique uses a timer to break down work into intervals, traditionally 25 minutes in length, separated by short breaks. These intervals are called pomodoros, the plural in English of the Italian word pomodoro, which means tomato. The method is based on the idea that frequent breaks can improve mental agility. (Wikipedia)
10
+
11
+ ## Original author
12
+
13
+ Iván González, *a.k.a* [dreamingechoes](https://github.com/dreamingechoes)
14
+
15
+ ## Installation
16
+
17
+ Due to the fact that the gem uses Gosu to launch the graphical interface, you have to install first the Gosu dependencies:
18
+
19
+ ### For Mac OS X
20
+
21
+ Gosu is built on top of the SDL 2 library. I recommend installing Homebrew and then running `brew install sdl2`.
22
+
23
+ ### For Linux
24
+
25
+ You will need the following packages, even though the names will be different in every distribution: libsdl2-dev, libsdl2-ttf-dev, libpango1.0-dev, libgl1-mesa-dev, libfreeimage-dev, libopenal-dev, libsndfile-dev.
26
+
27
+ More info about this dependencies here: [Gosu's Wiki](https://github.com/gosu/gosu/wiki)
28
+
29
+ Then, you can install the gem as any other gem:
30
+
31
+ ```sh
32
+ $ gem install pomodoro-gui
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Once installed, you can see from the terminal all the options by typing `pomodoro-gui -h`:
38
+
39
+ ```sh
40
+ Usage: pomodoro-gui [options]
41
+ -r, --rest [REST] Choose rest time (in minutes)
42
+ -i, --interval [INTERVAL] Choose pomodoro length time (in minutes)
43
+ --version Show version
44
+ -h, --help Show this message
45
+ ```
46
+
47
+ To start the pomodoro with the default values, just simply execute `pomodoro-gui`. The default values are 25 minutes for the pomodoros, and 5 minutes for the rest's periods.
48
+
49
+ ## Contributing
50
+
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dreamingechoes/pomodoro-gui. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
52
+
53
+ 1. Fork it
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
58
+
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pomodoro/gui"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/pomodoro-gui ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pomodoro/gui'
4
+ require 'optparse'
5
+
6
+ include Pomodoro::Gui
7
+
8
+ # Default options
9
+ options = {
10
+ rest: 5,
11
+ interval: 25
12
+ }
13
+
14
+ OptionParser.new do |opts|
15
+ opts.banner = 'Usage: pomodoro-gui [options]'
16
+
17
+ opts.on_tail '--version', 'Show version' do
18
+ puts "pomodoro-gui v#{Pomodoro::Gui::VERSION}"
19
+ exit
20
+ end
21
+
22
+ opts.on(
23
+ '-r', '--rest [REST]', 'Choose rest time (in minutes)'
24
+ ) do |s|
25
+ options[:rest] = s.to_i
26
+ end
27
+
28
+ opts.on(
29
+ '-i', '--interval [INTERVAL]', 'Choose pomodoro length time (in minutes)'
30
+ ) do |s|
31
+ options[:interval] = s.to_i
32
+ end
33
+
34
+ opts.on_tail '-h', '--help', 'Show this message' do
35
+ puts opts
36
+ exit
37
+ end
38
+ end.parse!
39
+
40
+ Pomodoro::Gui.init options
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ module Pomodoro
2
+ module Gui
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,107 @@
1
+ require 'gosu'
2
+
3
+ module Pomodoro
4
+ module Gui
5
+ class Window < Gosu::Window
6
+
7
+ IMAGE_ASSETS = {
8
+ background: "assets/images/background.png",
9
+ pomodoro: "assets/images/pomodoro.png",
10
+ occupied: "assets/images/occupied.png",
11
+ rest: "assets/images/rest.png"
12
+ }
13
+
14
+ AUDIO_ASSETS = {
15
+ start: "assets/sounds/start.mp3",
16
+ rest: "assets/sounds/rest.mp3"
17
+ }
18
+
19
+ FONT_ASSETS = {
20
+ font: "assets/fonts/roboto.ttf",
21
+ bold: "assets/fonts/roboto_bold.ttf"
22
+ }
23
+
24
+ def initialize(options={})
25
+ super 304, 488
26
+
27
+ @images = {}
28
+ @audio = {}
29
+ @interval = options[:interval]
30
+ @rest = options[:rest]
31
+ @state = 0
32
+ @cycles = 0
33
+
34
+ self.caption = "Pomodoro GUI"
35
+ self.load_assets
36
+ self.reset_timer
37
+ end
38
+
39
+ def launch!
40
+ self.show
41
+ end
42
+
43
+ def draw
44
+ @images[:background].draw(0, 0, 0)
45
+ @images[:pomodoro].draw(32, 16, 1)
46
+
47
+ if @state == 0
48
+ @images[:occupied].draw(104, 364, 1)
49
+ else
50
+ @images[:rest].draw(104, 364, 1)
51
+ end
52
+
53
+ @font.draw("This is your pomodoro ##{@cycles.to_s.rjust(2, '0')}", 20, 268, 3, 1, 1, Gosu::Color::BLACK)
54
+ @font_time.draw("#{(@t + @seconds).strftime('%M:%S')}", 92, 292, 3, 1, 1, @timer_colour)
55
+ end
56
+
57
+ def update
58
+ if @seconds == 0
59
+ @state = @state == 0 ? 1 : 0
60
+ self.reset_timer
61
+ else
62
+ @tick += 1
63
+ if @tick == 60
64
+ @seconds -= 1
65
+ @tick = 0
66
+ end
67
+ end
68
+ end
69
+
70
+ def needs_cursor?
71
+ true
72
+ end
73
+
74
+ protected
75
+
76
+ def load_assets
77
+ IMAGE_ASSETS.each do |key, value|
78
+ @images[key] = Gosu::Image.new(value)
79
+ end
80
+
81
+ AUDIO_ASSETS.each do |key, value|
82
+ @audio[key] = Gosu::Song.new(self, value)
83
+ end
84
+
85
+ @font = Gosu::Font.new(self, FONT_ASSETS[:font], 32)
86
+ @font_time = Gosu::Font.new(self, FONT_ASSETS[:bold], 64)
87
+ end
88
+
89
+ def reset_timer
90
+ if @state == 0
91
+ @seconds = @interval * 60
92
+ @timer_colour = Gosu::Color::RED
93
+ @cycles += 1
94
+ @audio[:start].play
95
+ else
96
+ @seconds = @rest * 60
97
+ @timer_colour = Gosu::Color::GREEN
98
+ @audio[:rest].play
99
+ end
100
+
101
+ @t = Time.new(0)
102
+ @tick = 0
103
+ end
104
+
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,17 @@
1
+ require "pomodoro/gui/version"
2
+ require "pomodoro/gui/window"
3
+
4
+ module Pomodoro
5
+ module Gui
6
+
7
+ def self.init(options={})
8
+ begin
9
+ window = Pomodoro::Gui::Window.new(options)
10
+ window.show
11
+ rescue Interrupt => e
12
+ puts "\r Something goes wrong! :("
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pomodoro/gui/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pomodoro-gui"
8
+ spec.version = Pomodoro::Gui::VERSION
9
+ spec.authors = ["Ivan Gonzalez"]
10
+ spec.email = ["xixon.sound@gmail.com"]
11
+
12
+ spec.summary = %q{Pomodoro tool made in Ruby.}
13
+ spec.description = %q{Just a simple pomodoro with graphical interface made in Ruby.}
14
+ spec.homepage = "https://github.com/dreamingechoes/pomodoro-gui"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.executables << 'pomodoro-gui'
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.11"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_dependency "gosu", ">= 0.9.0"
24
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pomodoro-gui
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Gonzalez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: gosu
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.0
55
+ description: Just a simple pomodoro with graphical interface made in Ruby.
56
+ email:
57
+ - xixon.sound@gmail.com
58
+ executables:
59
+ - pomodoro-gui
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - CODE_OF_CONDUCT.md
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - assets/fonts/roboto.ttf
70
+ - assets/fonts/roboto_bold.ttf
71
+ - assets/images/background.png
72
+ - assets/images/occupied.png
73
+ - assets/images/pomodoro.png
74
+ - assets/images/rest.png
75
+ - assets/sounds/rest.mp3
76
+ - assets/sounds/start.mp3
77
+ - bin/console
78
+ - bin/pomodoro-gui
79
+ - bin/setup
80
+ - lib/pomodoro/gui.rb
81
+ - lib/pomodoro/gui/version.rb
82
+ - lib/pomodoro/gui/window.rb
83
+ - pomodoro-gui.gemspec
84
+ homepage: https://github.com/dreamingechoes/pomodoro-gui
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.4.5.1
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Pomodoro tool made in Ruby.
108
+ test_files: []