working_man 0.0.3 → 0.0.4

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.
data/Gemfile.lock CHANGED
@@ -8,7 +8,7 @@ GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  json (1.6.5)
11
- methadone (0.5.1)
11
+ methadone (1.0.0)
12
12
  bundler
13
13
  rake (0.9.2.2)
14
14
  rdoc (3.12)
data/README.md CHANGED
@@ -9,10 +9,27 @@ Install like normal in your system then start/stop as needed.
9
9
 
10
10
  $ gem install working_man
11
11
 
12
- ## Usage
12
+ ## Configuration
13
+
14
+ WorkingMan reads applications and URLs from `~/.working_man.yml`. You
15
+ just need to customize it to your needs and then run.
16
+
17
+ ### Example
13
18
 
14
- WorkingMan reads applications and URLs from `config/setup.yml`. You just need
15
- to customize it to your needs and then run.
19
+ ```yaml
20
+ # Default applications for startup and shutdown.
21
+ # Add/remove applications to customize
22
+ apps:
23
+ - 'Google Chrome'
24
+ - 'Briquette'
25
+ - 'Skype'
26
+
27
+ # URLs open in default browser
28
+ urls:
29
+ - 'http://www.google.com'
30
+ ```
31
+
32
+ ## Usage
16
33
 
17
34
  To start your work day, run the following:
18
35
 
@@ -1,11 +1,12 @@
1
1
  # Default applications for startup and shutdown.
2
2
  # Add/remove applications to customize
3
3
  apps:
4
- - 'Google Chrome'
4
+ #- 'Google Chrome'
5
+ #- 'Briquette'
6
+ #- 'Skype'
7
+ #- 'iChat'
5
8
  - 'Propane'
6
- - 'Skype'
7
- - 'iChat'
8
-
9
+
9
10
  # URLs open in default browser
10
11
  urls:
11
- - 'http://google.com'
12
+ #- 'http://google.com'
data/lib/working_man.rb CHANGED
@@ -3,14 +3,50 @@ require "working_man/version"
3
3
  require "working_man/actions"
4
4
 
5
5
  module WorkingMan
6
- @config = YAML::load(File.open('../../config/setup.yml'))
7
-
6
+
7
+ # Check for configuration file and assign it to @config. If no configuration
8
+ # in ~/.working_man.yml then exit with error code 1
9
+ #
10
+ #
11
+ if File.exists?(File.expand_path('~/.working_man.yml'))
12
+ @config = YAML::load File.open(File.expand_path('~/.working_man.yml'))
13
+ else
14
+ print "No configuration found. Please configure which apps to start in ~/.working_man.yml\n"
15
+ exit(1)
16
+ end
17
+
18
+ # Start work calls WorkingMan::Actions#launch_applications, iterating through
19
+ # each app in @config['apps']. It exits if there are no applications with
20
+ # error code 2. If there are no URLs, the program finishes successfully.
21
+ #
22
+ #
8
23
  def self.start_work
9
- WorkingMan::Actions.launch_applications(@config['apps'])
10
- WorkingMan::Actions.open_urls(@config['urls'])
24
+ print "Starting work...\n"
25
+ begin
26
+ WorkingMan::Actions.launch_applications(@config['apps'])
27
+ rescue NoMethodError
28
+ p "No applications in configuration"
29
+ exit(2)
30
+ end
31
+
32
+ begin
33
+ WorkingMan::Actions.open_urls(@config['urls'])
34
+ rescue NoMethodError
35
+ end
36
+ print "Work hard today!\n"
11
37
  end
12
38
 
39
+ # Stop work iterates through the apps in @config['apps'], stopping each one
40
+ #
41
+ #
13
42
  def self.stop_work
14
- WorkingMan::Actions.close_applications(@config['apps'])
43
+ print "Stopping work...\n"
44
+ begin
45
+ WorkingMan::Actions.close_applications(@config['apps'])
46
+ rescue NoMethodError
47
+ p "No applications in configuration"
48
+ exit(2)
49
+ end
50
+ print "Have a great day!\n"
15
51
  end
16
52
  end
@@ -1,3 +1,3 @@
1
1
  module WorkingMan
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,5 @@
1
+ require 'test/unit'
2
+
3
+ class TestWorkingMan < Test::Unit::TestCase
4
+
5
+ end
data/working_man.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["emachnic@broadmac.net"]
7
7
  gem.description = %q{Start/stop your work apps for the day}
8
8
  gem.summary = %q{Start/stop your work apps for the day}
9
- gem.homepage = "http://github.com/emachnic/working_man"
9
+ gem.homepage = "http://emachnic.github.com/working_man"
10
10
 
11
11
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
12
  gem.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: working_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-05 00:00:00.000000000 Z
12
+ date: 2012-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
16
- requirement: &70323944905440 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70323944905440
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &70323944903820 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 0.9.2
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70323944903820
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.9.2
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: methadone
38
- requirement: &70323944902940 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70323944902940
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  description: Start/stop your work apps for the day
48
63
  email:
49
64
  - emachnic@broadmac.net
@@ -59,13 +74,13 @@ files:
59
74
  - README.md
60
75
  - Rakefile
61
76
  - bin/working_man
62
- - config/setup.yml.example
77
+ - lib/resources/working_man.yml
63
78
  - lib/working_man.rb
64
79
  - lib/working_man/actions.rb
65
80
  - lib/working_man/version.rb
66
- - test/tc_something.rb
81
+ - test/test_working_man.rb
67
82
  - working_man.gemspec
68
- homepage: http://github.com/emachnic/working_man
83
+ homepage: http://emachnic.github.com/working_man
69
84
  licenses: []
70
85
  post_install_message:
71
86
  rdoc_options: []
@@ -77,23 +92,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
92
  - - ! '>='
78
93
  - !ruby/object:Gem::Version
79
94
  version: '0'
80
- segments:
81
- - 0
82
- hash: -4516065591076223460
83
95
  required_rubygems_version: !ruby/object:Gem::Requirement
84
96
  none: false
85
97
  requirements:
86
98
  - - ! '>='
87
99
  - !ruby/object:Gem::Version
88
100
  version: '0'
89
- segments:
90
- - 0
91
- hash: -4516065591076223460
92
101
  requirements: []
93
102
  rubyforge_project:
94
- rubygems_version: 1.8.17
103
+ rubygems_version: 1.8.21
95
104
  signing_key:
96
105
  specification_version: 3
97
106
  summary: Start/stop your work apps for the day
98
107
  test_files:
99
- - test/tc_something.rb
108
+ - test/test_working_man.rb
data/test/tc_something.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'test/unit'
2
-
3
- class TestSomething < Test::Unit::TestCase
4
- def test_truth
5
- assert true
6
- end
7
- end