dottor 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,4 +3,5 @@ source "http://rubygems.org"
3
3
  group :development do
4
4
  gem "thor"
5
5
  gem "rspec"
6
+ gem "fakefs", :require => "fakefs/safe"
6
7
  end
@@ -2,6 +2,7 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  diff-lcs (1.1.3)
5
+ fakefs (0.4.0)
5
6
  rspec (2.9.0)
6
7
  rspec-core (~> 2.9.0)
7
8
  rspec-expectations (~> 2.9.0)
@@ -16,5 +17,6 @@ PLATFORMS
16
17
  ruby
17
18
 
18
19
  DEPENDENCIES
20
+ fakefs
19
21
  rspec
20
22
  thor
data/README.md CHANGED
@@ -13,7 +13,7 @@ with existing dotfiles repos.
13
13
 
14
14
  With Dottor you can:
15
15
 
16
- 1. Get started with yout current dotfils repo, without changing anything.
16
+ 1. Get started with your current dotfiles repo, without changing anything.
17
17
  2. Specify different profiles, so that you can use it to symlink files in your
18
18
  dev machine as well as in your production boxes.
19
19
 
@@ -32,39 +32,30 @@ can specify a different path) with the following format
32
32
  ```
33
33
 
34
34
  All the actions performed by Dottor are based on the dottor_rules.yml file.
35
+ For some examples, see the [dottor_rules.sample.yml](https://github.com/marcocampana/dottor/blob/master/dottor_rules.sample.yml) file.
35
36
  Check my [dotfiles repo][dotfiles_repo] for a working example.
36
37
 
37
38
 
38
39
  Getting started
39
40
  ---------------
40
41
 
41
- ```
42
42
  gem install dottor
43
- ```
44
43
 
45
44
  ### Create a dottor_rules.yml inside your dotfiles repo
46
45
 
47
- ```
48
46
  dottor init
49
- ```
50
47
 
51
48
  ### Create symlinks based on dottor_rules.yml file in current directory
52
49
 
53
- ```
54
50
  dottor symlink <profile_name>
55
- ```
56
51
 
57
52
  ### Specify a dottor_rules.yml file in another directory
58
53
 
59
- ```
60
54
  dottor symlink <profile_name> -f <custom_path>
61
- ```
62
55
 
63
56
  ### Delete all the symlinks
64
57
 
65
- ```
66
58
  dottor symlink -d
67
- ```
68
59
 
69
60
  Submitting a Pull Request
70
61
  -------------------------
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  module Dottor
2
4
  class Dotfile
3
5
  attr_accessor :source, :target
@@ -33,8 +35,12 @@ module Dottor
33
35
  FileUtils.rm target
34
36
  end
35
37
 
38
+ if !File.exists?(File.dirname(target))
39
+ FileUtils.mkdir_p(File.dirname(target))
40
+ end
41
+
36
42
  $stdout.puts("Create symlink #{File.join(current_path, source)} -> #{target}")
37
- FileUtils.symlink(File.join(current_path, source), target)
43
+ File.symlink(File.join(current_path, source), target)
38
44
  end
39
45
 
40
46
  def delete_symlink
@@ -1,3 +1,3 @@
1
1
  module Dottor
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -19,4 +19,21 @@ describe Dottor::Dotfile do
19
19
  dotfile.target.should eq("/home/stevejobs/.gitconfig")
20
20
  end
21
21
  end
22
+
23
+ describe "#create_symlink", fakefs: true do
24
+ it "should create directories that don't exist in the target location" do
25
+ source = "/tmp/woot/immaconfig"
26
+ target = "/tmp/nodir/immaconfig"
27
+ dotfile = Dottor::Dotfile.new("source" => source, "target" => target)
28
+ FileUtils.mkdir("/tmp")
29
+ FileUtils.mkdir("/tmp/woot")
30
+ File.open(source, "w") do |f|
31
+ f.puts "CONFIG YEAH"
32
+ end
33
+
34
+ File.exists?("/tmp/nodir").should be_false
35
+ dotfile.create_symlink
36
+ File.symlink?(target).should be_true
37
+ end
38
+ end
22
39
  end
@@ -3,12 +3,15 @@ require 'rspec'
3
3
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
4
4
  require 'dottor'
5
5
  require 'helpers/utils'
6
+ require 'fakefs/spec_helpers'
6
7
 
7
8
  RSpec.configure do |c|
8
9
  c.include Utils
9
10
 
10
11
  c.mock_with :rspec
11
12
 
13
+ c.include FakeFS::SpecHelpers, fakefs: true
14
+
12
15
  c.before(:each) do
13
16
  # STDOUT.should_receive(:puts).at_least(1).times.and_return("")
14
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dottor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-10 00:00:00.000000000 Z
12
+ date: 2012-10-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -56,7 +56,6 @@ files:
56
56
  - Gemfile
57
57
  - Gemfile.lock
58
58
  - LICENSE.md
59
- - README
60
59
  - README.md
61
60
  - bin/dottor
62
61
  - dottor.gemspec
data/README DELETED
@@ -1,76 +0,0 @@
1
- Dottor
2
- ======
3
-
4
- Description
5
- -----------
6
- Dottor is an unobtrusive command line tool for easily managing your dotfiles,
7
- without assumptions on how your dotfiles repository should be organized.
8
-
9
- Why Dottor?
10
- -----------
11
- I designed dottor so that it would be easy to setup and use, reliable and work
12
- with existing dotfiles repos.
13
-
14
- With Dottor you can:
15
-
16
- 1. Get started with yout current dotfils repo, without changing anything.
17
- 2. Specify different profiles, so that you can use it to symlink files in your
18
- dev machine as well as in your production boxes.
19
-
20
- How it works?
21
- -------------
22
-
23
- Dottor expect to find in your repo a YAML file named dottor_rules.yml (or you
24
- can specify a different path) with the following format
25
-
26
- ```ruby
27
- profile_name:
28
- - source: <dotffile or directory>
29
- target: <where do you want the file to be symlinked to>
30
- - source: <dotffile or directory>
31
- target: <where do you want the file to be symlinked to>
32
- ```
33
-
34
- All the actions performed by Dottor are based on the dottor_rules.yml file.
35
- For some examples, see the [dottor_rules.sample.yml](https://github.com/marcocampana/dottor/blob/master/dottor_rules.sample.yml) file.
36
- Check my [dotfiles repo][dotfiles_repo] for a working example.
37
-
38
-
39
- Getting started
40
- ---------------
41
-
42
- gem install dottor
43
-
44
- ### Create a dottor_rules.yml inside your dotfiles repo
45
-
46
- dottor init
47
-
48
- ### Create symlinks based on dottor_rules.yml file in current directory
49
-
50
- dottor symlink <profile_name>
51
-
52
- ### Specify a dottor_rules.yml file in another directory
53
-
54
- dottor symlink <profile_name> -f <custom_path>
55
-
56
- ### Delete all the symlinks
57
-
58
- dottor symlink -d
59
-
60
- Submitting a Pull Request
61
- -------------------------
62
-
63
- 1. Fork the project.
64
- 2. Create a topic branch.
65
- 3. Implement your feature or bug fix.
66
- 4. Add documentation for your feature or bug fix.
67
- 6. Add specs for your feature or bug fix.
68
- 8. Commit and push your changes.
69
-
70
- License
71
- -------
72
- Released under the MIT License. See the [LICENSE][license] file for further
73
- details.
74
-
75
- [license]: https://github.com/marcocampana/dottor/blob/master/LICENSE.md
76
- [dotfiles_repo]: https://github.com/marcocampana/dotfiles