dotman 0.0.3.4 → 0.0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -1
- data/lib/dotman/dotfile_collection.rb +6 -1
- data/lib/dotman/git.rb +7 -2
- data/lib/dotman/version.rb +1 -1
- data/spec/integration/dotfile_collection_integration_spec.rb +8 -1
- data/spec/integration/git_integration_spec.rb +52 -21
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02d61901f1ecaed6d72c8ff3265419cfa6bcd165
|
4
|
+
data.tar.gz: 96bf81094aeecf17c9420cd044b35b8bf7df4e76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ec780a62926699bb739936ef8b07613e1187e1659d988f11b05d029bc67594916ec139930cebfe8403325b13e35b8f144efcf1d6ee0f4631e87ffecb4723e50
|
7
|
+
data.tar.gz: 46c94520482a966d98350f1e5e267d802310c1c90c01f535ae4d4edf839fa3e3b70a863868a8111896c7473f2aa8edcf2ece893fdffc46e46e18d23fcffea3b8
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -26,7 +26,12 @@ DOTFILES_PATH = "#{ENV['HOME']}/.dotman/dotfiles.yml"
|
|
26
26
|
|
27
27
|
def self.find_by_alias(alias_name)
|
28
28
|
ensure_default_dotfile_configuration_exists
|
29
|
-
|
29
|
+
begin
|
30
|
+
found = dotfiles_yaml.fetch(alias_name)
|
31
|
+
new(dotfiles_yaml.fetch(alias_name))
|
32
|
+
rescue KeyError
|
33
|
+
Dotman::Notification.dotfile_collection_not_found(alias_name)
|
34
|
+
end
|
30
35
|
end
|
31
36
|
|
32
37
|
def self.new_configuration(folder_name, alias_name = nil)
|
data/lib/dotman/git.rb
CHANGED
@@ -10,11 +10,16 @@ module Dotman
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.folder_name(git_location)
|
13
|
-
folder_name = git_location.scan(/[^:]+[\/]
|
13
|
+
folder_name = git_location.scan(/[^:]+[\/]{1}[a-zA-Z0-9]+/).first.gsub('/', '_')
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.clone_repository(git_location, alias_name = nil)
|
17
|
-
|
17
|
+
if git_location && !git_location.strip.empty?
|
18
|
+
dotfile_location = "#{ENV['HOME']}/.dotman/#{folder_name(git_location)}"
|
19
|
+
else
|
20
|
+
return Dotman::Notification.unspecified_git_path
|
21
|
+
end
|
22
|
+
|
18
23
|
if (File.directory?(dotfile_location))
|
19
24
|
Dotman::Notification.already_cloned
|
20
25
|
else
|
data/lib/dotman/version.rb
CHANGED
@@ -17,6 +17,13 @@ describe Dotman::DotfileCollection do
|
|
17
17
|
File.directory?(File.join(Dotman::Base.dotman_folder, 'Timbinous_dotfiles')).should be_true
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
context "when dotfile collection is not found" do
|
22
|
+
it "shows the message that the dotfile wasn't found" do
|
23
|
+
Dotman::Notification.should_receive(:dotfile_collection_not_found).with('zach')
|
24
|
+
Dotman::DotfileCollection.find_by_alias('zach')
|
25
|
+
end
|
26
|
+
end
|
20
27
|
end
|
21
28
|
|
22
29
|
describe ".delete" do
|
@@ -55,7 +62,7 @@ describe Dotman::DotfileCollection do
|
|
55
62
|
describe ".show_all_aliases" do
|
56
63
|
context "when aliases exist in the collection" do
|
57
64
|
it "shows all the aliases" do
|
58
|
-
STDOUT.should_receive(:puts).with("
|
65
|
+
STDOUT.should_receive(:puts).with(Dotman::DotfileCollection.all_aliases.join("\n"))
|
59
66
|
Dotman::Notification.display_all_aliases
|
60
67
|
end
|
61
68
|
end
|
@@ -11,39 +11,70 @@ describe Dotman::Git do
|
|
11
11
|
Dotman::Base.ensure_current_dotman_file_exists
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
describe ".clone_repository" do
|
16
15
|
let (:git_dotfile_repo_path) { "git@github.com:Timbinous/dotfiles.git" }
|
17
16
|
let (:git_folder_name) { Dotman::Git.folder_name(git_dotfile_repo_path) }
|
18
17
|
|
19
|
-
context "when
|
18
|
+
context "when the git location is specified" do
|
19
|
+
context "when the git repository has not been cloned yet" do
|
20
|
+
context "when alias was passed" do
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
it "clones to the $HOME/.dotman folder" do
|
23
|
+
expect {
|
24
|
+
Dotman::Git.clone_repository(git_dotfile_repo_path, 'tim') }.
|
25
|
+
to change { File.directory?("#{ENV['HOME']}/.dotman/Timbinous_dotfiles") }.to true
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
it "sets the yaml configuration relating to the alias" do
|
29
|
+
Dotman::DotfileCollection.find_by_alias('tim').should_not be_false
|
30
|
+
end
|
31
|
+
end
|
30
32
|
|
31
|
-
|
33
|
+
context "when no alias passed" do
|
32
34
|
|
33
|
-
|
35
|
+
it "clones to the $HOME/.dotman folder" do
|
36
|
+
expect {
|
37
|
+
Dotman::Git.clone_repository(git_dotfile_repo_path) }.
|
38
|
+
to change { File.directory?("#{ENV['HOME']}/.dotman/Timbinous_dotfiles") }.to true
|
39
|
+
end
|
34
40
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
41
|
+
it "sets the yaml configuration relating to the \"git user name\"_\"repo name\"" do
|
42
|
+
Dotman::DotfileCollection.find_by_alias(git_folder_name).should_not be_false
|
43
|
+
end
|
44
|
+
end
|
39
45
|
end
|
40
46
|
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
context "when the git repository has already been cloned" do
|
48
|
+
before :each do
|
49
|
+
Dotman::Git.clone_repository(git_dotfile_repo_path, 'tim')
|
50
|
+
end
|
44
51
|
|
52
|
+
it "sends a notification that this repository has already been cloned"do
|
53
|
+
Dotman::Notification.should_receive(:already_cloned)
|
54
|
+
Dotman::Git.clone_repository(git_dotfile_repo_path, 'tim')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "when the git location was not specified" do
|
60
|
+
it "sends an error notification to the user" do
|
61
|
+
Dotman::Notification.should_receive(:unspecified_git_path)
|
62
|
+
Dotman::Git.clone_repository(nil)
|
63
|
+
end
|
45
64
|
end
|
46
65
|
end
|
47
|
-
|
48
66
|
|
67
|
+
describe ".folder_name" do
|
68
|
+
context "when containing a dotfiles repository name in github" do
|
69
|
+
it "returns the username_dotfiles as the folder name" do
|
70
|
+
Dotman::Git.folder_name('git@github.com:Timbinous/dotfiles.git').should == "Timbinous_dotfiles"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "when containing a random repository name in github" do
|
75
|
+
it "returns the username_randomrepository as the folder name" do
|
76
|
+
Dotman::Git.folder_name('git@github.com:Timbinous/random.git').should == "Timbinous_random"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
49
80
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
ENV['HOME'] = File.expand_path('../data/home', __FILE__)
|
2
2
|
require 'fakefs/spec_helpers'
|
3
|
-
|
3
|
+
require File.expand_path("../../lib/dotman", __FILE__)
|
4
4
|
|
5
5
|
def create_home_directory
|
6
6
|
FileUtils.mkdir_p(ENV['HOME']) unless File.directory?(ENV['HOME'])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.3.
|
4
|
+
version: 0.0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|