marshmallow 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/marshmallow.rb +199 -0
- data/lib/marshmallow/version.rb +3 -0
- data/marshmallow.gemspec +36 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4f385bffb8c4b740a68e8c77f767fe6ca25c434c
|
4
|
+
data.tar.gz: 80f8080fdf605af0d42622438c7f3e0195327ef5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f0f51d9b1268810f03deec79fd5d5a897b484191387446ce5bdb7188a9d1309ed87cc65895b9b5eba60ffbab969f58cece9fe3b605948822475572847fde707b
|
7
|
+
data.tar.gz: 960bd1ea869c23c34b6064e426a3d49dd901bcbcec5ce0b962c9578e3afde103ab49ee52299a636ae723e0c17fb76a2fa57f37c058e1c7349d79e8c06c2ca13b
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Nic Scott
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Marshmallow
|
2
|
+
This gem is a collction of macOS specfic facts and actions that may be helpful for macadmins.
|
3
|
+
Tested on macOS 10.12.
|
4
|
+
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
To see a list of availible options for Marshmallow, require 'Marshmallow' in file then type:
|
8
|
+
`puts Marshmallow.methods(false)`
|
9
|
+
|
10
|
+
|
11
|
+
output should be similar to this:
|
12
|
+
***
|
13
|
+
- users
|
14
|
+
- users_number
|
15
|
+
- listoflocaladmins
|
16
|
+
- apps_installed
|
17
|
+
- apps_number
|
18
|
+
- serial
|
19
|
+
- os_version
|
20
|
+
- build
|
21
|
+
- model
|
22
|
+
- model_id
|
23
|
+
- processor_name
|
24
|
+
- processor_speed
|
25
|
+
- processor_number
|
26
|
+
- cores
|
27
|
+
- memory
|
28
|
+
- boot_rom
|
29
|
+
- smc
|
30
|
+
- uuid
|
31
|
+
- graphics
|
32
|
+
- free_space
|
33
|
+
- hd_size
|
34
|
+
- boot_volume
|
35
|
+
- computer_name
|
36
|
+
- sys_launchagents
|
37
|
+
- sys_launchdaemons
|
38
|
+
- ard_info1
|
39
|
+
- ard_info2
|
40
|
+
- ard_info3
|
41
|
+
- ard_info4
|
42
|
+
|
43
|
+
## Examples:
|
44
|
+
|
45
|
+
To print serial number: `puts Marshmallow.serial`
|
46
|
+
|
47
|
+
To print computer name: `puts Marshmallow.computer_name`
|
48
|
+
|
49
|
+
## License
|
50
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
51
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "marshmallow"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/marshmallow.rb
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
#require "marshmallow/version"
|
2
|
+
|
3
|
+
module Marshmallow
|
4
|
+
def self.users
|
5
|
+
users=[]
|
6
|
+
Dir.entries("/Users").each do |username|
|
7
|
+
if !username.start_with?(".")
|
8
|
+
users.push(username)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
users.delete("Guest")
|
12
|
+
users.delete("Shared")
|
13
|
+
return users
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.users_number
|
17
|
+
return Flock.users.length
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.listoflocaladmins
|
21
|
+
listoflocaladmins =`dscacheutil -q group -a name admin`.split(":")
|
22
|
+
listoflocaladmins=listoflocaladmins[4].strip.split(" ")
|
23
|
+
return listoflocaladmins
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.apps_installed
|
27
|
+
apps=[]
|
28
|
+
for x in Dir.entries("/Applications")
|
29
|
+
if !x.start_with?(".")
|
30
|
+
apps.push(x)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
return apps
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.apps_number
|
37
|
+
return Flock.apps_installed.length
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.serial
|
41
|
+
serial = `system_profiler SPHardwareDataType | awk '/Serial/'`.split(":")
|
42
|
+
serial = serial[1].strip!
|
43
|
+
return serial
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.os_version
|
47
|
+
os_version = `sw_vers -productVersion`.chomp
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.build
|
51
|
+
build = `sw_vers -buildVersion`.chomp
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.model
|
55
|
+
model = `system_profiler SPHardwareDataType`.split("\n")
|
56
|
+
model = model[4].split(":")
|
57
|
+
return model[1].strip
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.model_id
|
61
|
+
model = `system_profiler SPHardwareDataType`.split("\n")
|
62
|
+
model = model[5].split(":")
|
63
|
+
return model[1].strip
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.processor_name
|
67
|
+
processor = `system_profiler SPHardwareDataType`.split("\n")
|
68
|
+
processor = processor[6].split(":")
|
69
|
+
return processor[1].strip
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.processor_speed
|
73
|
+
processor = `system_profiler SPHardwareDataType`.split("\n")
|
74
|
+
processor = processor[7].split(":")
|
75
|
+
return processor[1].strip
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.processor_number
|
79
|
+
processor = `system_profiler SPHardwareDataType`.split("\n")
|
80
|
+
processor = processor[8].split(":")
|
81
|
+
return processor[1].strip
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.cores
|
85
|
+
cores = `system_profiler SPHardwareDataType`.split("\n")
|
86
|
+
cores = cores[9].split(":")
|
87
|
+
return cores[1].strip
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.memory
|
91
|
+
memory = `system_profiler SPHardwareDataType`.split("\n")
|
92
|
+
memory = memory[12].split(":")
|
93
|
+
return memory[1].strip
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.boot_rom
|
97
|
+
boot = `system_profiler SPHardwareDataType`.split("\n")
|
98
|
+
boot = boot[13].split(":")
|
99
|
+
return boot[1].strip
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.smc
|
103
|
+
smc = `system_profiler SPHardwareDataType`.split("\n")
|
104
|
+
smc = smc[14].split(":")
|
105
|
+
return smc[1].strip
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.uuid
|
109
|
+
uuid = `system_profiler SPHardwareDataType`.split("\n")
|
110
|
+
uuid = uuid[16].split(":")
|
111
|
+
return uuid[1].strip
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.graphics
|
115
|
+
graphics = `system_profiler SPDisplaysDataType`.split("\n")
|
116
|
+
graphics = graphics[2].split(":")
|
117
|
+
return graphics[0].strip
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.free_space
|
121
|
+
free = `system_profiler SPStorageDataType`.split("\n")
|
122
|
+
free = free[4].split(":")
|
123
|
+
free = free[1].split("(")
|
124
|
+
return free[0].strip
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.hd_size
|
128
|
+
hd = `system_profiler SPStorageDataType`.split("\n")
|
129
|
+
hd = hd[5].split(":")
|
130
|
+
hd = hd[1].split("(")
|
131
|
+
return hd[0].strip
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.boot_volume
|
135
|
+
boot = `system_profiler SPSoftwareDataType`.split("\n")
|
136
|
+
boot = boot[6].split(":")
|
137
|
+
return boot[1].strip
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.computer_name
|
141
|
+
name = `system_profiler SPSoftwareDataType`.split("\n")
|
142
|
+
name = name[8].split(":")
|
143
|
+
return name[1].strip
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.sys_launchagents
|
147
|
+
launchagents=[]
|
148
|
+
for x in Dir.entries("/Library/LaunchAgents")
|
149
|
+
if !x.start_with?(".")
|
150
|
+
launchagents.push(x)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
return launchagents
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.sys_launchdaemons
|
157
|
+
launchdaemons=[]
|
158
|
+
for x in Dir.entries("/Library/LaunchDaemons")
|
159
|
+
if !x.start_with?(".")
|
160
|
+
launchdaemons.push(x)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
return launchdaemons
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.ard_info1
|
167
|
+
if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text1`.chomp.empty?
|
168
|
+
`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text1`.chomp
|
169
|
+
else
|
170
|
+
return "null"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.ard_info2
|
175
|
+
if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text2`.chomp.empty?
|
176
|
+
`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text2`.chomp
|
177
|
+
else
|
178
|
+
return "null"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.ard_info3
|
183
|
+
if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text3`.chomp.empty?
|
184
|
+
`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text3`.chomp
|
185
|
+
else
|
186
|
+
return "null"
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.ard_info4
|
191
|
+
if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text4`.chomp.empty?
|
192
|
+
`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text4`.chomp
|
193
|
+
else
|
194
|
+
return "null"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
|
data/marshmallow.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'marshmallow/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "marshmallow"
|
8
|
+
spec.version = Marshmallow::VERSION
|
9
|
+
spec.authors = ["Nic Scott"]
|
10
|
+
spec.email = ["scottnl@kenyon.edu"]
|
11
|
+
spec.summary = %q{A collection of macOS facts and useful information for MacAdmins}
|
12
|
+
spec.homepage = "https://github.com/nlscott/marshmallow"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
=begin
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
+
"public gem pushes."
|
23
|
+
end
|
24
|
+
=end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: marshmallow
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nic Scott
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- scottnl@kenyon.edu
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .travis.yml
|
64
|
+
- CHANGELOG.md
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/marshmallow.rb
|
72
|
+
- lib/marshmallow/version.rb
|
73
|
+
- marshmallow.gemspec
|
74
|
+
homepage: https://github.com/nlscott/marshmallow
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.0.14.1
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: A collection of macOS facts and useful information for MacAdmins
|
98
|
+
test_files: []
|