LionAdmin 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -46,7 +46,51 @@ Where RUBY_USER is the name of the user that is ssh-ing to the server.
46
46
 
47
47
 
48
48
  ## Usage
49
+ Create a new instance:
49
50
 
51
+ lion = LionAdmin::Base.new(user@mountainlion.server.com)
52
+
53
+ Get list of all services
54
+
55
+ lion.services
56
+
57
+ Get the status of a service
58
+
59
+ lion.status(service)
60
+
61
+ Get the ful status of a service
62
+
63
+ lion.fullstatus(service)
64
+
65
+ Get the settings for a service
66
+
67
+ lion.settings(service)
68
+
69
+ Start a service
70
+
71
+ lion.start_service(service)
72
+
73
+ Stop a service
74
+
75
+ lion.stop_service(service)
76
+
77
+ Run a command
78
+
79
+ lion.run_command(service,command)
80
+
81
+ Get running services
82
+
83
+ lion.get_running_services
84
+
85
+ Get stopped services
86
+
87
+ lion.get_stopped_services
88
+
89
+ Change settings
90
+
91
+ lion.change_settings(service, preference, new_value)
92
+
93
+ #PLEASE NOTE: THIS METHOD NEEDS MORE TESTING AND DO NO CHANGE SETTINGS UNLESS YOU ARE ABSOLUTELY SURE THE NEW VALUE WILL WORK
50
94
 
51
95
  ## Contributing
52
96
 
@@ -55,6 +55,28 @@ module LionAdmin
55
55
  end
56
56
  end
57
57
 
58
+ def get_running_services
59
+ running_services = Array.new
60
+ list_of_services = services
61
+ list_of_services.each do |s|
62
+ if check_if_running(s)
63
+ running_services.push(s)
64
+ end
65
+ end
66
+ return running_services
67
+ end
68
+
69
+ def get_stopped_services
70
+ stopped_services = Array.new
71
+ list_of_services = services
72
+ list_of_services.each do |s|
73
+ unless check_if_running(s)
74
+ stopped_services.push(s)
75
+ end
76
+ end
77
+ return stopped_services
78
+ end
79
+
58
80
  def change_settings(service,pref,value)
59
81
  output_plist = Plist::parse_xml(%x[#{@user_prefix} #{SERVER_ADMIN} settings #{service}:#{pref} = #{value} -x])
60
82
  return output_plist[pref]
@@ -1,3 +1,3 @@
1
1
  module LionAdmin
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LionAdmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plist
16
- requirement: &70269315801120 !ruby/object:Gem::Requirement
16
+ requirement: &70119139185660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70269315801120
24
+ version_requirements: *70119139185660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70269315800700 !ruby/object:Gem::Requirement
27
+ requirement: &70119139185240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70269315800700
35
+ version_requirements: *70119139185240
36
36
  description: ruby wrapper to the serveradmin binary
37
37
  email:
38
38
  - anurag@columbia.edu