dotme 0.1.4 → 0.1.5

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODMyZTVhMTQ4MGFhMjcxYjdmOWM3NGRiZWJlMDg1NjY3NDAzYzJiNw==
4
+ MmVhZWM0M2EzZDkxNjhjMDJhNGMxZjIwZmMxZTM1Yjk4YWEzMTAzYw==
5
5
  data.tar.gz: !binary |-
6
- NTFiYTFlYWIxYWJiMjE2ZGYyNjU3NTI0NDlkMzMzMWE4N2ZkY2FlZg==
6
+ MjQ1ODMxNmUxMjAyMDY1MTgwZjRlZTEzOWI0MjMxODJjMzZiYzQ4Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDg5OWVjMjZlYzExNTZjOWQyZWMzNjY4MTE0ZjY4NmU3OTczZDBkODBiNjBj
10
- NzdkODhmMGYwMDMyMzZhNjkxYTRhNTdhMDc2NDE0NmZlM2Y2MzJmNDkwNmZi
11
- NTUyZDM1ZDcxNDNlNzdhMmY1YmQ3Mjk0NGM5NjY4NDI2OTViMjI=
9
+ YzJjNjI1ODg2ZDQ3ZDQxNjk3MzliZWI2NDcyODBiNzU0M2NhMDEyOTExYTRh
10
+ NGViZWQyMjczNDVjZDMxNWVkNjMzZWE2ODRiMDUxOGQ3N2M1Y2NhYTg4ZDY2
11
+ YTkwZmQ0ZjNmMmRlODI5MGQ4ZGUxZTQ3YmJhMWI1NTY2M2ExODU=
12
12
  data.tar.gz: !binary |-
13
- MTk2YThjYzBjM2NlZmEyNmQ0NTBiNzBlMWI2NDFkYTdiNjFiMWYxZWI3MjJl
14
- MzhmYWQ5ZTk1ZmYwMzQxMjEwMDRmZWE1YWRmM2I0MzRiYjJiNDQ4NGZlYTQy
15
- MTJhYTEzODEzZmVjMDkxNDRiNzQzOWJlMTkzOTZjNmQ0ODI4MmE=
13
+ MmI4OTgwM2ZmNzc0Y2U2NjQ5MDIxYTBjNWQwZDVlZmQwNGZjZDkzNDBkYjky
14
+ YWU1YzIxNTRmZTFmYzY5YjM2YWUxNmY3ODM0NjQ1ZjlkMGNiNDIwNzU0YjAz
15
+ NmVmNTdiZDE0Mzk0MmFkNTJhODgzZWNlNTM0MzVkYmYzN2MzMDM=
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  DotMe [![Gem Version](https://badge.fury.io/rb/dotme.png)](http://badge.fury.io/rb/dotme)
2
2
  ========================
3
3
 
4
- DotMe is a dot files management system for human beings.
4
+ DotMe is a dot files management system for human beings plus a DSL to perform a computer setup with ease.
5
5
 
6
6
  <http://rubygems.org/gems/dotme>
7
7
 
@@ -19,17 +19,38 @@ And
19
19
  You will be presented with the following output:
20
20
 
21
21
  Usage: dotme ACTION [options]
22
-
22
+
23
23
  Actions:
24
24
  create Create your dot files archive.
25
25
  install Use the Dotfile in current directory to install your dot files, this is the default action.
26
-
26
+ add Append to the dotme archive the specified target.
27
+
27
28
  Options:
28
- -T, --targets TARGETS Files and folders to backup. DEFAULT: .oh-my-zsh, .vimrc, .vim, .zshrc, .bashrc
29
+ -T, --targets TARGETS Files and folders to backup. DEFAULT: .oh-my-zsh, .fonts, .vimrc, .vim, .zshrc, .bashrc
29
30
  -O, --output FOLDER Directory to store your dot files in. DEFAULT: dotfiles
30
31
  -B, --backup FOLDER Backup directory to store existing dot files. DEFAULT: ~/dotfiles.backup
31
32
  -P, --prepend COMMAND Prepend a custom command to the Dotfile, can be use multiple times.
32
33
  -A, --append COMMAND Append a custom command to the Dotfile, can be use multiple times.
34
+ -V, --version Show dotme installed version.
35
+
36
+ Examples
37
+ ---
38
+
39
+ Generate your first dotme archive with defaults files and folder ( .oh-my-zsh, .vimrc, .vim, .zshrc, .bashrc ).
40
+
41
+ # dotme create
42
+
43
+ Or with custom comma separated targets.
44
+
45
+ # dotme create --targets ".bash_profile, .whatever, Desktop/MyFolder"
46
+
47
+ Once you have your dotfiles archive, add some new entry to it.
48
+
49
+ # dotme add "Library/Application Support/Sublime Text 2"
50
+
51
+ Want to setup a new computer or a new OS installation?
52
+
53
+ # cd dotfiles && dotme
33
54
 
34
55
  License
35
56
  ---
data/bin/dotme CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'dotme/commander'
3
3
 
4
- DotMe::Commander.dispatch!(ARGV)
4
+ DotMe::Commander.dispatch!
@@ -0,0 +1,47 @@
1
+ require 'fileutils'
2
+ require 'dotme/incubator'
3
+ require 'dotme/loader'
4
+
5
+ if !$options[:add]
6
+ puts "No target specified, please invoke 'dotme add <file-or-folder>'."
7
+ exit
8
+ elsif !::File.exist? $options[:output]
9
+ puts "Folder '#{$options[:output]}' does not exist, aborting."
10
+ exit
11
+ end
12
+
13
+ DotMe::Loader.load!
14
+
15
+ begin
16
+ DotMe::Incubator.incubate $options[:add], $options[:output]
17
+ rescue DotMe::NoIncubator
18
+ puts "No suitable incubator for #{item}, skipping ..."
19
+ end
20
+
21
+ dotfile = []
22
+ File.open( "#{$options[:output]}/Dotfile", 'r' ).each_line do |line|
23
+ dotfile << line.chop
24
+ end
25
+
26
+ # search backwards for first not user prepended line
27
+ lineno = dotfile.count
28
+ dotfile.reverse_each do |line|
29
+ break unless line.match '^sh\s.+$'
30
+ lineno -= 1
31
+ end
32
+ # insert new data from there
33
+ DotMe::Incubator.cells.each do |cell|
34
+ op, to, what, where = cell.keys + cell.values
35
+ dotfile.insert lineno, "#{op} \"#{what}\", \"#{where}\""
36
+ lineno += 1
37
+ end
38
+
39
+ File.open( "#{$options[:output]}/Dotfile", 'w+t' ){ |file| file << dotfile.join( "\n" ) }
40
+
41
+ File.open( "#{$options[:output]}/README.md", 'a+t' ) do |readme|
42
+ readme << <<README
43
+ ### Updated on #{Time.now}
44
+
45
+ dotme add "#{$options[:add]}"
46
+ README
47
+ end
@@ -1,14 +1,16 @@
1
1
  require 'optparse'
2
+ require 'dotme/version'
2
3
 
3
4
  module DotMe
4
5
  class Commander
5
- def self.dispatch!(argv)
6
+ def self.dispatch!
6
7
  # make this global to let load-ed actions use it
7
8
  $options = {
8
9
  :cmdline => ARGV.join(' '),
9
- :action => argv[0] || 'install',
10
+ :action => ARGV[0] || 'install',
10
11
  :verbose => true,
11
12
  :targets => [ '.oh-my-zsh', '.fonts', '.vimrc', '.vim', '.zshrc', '.bashrc' ],
13
+ :add => ARGV[1] || nil,
12
14
  :output => 'dotfiles',
13
15
  :backup => '~/dotfiles.backup',
14
16
  :prepend => [],
@@ -22,11 +24,12 @@ Usage: dotme ACTION [options]
22
24
  Actions:
23
25
  create Create your dot files archive.
24
26
  install Use the Dotfile in current directory to install your dot files, this is the default action.
27
+ add Append to the dotme archive the specified target.
25
28
 
26
29
  Options:
27
30
  HELP
28
31
  opts.on( '-T', '--targets TARGETS', "Files and folders to backup. DEFAULT: #{$options[:targets].join(', ')}" ) do |targets|
29
- $options[:targets] = targets.split ' '
32
+ $options[:targets] = targets.split(',').map { |t| t.strip }
30
33
  end
31
34
 
32
35
  opts.on( '-O', '--output FOLDER', "Directory to store your dot files in. DEFAULT: #{$options[:output]}" ) do |folder|
@@ -45,6 +48,11 @@ HELP
45
48
  $options[:append] << command
46
49
  end
47
50
 
51
+ opts.on( '-V', '--version', "Show dotme installed version." ) do |version|
52
+ puts "dotme v#{DotMe::VERSION}"
53
+ exit
54
+ end
55
+
48
56
  end.parse!
49
57
 
50
58
  begin
@@ -1,3 +1,3 @@
1
1
  module DotMe
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Margaritelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-21 00:00:00.000000000 Z
11
+ date: 2013-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem to handle dot files easily.
14
14
  email: evilsocket@gmail.com
@@ -17,6 +17,7 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - lib/dotme/actions/add.rb
20
21
  - lib/dotme/actions/create.rb
21
22
  - lib/dotme/actions/install.rb
22
23
  - lib/dotme/commander.rb