macadmin 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1103e52f907edbf5e1f175278e7eaecb7f5be21
4
- data.tar.gz: db158590675a6499a351b7ca06c77d0d60078ff8
3
+ metadata.gz: 7a48ae5d56edef9dd6c136441321eef6b4907f78
4
+ data.tar.gz: c925b3370dfa6287eebd8f37525beec9657dfe5b
5
5
  SHA512:
6
- metadata.gz: 898ced3234ca7f09c0271bab0ebcce352c02a01c015349aabcf815a5463b82833e4dd7a94c1e5475b2a65f3f06fc1d937b02a96463df4eae30e46e9a144d7b14
7
- data.tar.gz: c3e4d8b825d5ec08a684edf1a59c5f40a107b8cb3bcc8bf5567729249bc436e82c064e7c16704de8dd6d84cadcb7caf835e043b43ad35f7ab0ed285ca22bbbf5
6
+ metadata.gz: fe05741aef8121c7abd66e733fa6036af77b72cfd5d3b17180a295c6de5438f699bedc175af0713994d503c3fc8a1fa35c2bcaf6b93a28e9a9ba913a351d8f53
7
+ data.tar.gz: 71ffede8618654c50957542dff7e740018edb2af7a25fdb265a932ec5e6a1078f45b225db759cc7eaab378464290d18ea50efa2cffd1f72eb6f316d77a32b06b
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ vendor
19
+ .DS_Store
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
+ [![Gem Version](https://badge.fury.io/rb/macadmin.png)](http://badge.fury.io/rb/macadmin) [![Code Climate](https://codeclimate.com/github/dayglojesus/macadmin.png)](https://codeclimate.com/github/dayglojesus/macadmin)
2
+
1
3
  # MacAdmin
2
4
 
3
5
  Gem to assist in performing common systems administration tasks in OS X
4
6
 
5
- ## Version: 0.0.4
6
-
7
7
  ## About
8
8
 
9
9
  MacAdmin endeavors to provide an OO programming interface for constituent OS X system resources. It's comprised of classes with the ability to parse Apple Property Lists (CFPropertyList) and manipulate them as native Ruby objects. The classes work directly with the Property Lists used to abstract OS X system resources -- users, groups, computers, computergroups, etc. -- bypassing the common utilities and APIs normally reserved for this kind of work.
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
  require "macadmin/common"
4
+ require "macadmin/version"
4
5
 
5
6
  # Only build the extension for Mountian Lion or better
6
7
  if MacAdmin::Common::MAC_OS_X_PRODUCT_VERSION > 10.7
@@ -20,4 +21,55 @@ end
20
21
  RSpec::Core::RakeTask.new
21
22
 
22
23
  task :default => :spec
23
- task :test => :spec
24
+ task :test => :spec
25
+
26
+ # macadmin tasks
27
+ namespace :macadmin do
28
+
29
+ desc "Publish the macadmin gem"
30
+ task :publish => [:fix_perms, :release]
31
+
32
+ desc "Fix permissions on Gem"
33
+ task :fix_perms do
34
+ require 'find'
35
+ Find.find(File.expand_path("./")) do |path|
36
+ FileUtils.chmod(0755, path) if FileTest.directory?(path)
37
+ FileUtils.chmod(0644, path) if FileTest.file?(path)
38
+ end
39
+ end
40
+
41
+ desc "Cleans out any elements of the gem build compile process"
42
+ task :clean do
43
+ require 'fileutils'
44
+ files = ["./lib/macadmin/password", "./tmp", "./pkg", "./vendor"]
45
+ files.each do |obj|
46
+ FileUtils.rm_rf(File.expand_path(obj))
47
+ end
48
+ end
49
+
50
+ # Version handling tasks
51
+ desc "Bump the patch version number"
52
+ task :bump_version_patch do
53
+ MacAdmin::VERSION.bump_patch
54
+ MacAdmin::VERSION.save
55
+ `git add ./version.yaml`
56
+ `git commit -m "bump patch version, #{MacAdmin::VERSION.to_s}"`
57
+ end
58
+
59
+ desc "Bump the minor version number"
60
+ task :bump_version_minor do
61
+ MacAdmin::VERSION.bump_minor
62
+ MacAdmin::VERSION.save
63
+ `git add ./version.yaml`
64
+ `git commit -m "bump minor version, #{MacAdmin::VERSION.to_s}"`
65
+ end
66
+
67
+ desc "Bump the major version number"
68
+ task :bump_version_major do
69
+ MacAdmin::VERSION.bump_major
70
+ MacAdmin::VERSION.save
71
+ `git add ./version.yaml`
72
+ `git commit -m "bump major version, #{MacAdmin::VERSION.to_s}"`
73
+ end
74
+
75
+ end
@@ -1,8 +1,58 @@
1
1
  module MacAdmin
2
- VERSION = '0.0.4'
3
2
 
3
+ # Version
4
+ # - Class for working with the version number
5
+ class Version
6
+
7
+ require 'yaml'
8
+
9
+ FILE = File.expand_path('version.yaml')
10
+
11
+ attr_accessor :major, :minor, :patch
12
+
13
+ # Create from String
14
+ # - ie. "0.0.1"
15
+ def self.init_with_string(version)
16
+ @major, @minor, @patch = version.split(".").each(&:to_i)
17
+ end
18
+
19
+ # Init from a YAML file
20
+ def self.load_yaml_file(file = FILE)
21
+ YAML.load_file FILE
22
+ end
23
+
24
+ # Returns a version String
25
+ def to_s
26
+ "#{@major}.#{@minor}.#{@patch}"
27
+ end
28
+
29
+ # Increment the major version number
30
+ def bump_major
31
+ @major += 1
32
+ end
33
+
34
+ # Increment the minor version number
35
+ def bump_minor
36
+ @minor += 1
37
+ end
38
+
39
+ # Increment the patch version number
40
+ def bump_patch
41
+ @patch += 1
42
+ end
43
+
44
+ # Serialize the object to YAML file
45
+ def save(file = FILE)
46
+ File.open(file, 'w') { |f| f.write self.to_yaml }
47
+ end
48
+
49
+ end
50
+
51
+ VERSION = Version.load_yaml_file
52
+
53
+ # Return a formatted string containing the Gem's name and version
4
54
  def self.version_string
5
- "macadmin version, #{MacAdmin::VERSION}"
55
+ "macadmin version, #{MacAdmin::VERSION.to_s}"
6
56
  end
7
57
 
8
58
  end
data/macadmin.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'macadmin/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "macadmin"
8
- s.version = MacAdmin::VERSION
8
+ s.version = MacAdmin::VERSION.to_s
9
9
  s.date = '2012-07-08'
10
10
  s.authors = ["Brian Warsing"]
11
11
  s.email = ['dayglojesus@gmail.com']
data/version.yaml ADDED
@@ -0,0 +1,4 @@
1
+ --- !ruby/object:MacAdmin::Version
2
+ major: 0
3
+ minor: 0
4
+ patch: 5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Warsing
@@ -178,6 +178,7 @@ files:
178
178
  - spec/shadowhash_spec.rb
179
179
  - spec/spec_helper.rb
180
180
  - spec/user_spec.rb
181
+ - version.yaml
181
182
  homepage: http://github.com/dayglojesus/macadmin
182
183
  licenses:
183
184
  - MIT