rmonitor 2.0.0 → 2.0.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rmonitor +37 -12
  3. data/lib/rmonitor/version.rb +1 -1
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39988281a286deee26d615bb35fb4023b5bca9e0
4
- data.tar.gz: 1b09ddd2c01ad30a7f31c75bcd2baf06624b1a90
3
+ metadata.gz: 5aec3b1453e7018791ba701830a361116b6d6679
4
+ data.tar.gz: c86e338487cdf85e2edec36bfe5eb4cf2f9326fa
5
5
  SHA512:
6
- metadata.gz: 249da323f0ac72f0e52fee4f39cc55cb6d8702e7d098625362874a947dab993d71b2f299e85fbf15f732d6acc67543695de4868ab614e45f5623afeb225d2b68
7
- data.tar.gz: a96ea8f0a0f87f286e882e1ea186b60600b9df3cfc3fee2bdf9a93004ff71f48373c48b5979d5d96ac8d8b88eedf00a1c0e8affa92e37d17804fcdc8f612600a
6
+ metadata.gz: 727f5f3286fbb50885f5b56daca2173b5611a5198cedf1eae3fd25af326eba1c8d11d82d6b9dd3751a34b3b76b4156f9d74e8509d569c133484cf9d83c72bdfa
7
+ data.tar.gz: f9c8b6a223ad6906c24c1ca0b0273f4bf4639e1a024f46112c0c95a204e0716c5dce1acb0426ef572cb4a3cec5b732d69ad43887e02d489d1ed928ef43dbdd87
@@ -14,17 +14,46 @@ DESC
14
14
  RMonitor::Config.config_path = path
15
15
  end
16
16
 
17
+ def create_common_options(c)
18
+ c.option "--strategy NAME", String, <<-DESC.strip.gsub(/^ +/, "")
19
+ invoke using an execution strategy
20
+
21
+ the possible options are
22
+
23
+ · optimistic - attempt to invoke a profile using a single xrandr command
24
+
25
+ · pessimistic - invoke a profile using multiple xrandr commands (slower, safer and default)
26
+ DESC
27
+
28
+ c.option "--dry-run", "don't run any destructive commands"
29
+ c.option "--verbose", "print every command ran"
30
+ end
31
+
32
+ def create_option_hash(options)
33
+ hash = {
34
+ :dry_run => options.dry_run,
35
+ :verbose => options.verbose
36
+ }
37
+
38
+ hash[:strategy] = case options.strategy
39
+ when "optimistic"
40
+ RMonitor::Strategies::Optimistic.new(hash)
41
+ when "pessimistic", nil
42
+ RMonitor::Strategies::Pessimistic.new(hash)
43
+ else
44
+ raise ArgumentError, "unknown execution strategy"
45
+ end
46
+
47
+ hash
48
+ end
49
+
17
50
  command :invoke do |c|
18
51
  c.syntax = "invoke [options]"
19
52
  c.description = "invoke a profile by name"
20
53
  c.option "-n", "--name NAME", String
21
- c.option "--dry-run", "don't run any destructive commands"
22
- c.option "--verbose", "print every command ran"
54
+ create_common_options(c)
23
55
  c.action do |_, options|
24
- RMonitor::Commands::CL::Invoke.new(
25
- :verbose => options.verbose,
26
- :dry_run => options.dry_run
27
- ).execute(options.name)
56
+ RMonitor::Commands::CL::Invoke.new(create_option_hash(options)).execute(options.name)
28
57
  end
29
58
  end
30
59
 
@@ -39,12 +68,8 @@ end
39
68
  command :update do |c|
40
69
  c.syntax = "update"
41
70
  c.description = "invokes the most preferred profile"
42
- c.option "--dry-run", "don't run any destructive commands"
43
- c.option "--verbose", "print every command ran"
71
+ create_common_options(c)
44
72
  c.action do |_, options|
45
- RMonitor::Commands::CL::Update.new(
46
- :verbose => options.verbose,
47
- :dry_run => options.dry_run
48
- ).execute
73
+ RMonitor::Commands::CL::Update.new(create_option_hash(options)).execute
49
74
  end
50
75
  end
@@ -1,3 +1,3 @@
1
1
  class RMonitor
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmonitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Amundsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.3.4
19
+ version: 4.3.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.3.4
26
+ version: 4.3.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: codeclimate-test-reporter
29
29
  requirement: !ruby/object:Gem::Requirement