dotfiles 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dot_files.rb +1 -1
- data/lib/dot_files/command.rb +0 -1
- data/lib/dot_files/commands/files.rb +23 -0
- data/lib/dot_files/commands/setup.rb +7 -2
- metadata +4 -4
data/lib/dot_files.rb
CHANGED
data/lib/dot_files/command.rb
CHANGED
@@ -64,6 +64,7 @@ end
|
|
64
64
|
desc 'Add a new (or overwrite an existing) file'
|
65
65
|
usage 'add path/to/dotfile'
|
66
66
|
command :add do |path|
|
67
|
+
require_setup
|
67
68
|
filename = path.gsub(/\A#{ENV['HOME']}\//, '')
|
68
69
|
local_path = File.join(ENV['HOME'], filename)
|
69
70
|
contents = File.read(local_path)
|
@@ -76,6 +77,7 @@ end
|
|
76
77
|
desc 'Pull a remote file to your local file system'
|
77
78
|
usage 'pull path/to/dotfile'
|
78
79
|
command :pull do |path|
|
80
|
+
require_setup
|
79
81
|
filename = path.gsub(/\A#{ENV['HOME']}\//, '')
|
80
82
|
if contents = remote_file_contents(filename)
|
81
83
|
save_local_file(filename, contents)
|
@@ -84,3 +86,24 @@ command :pull do |path|
|
|
84
86
|
error "Couldn't download remote file from '#{filename}'. Does it exist?"
|
85
87
|
end
|
86
88
|
end
|
89
|
+
|
90
|
+
desc 'Pull all remote files'
|
91
|
+
usage 'fetch'
|
92
|
+
command :fetch do
|
93
|
+
require_setup
|
94
|
+
require 'highline/import'
|
95
|
+
HighLine.track_eof = false
|
96
|
+
|
97
|
+
for name, remote_sha in get_remote_files
|
98
|
+
if File.exist?(File.join(ENV['HOME'], name))
|
99
|
+
o = ask("#{name} exists. Do you wish to overwrite? [Y/n]")
|
100
|
+
if o.to_s[0,1].upcase == 'N'
|
101
|
+
next
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
contents = remote_file_contents(name)
|
106
|
+
save_local_file(name, contents)
|
107
|
+
puts "saved #{name} (#{contents.size} bytes)"
|
108
|
+
end
|
109
|
+
end
|
@@ -4,7 +4,6 @@ command :setup do
|
|
4
4
|
|
5
5
|
require 'highline/import'
|
6
6
|
HighLine.track_eof = false
|
7
|
-
|
8
7
|
|
9
8
|
puts "Welcome to MyDotFiles."
|
10
9
|
puts
|
@@ -25,8 +24,14 @@ command :setup do
|
|
25
24
|
DotFiles.config.username = username
|
26
25
|
DotFiles.config.api_key = api_key
|
27
26
|
DotFiles.config.save
|
28
|
-
puts "\e[32mThis computer has now been authorised
|
27
|
+
puts "\e[32mThis computer has now been authorised.\e[0m"
|
28
|
+
puts
|
29
|
+
puts "We suggest you now run {{dotfiles fetch}} to download all your existing dotfiles. After this point,"
|
30
|
+
puts "you will be able to run {{dotfiles sync}} to keep them in sync."
|
31
|
+
puts
|
29
32
|
else
|
30
33
|
error "Your account could not be authorised. Please check your email address & password."
|
31
34
|
end
|
35
|
+
|
36
|
+
|
32
37
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotfiles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Cooke
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-08 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|