myosx 0.2.2 → 0.2.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +6 -3
- data/lib/myosx/config.rb +11 -12
- data/lib/myosx/dotfiles.rb +19 -15
- data/lib/myosx/homebrew.rb +2 -2
- data/lib/myosx/rbenv.rb +1 -1
- data/lib/myosx/version.rb +1 -1
- data/lib/myosx.rb +4 -4
- data/myosx.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5452e9a2e38902cd1a893f6ede7202e367bf2baf
|
4
|
+
data.tar.gz: 725ffe4995b8f4e21a0295bfaff50865214febd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a2c76eece56bdfe1418e2f5afd498026bdc440593f57866d68df9ba9858c1a0c1e5be155bfa0d4ea4bdc2c5082ffc2d09380ccf3f1443744947e4b54e9361fd
|
7
|
+
data.tar.gz: c6a8f2ce2c54427a85fe2cb76d86fb047e837821ea2787af45a2ef9cd69b21ec3b6ad970b8adbd5b8c86ba50c65712ae6537c88408e6f858ab7ba69a75a48d2a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
|
1
|
+
[](https://travis-ci.org/surminus/myosx)
|
2
|
+
|
3
|
+
# MyOSX
|
4
|
+
|
5
|
+
MyOSX configures OSX how I like it
|
2
6
|
|
3
|
-
myosx configures osx how I like it.
|
4
7
|
|
5
8
|
## Setup
|
6
9
|
|
@@ -28,7 +31,7 @@ Use the example config file to set some things (`example.myosx.cnf`)
|
|
28
31
|
`MYOSX_WORKSPACE`
|
29
32
|
|
30
33
|
This is where everything is stored such as Brewfiles and any other repositories
|
31
|
-
that it may pull. Default is
|
34
|
+
that it may pull. Default is `~/.myosx`
|
32
35
|
|
33
36
|
|
34
37
|
## Contributing
|
data/lib/myosx/config.rb
CHANGED
@@ -5,23 +5,22 @@ require 'yaml'
|
|
5
5
|
require 'git'
|
6
6
|
|
7
7
|
class Config
|
8
|
-
def
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
def config_file
|
9
|
+
ENV["MYOSX_CONFIG"] || File.expand_path('~/.myosx.cnf')
|
10
|
+
end
|
11
|
+
|
12
|
+
def global
|
13
|
+
YAML.load_file(config_file)
|
14
14
|
end
|
15
15
|
|
16
16
|
def workspace_directory
|
17
|
-
|
18
|
-
return File.expand_path(workspace_dir_name)
|
17
|
+
ENV['MYOSX_WORKSPACE'] || File.expand_path('~/.myosx/')
|
19
18
|
end
|
20
19
|
|
21
|
-
def create_workspace
|
22
|
-
unless Dir.exists?(
|
23
|
-
puts "Creating workspace: #{
|
24
|
-
Dir.mkdir("#{
|
20
|
+
def create_workspace(directory)
|
21
|
+
unless Dir.exists?(directory)
|
22
|
+
puts "Creating workspace: #{directory}"
|
23
|
+
Dir.mkdir("#{directory}", 0750)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
data/lib/myosx/dotfiles.rb
CHANGED
@@ -8,20 +8,20 @@ require_relative 'config'
|
|
8
8
|
|
9
9
|
class Dotfiles < Config
|
10
10
|
def config
|
11
|
-
|
11
|
+
Config.new.global['dotfiles']
|
12
12
|
end
|
13
13
|
|
14
14
|
def dotfiledir
|
15
|
-
File.join(
|
15
|
+
File.join(Config.new.workspace_directory, 'dotfiles')
|
16
16
|
end
|
17
17
|
|
18
|
-
def repo(repo)
|
18
|
+
def repo(repo, target, local_repo = 'dotfiles')
|
19
19
|
if Git.ls_remote(repo)
|
20
|
-
unless File.exist?(
|
21
|
-
puts "Cloning #{
|
22
|
-
Git.clone(repo,
|
20
|
+
unless File.exist?(target)
|
21
|
+
puts "Cloning #{repo}"
|
22
|
+
Git.clone(repo, local_repo, :path => File.dirname(target))
|
23
23
|
else
|
24
|
-
g = Git.init(
|
24
|
+
g = Git.init(target)
|
25
25
|
puts "Pulling latest #{repo}"
|
26
26
|
g.pull
|
27
27
|
end
|
@@ -29,23 +29,27 @@ class Dotfiles < Config
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def link(file, dest)
|
32
|
-
source_file = "#{dotfiledir}/#{file}"
|
33
|
-
|
34
32
|
dest = File.expand_path(dest)
|
35
|
-
raise "#{
|
33
|
+
raise "#{file} doesn't exist! Check your config or repo" unless File.exist?(file)
|
36
34
|
|
37
35
|
if File.exist?(dest)
|
36
|
+
backup_file = "#{dest}.#{Date.today.to_s}"
|
37
|
+
puts "Creating backup of #{dest} called: #{backup_file}"
|
38
|
+
File.rename(dest, backup_file)
|
39
|
+
end
|
40
|
+
|
41
|
+
if File.symlink?(dest)
|
38
42
|
File.delete(dest)
|
39
43
|
end
|
40
44
|
|
41
|
-
puts "Linking #{
|
42
|
-
File.symlink(
|
45
|
+
puts "Linking #{file} to #{dest}"
|
46
|
+
File.symlink(file, dest)
|
43
47
|
end
|
44
48
|
|
45
49
|
def exec
|
46
|
-
if repo(config['repo'])
|
47
|
-
config['files'].each do |
|
48
|
-
link(
|
50
|
+
if repo(config['repo'], dotfiledir)
|
51
|
+
config['files'].each do |file, dest|
|
52
|
+
link("#{dotfiledir}/#{file}", dest)
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
data/lib/myosx/homebrew.rb
CHANGED
@@ -9,7 +9,7 @@ require_relative 'config'
|
|
9
9
|
class Homebrew < Config
|
10
10
|
|
11
11
|
def config
|
12
|
-
|
12
|
+
Config.new.global['homebrew']
|
13
13
|
end
|
14
14
|
|
15
15
|
def packages
|
@@ -17,7 +17,7 @@ class Homebrew < Config
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def brewfile
|
20
|
-
return File.join(
|
20
|
+
return File.join(Config.new.workspace_directory, 'Brewfile')
|
21
21
|
end
|
22
22
|
|
23
23
|
def brewfile_out(packages)
|
data/lib/myosx/rbenv.rb
CHANGED
data/lib/myosx/version.rb
CHANGED
data/lib/myosx.rb
CHANGED
@@ -7,17 +7,17 @@ require "myosx/rbenv"
|
|
7
7
|
module Myosx
|
8
8
|
class Exec < Config
|
9
9
|
def initialize
|
10
|
-
Config.new.create_workspace
|
10
|
+
Config.new.create_workspace(Config.new.workspace_directory)
|
11
11
|
|
12
|
-
if
|
12
|
+
if Config.new.global['dotfiles']
|
13
13
|
Dotfiles.new.exec
|
14
14
|
end
|
15
15
|
|
16
|
-
if
|
16
|
+
if Config.new.global['homebrew']
|
17
17
|
Homebrew.new.exec
|
18
18
|
end
|
19
19
|
|
20
|
-
if
|
20
|
+
if Config.new.global['rbenv']
|
21
21
|
Rbenv.new.exec
|
22
22
|
end
|
23
23
|
end
|
data/myosx.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["surminus@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{myosx configures OSX how I like it}
|
13
|
-
spec.homepage = "https://github.com/surminus/myosx
|
13
|
+
spec.homepage = "https://github.com/surminus/myosx"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myosx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laura Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -95,7 +95,7 @@ files:
|
|
95
95
|
- lib/myosx/shell.rb
|
96
96
|
- lib/myosx/version.rb
|
97
97
|
- myosx.gemspec
|
98
|
-
homepage: https://github.com/surminus/myosx
|
98
|
+
homepage: https://github.com/surminus/myosx
|
99
99
|
licenses:
|
100
100
|
- MIT
|
101
101
|
metadata: {}
|