moodwall 0.1.0 → 0.1.2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +26 -15
- data/lib/moodwall/mood.rb +18 -5
- data/lib/moodwall/version.rb +1 -1
- data/lib/moodwall/wallpaper.rb +6 -1
- data/moodwall.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1a49854035765c11616966aa41cefdafd74e299ae654b4a5aad8b3ec595aac5
|
4
|
+
data.tar.gz: 4f475c8464408151a7610bde11e9c013d8917bcb721de3597724aeb004b2a4bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff2f57f261414b17eaa996932934b749a53f788904095ff6ceacae7844611863b9fc386b7518f0301af3ec859eadf0ab1bb1a04ef60f91be0a99fb9bbdb9fb1f
|
7
|
+
data.tar.gz: e32905d8bdffee5d4d4bb49d1d681497f853ac95ebfe712ae5824a3822f420ed9d003a57e9af2c2a62f8b3e215c0bf59eab4f68dd047a8d4f885ae1d8ad5e7cd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,28 +1,39 @@
|
|
1
|
-
|
1
|
+
## Moodwall: A simple CLI tool aimed to help manage wallpapers.
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/vmikhaliuk/moodwall)
|
4
|
+
[](https://codeclimate.com/github/vmikhaliuk/moodwall/maintainability)
|
5
|
+
[](https://coveralls.io/github/vmikhaliuk/moodwall?branch=master)
|
6
|
+
[](http://www.gnu.org/licenses/gpl-3.0)
|
4
7
|
|
5
|
-
|
8
|
+

|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
9
|
-
|
12
|
+
Install it yourself as:
|
10
13
|
|
11
|
-
|
12
|
-
|
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
|
-
|
23
|
+
<!-- Then you should be able to add wallpapers -->
|
16
24
|
|
17
|
-
|
25
|
+
moodwall -a -w ~/Pictures/wallpaper/mountains.jpeg -m Winter
|
18
26
|
|
19
|
-
|
27
|
+
<!-- To change wallpaper use -->
|
20
28
|
|
21
|
-
|
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/
|
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/
|
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).
|
data/lib/moodwall/mood.rb
CHANGED
@@ -8,12 +8,25 @@ module Moodwall
|
|
8
8
|
@current = current
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
16
|
-
|
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
|
data/lib/moodwall/version.rb
CHANGED
data/lib/moodwall/wallpaper.rb
CHANGED
@@ -16,11 +16,16 @@ module Moodwall
|
|
16
16
|
|
17
17
|
class << self
|
18
18
|
def sample
|
19
|
-
record =
|
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
|
data/moodwall.gemspec
CHANGED
@@ -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"]
|