dotfu 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfd33a64430a135ebb5e9d655946cc5075c3e857
4
- data.tar.gz: 8b5ea0b776586d28228074c837cfc2bf0694b050
3
+ metadata.gz: 9ed0e8ea77f9d7aee9b7cee356605c2cccade658
4
+ data.tar.gz: 78416629973e69872bfe0f60a055b9619ef17a90
5
5
  SHA512:
6
- metadata.gz: 7bd34205b448adfc2293bf0d3eb7e924f0868e32b62049b1ac98caca400f19b593c4ed8e411ad6efea90beb58a511dd19461577961a8261f8132d8fc00b668af
7
- data.tar.gz: d69cccac6a0472eb8d6bf1e20a65ccdb1f6055381c2d435dc1037bd73370e044536e4da9c9b6f8344a837af17ab301cd36792283d6a6e5910e45767e4518ecca
6
+ metadata.gz: cabfbe695f9754bb16a36c93e1a7cc5a082455c03490ae3d2878712bf90a9f7e72fe25b3fde609620cea3a5172fdf3d5252533da68eb5940e13dd8d198b1e8ef
7
+ data.tar.gz: 9078d91a95e8dc1b011a7541225292d49e429fe961a9edbec80bd66e4d661df0d42726a5586f39dadc35bd416d4427698062ef1fd3644d329612ee8a648035c4
data/CHANGELOG.md CHANGED
@@ -0,0 +1,4 @@
1
+ # 0.1.1
2
+ * Switched from calling git myself to using the one on rubygems. Has issues, but less.
3
+ * Fixed branch logic.
4
+ * Fixed the eval logic to find the proper directory commands are in.
data/bin/dotfu CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  require 'dotfu'
4
4
  require 'yaml'
5
-
6
-
7
5
  require 'slop'
6
+ require 'git'
8
7
 
9
8
  if !Dotfu.installed?
10
9
  puts "Git does not appear to be installed, aporting."
@@ -13,16 +12,16 @@ end
13
12
 
14
13
  opts = Slop.parse(help:true) do
15
14
  banner "Dotfu:\n"\
16
- "DOTFILES is a string that can be user:repo or user@repo. If no user is "\
17
- "provided, it will attempt to look one up from the git config file.\n"
15
+ "Simple usage: dotfu install user@repo:branch\n"\
16
+ "User/branch are optional in all contexts. Check http://github.com/erniebrodeur for more details."
18
17
 
19
18
  on(:v, :verbose, 'Enable verbose mode')
20
19
  on(:version, 'Print the version') {puts "Version #{Dotfu::VERSION}" }
21
20
  on(:data_directory, "Root directory to fetch into (default: #{Bini.data_dir}/repos)")
22
21
  on(:target_directory, "Change the default target directory from your home: #{Dir.home}")
23
22
 
24
- # not sure that this is the right dir after install. Need to determine that.
25
- Dir.glob("commands/*.rb").each do |file|
23
+
24
+ Dotfu.commands.each do |file|
26
25
  instance_eval open(file).read
27
26
  end
28
27
 
data/commands/install.rb CHANGED
@@ -11,7 +11,7 @@ command 'install' do
11
11
  repo = Dotfu::Repos.new target
12
12
 
13
13
  puts "Fetching repo #{target}"
14
- puts repo.fetch[:out]
14
+ puts repo.fetch
15
15
  puts "Installing #{target} to #{repo.target_dir}"
16
16
  repo.install
17
17
  end
data/lib/dotfu/repos.rb CHANGED
@@ -44,7 +44,9 @@ module Dotfu
44
44
  # initial clone
45
45
  def clone
46
46
  return nil if !repo || !user
47
- return git_cmd "clone git://github.com/#{user}/#{repo}.git #{working_dir}", false
47
+ uri = "git://github.com/#{user}/#{repo}.git"
48
+ FileUtils.mkdir_p working_dir
49
+ return true if Git.clone(uri, repo, path:"#{Bini.data_dir}/repos/#{user}" )
48
50
  end
49
51
 
50
52
  # A wrapper method to clone or update a repo.
@@ -59,9 +61,11 @@ module Dotfu
59
61
 
60
62
 
61
63
  def install
62
- result = git_cmd "checkout #{branch}" if branch
64
+ r = Git.init working_dir
63
65
 
64
- raise RuntimeError.new result unless result[:status].success?
66
+ result = r.checkout(@branch ? branch : "master")
67
+
68
+ raise RuntimeError.new result unless result
65
69
 
66
70
  # lets check if we have anything in the way, and abort instead of partially
67
71
  # installing
@@ -78,7 +82,10 @@ module Dotfu
78
82
 
79
83
  def pull
80
84
  return nil if !repo || !user
81
- return git_cmd "pull"
85
+ r = Git.init working_dir
86
+ #TODO: I'm confident that the implicit decleration of first here is going
87
+ # to muck something up for someone. Find a way to do this explicitly.
88
+ return r.remote.merge
82
89
  end
83
90
 
84
91
  def uninstall
@@ -182,18 +189,5 @@ module Dotfu
182
189
  def file_string(file)
183
190
  return file.class == Fixnum ? files[file] : file
184
191
  end
185
- def git_cmd(cmd, cd = true)
186
- if cd
187
- pwd = Dir.pwd
188
- Dir.chdir working_dir
189
- end
190
-
191
- out, err, status = Open3.capture3 "git #{cmd}"
192
-
193
- Dir.chdir pwd if cd
194
-
195
- return {status:status, out:out, err:err}
196
- end
197
-
198
192
  end
199
193
  end
data/lib/dotfu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dotfu
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/dotfu.rb CHANGED
@@ -40,6 +40,10 @@ module Dotfu
40
40
  return @git_installed
41
41
  end
42
42
 
43
+ def commands
44
+ spec = Gem::Specification.find_by_name("dotfu")
45
+ return Dir["#{spec.full_gem_path}/commands/*"]
46
+ end
43
47
  Bini.long_name = "dotfu"
44
48
  GITHUB ||= Github.new user_agent:"Dotfu: #{Dotfu::VERSION}", auto_pagination:true
45
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotfu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernie Brodeur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-31 00:00:00.000000000 Z
11
+ date: 2013-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bini
@@ -95,7 +95,7 @@ files:
95
95
  - CHANGELOG.md
96
96
  - Gemfile
97
97
  - Guardfile
98
- - LICENSE.txt
98
+ - LICENSE.md
99
99
  - README.md
100
100
  - Rakefile
101
101
  - bin/dotfu
@@ -109,7 +109,6 @@ files:
109
109
  - lib/dotfu/config_parser.rb
110
110
  - lib/dotfu/repos.rb
111
111
  - lib/dotfu/version.rb
112
- - roadmap.md
113
112
  - spec/cli_spec_helper.rb
114
113
  - spec/dotfu_spec.rb
115
114
  - spec/spec_helper.rb
data/roadmap.md DELETED
@@ -1,3 +0,0 @@
1
- ## 0.1.0
2
-
3
- *
File without changes