moodwall 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97776da1767cdda1a2deeba5aaee46a392ca122cdb868ad050bafefc31348fc8
4
- data.tar.gz: ba0fec386db3d44dc6805f49ba1fff7976310fdb4983b74c18cedb3140e2e7e7
3
+ metadata.gz: e1a49854035765c11616966aa41cefdafd74e299ae654b4a5aad8b3ec595aac5
4
+ data.tar.gz: 4f475c8464408151a7610bde11e9c013d8917bcb721de3597724aeb004b2a4bd
5
5
  SHA512:
6
- metadata.gz: 8be3c13ce7ce4568cb81ae8710ec115dbdbb75b93cefa2453ee26561789fbec45ce1e11c77088deaff3852e68c21fbd4ff8ca6025498312ddf2a80a784580531
7
- data.tar.gz: 8e87a06e8f3171282c1ad47d21462504ddf2e8a3ea72ab6be2502eac8edc6703c99f3b185952350cd34e7050d88bbb13e2f60992c9bebb155b5163def93c86d1
6
+ metadata.gz: ff2f57f261414b17eaa996932934b749a53f788904095ff6ceacae7844611863b9fc386b7518f0301af3ec859eadf0ab1bb1a04ef60f91be0a99fb9bbdb9fb1f
7
+ data.tar.gz: e32905d8bdffee5d4d4bb49d1d681497f853ac95ebfe712ae5824a3822f420ed9d003a57e9af2c2a62f8b3e215c0bf59eab4f68dd047a8d4f885ae1d8ad5e7cd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- moodwall (0.1.0)
4
+ moodwall (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,28 +1,39 @@
1
- # Moodwall
1
+ ## Moodwall: A simple CLI tool aimed to help manage wallpapers.
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/moodwall`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Build Status](https://travis-ci.org/vmikhaliuk/moodwall.svg?branch=master)](https://travis-ci.org/vmikhaliuk/moodwall)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/ad73e69778bb4b5dcbdb/maintainability)](https://codeclimate.com/github/vmikhaliuk/moodwall/maintainability)
5
+ [![Coverage Status](https://coveralls.io/repos/github/vmikhaliuk/moodwall/badge.svg?branch=master)](https://coveralls.io/github/vmikhaliuk/moodwall?branch=master)
6
+ [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
4
7
 
5
- TODO: Delete this and the text above, and describe your gem
8
+ ![Alt text](assets/meme.jpg?raw=true)
6
9
 
7
10
  ## Installation
8
11
 
9
- Add this line to your application's Gemfile:
12
+ Install it yourself as:
10
13
 
11
- ```ruby
12
- gem 'moodwall'
13
- ```
14
+ $ gem install moodwall
15
+
16
+ ## Usage examples
17
+
18
+ ``` shell
19
+ <!-- First of all, you need to add some moods -->
20
+
21
+ moodwall -a -m Winter
14
22
 
15
- And then execute:
23
+ <!-- Then you should be able to add wallpapers -->
16
24
 
17
- $ bundle
25
+ moodwall -a -w ~/Pictures/wallpaper/mountains.jpeg -m Winter
18
26
 
19
- Or install it yourself as:
27
+ <!-- To change wallpaper use -->
20
28
 
21
- $ gem install moodwall
29
+ moodwall -c -w or simply moodwall, since its a default option.
30
+
31
+ <!-- To change current mood use: -->
32
+
33
+ moodwall -c -m Winter
34
+ ```
22
35
 
23
- ## Usage
24
36
 
25
- TODO: Write usage instructions here
26
37
 
27
38
  ## Development
28
39
 
@@ -32,8 +43,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
43
 
33
44
  ## Contributing
34
45
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/moodwall. 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.
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/vmikhaliuk/moodwall. 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.
36
47
 
37
48
  ## Code of Conduct
38
49
 
39
- Everyone interacting in the Moodwall project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/moodwall/blob/master/CODE_OF_CONDUCT.md).
50
+ Everyone interacting in the Moodwall project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/vmikhaliuk/moodwall/blob/master/CODE_OF_CONDUCT.md).
@@ -8,12 +8,25 @@ module Moodwall
8
8
  @current = current
9
9
  end
10
10
 
11
- def self.current
12
- all.find { |m| m.current == true }
13
- end
11
+ class << self
12
+ def current
13
+ all.find { |m| m.current == true }
14
+ end
15
+
16
+ def set_current(name:)
17
+ previous = current
18
+ if !previous.nil?
19
+ previous.current = false
20
+ previous.save
21
+ end
22
+ new_one = find_by_name(name)
23
+ new_one.current = true
24
+ new_one.save
25
+ end
14
26
 
15
- def self.find_by_name(name)
16
- all.find { |m| m.name.casecmp(name).zero? }
27
+ def find_by_name(name)
28
+ all.find { |m| m.name.casecmp(name).zero? }
29
+ end
17
30
  end
18
31
  end
19
32
  end
@@ -1,3 +1,3 @@
1
1
  module Moodwall
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -16,11 +16,16 @@ module Moodwall
16
16
 
17
17
  class << self
18
18
  def sample
19
- record = all.shuffle.min
19
+ record = within_current_mood.shuffle.sort.first
20
20
  raise(WallpaperNotFoundError, "Can't find wallpaper.") if record.nil?
21
21
  record.increment_weight!
22
22
  record
23
23
  end
24
+
25
+ def within_current_mood
26
+ mood = Moodwall::Mood.current
27
+ mood.nil? ? all : all.select { |w| w.mood_id == mood.id }
28
+ end
24
29
  end
25
30
 
26
31
  def save
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  # Specify which files should be added to the gem when it is released.
15
15
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
16
16
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|assets)/}) }
18
18
  end
19
19
  spec.executables = %w[moodwall]
20
20
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moodwall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valiantsin Mikhaliuk