capo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/capo ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/ruby
2
+ require 'optparse'
3
+ require 'capo'
4
+
5
+ options = {}
6
+
7
+ option_parser = OptionParser.new do |option|
8
+ option.banner = 'Usage: capo COMMAND [OPTIONS]'
9
+ option.separator ''
10
+ option.separator 'Commands'
11
+ option.separator ' init: Clones and pulls the repository that contains the recipes'
12
+ option.separator ''
13
+ option.separator 'Options'
14
+
15
+ option.on('-h', '--help', 'help') do
16
+ @help = true
17
+ puts option_parser
18
+ end
19
+ end
20
+
21
+ option_parser.parse!
22
+
23
+ case ARGV[0]
24
+ when 'init'
25
+ Capo::Init.fetch_repository
26
+ else
27
+ puts option_parser unless @help
28
+ end
data/capo.gemspec CHANGED
@@ -16,4 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ['lib']
19
+
20
+ gem.add_dependency 'git'
19
21
  end
data/lib/capo/init.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'git'
2
+
3
+ module Capo
4
+ module Init
5
+ class << self
6
+ def fetch_repository
7
+ repository_path = File.expand_path '~/.capo'
8
+ repository_url = 'git://github.com/capoio/capo.git'
9
+
10
+ puts "Pulling changes from remote repository"
11
+ begin
12
+ repo = Git.open repository_path
13
+ puts repo.lib.send :command, 'pull' # repo.pull is broken in git-1.2.5, see: https://github.com/schacon/ruby-git/issues/32
14
+ rescue
15
+ puts "Reposito doesn't seem to exist yet..."
16
+ puts "Cloning repository from #{repository_url} to #{repository_path}"
17
+ Git.clone repository_url, repository_path
18
+ retry
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
data/lib/capo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Capo
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/capo.rb CHANGED
@@ -1,5 +1,9 @@
1
+ # $LOAD_PATH << File.dirname(__FILE__)
2
+
1
3
  require 'capo/version'
2
4
 
5
+ require 'capo/init'
6
+
3
7
  module Capo
4
8
  # Your code goes here...
5
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,11 +13,28 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
  date: 2012-10-14 00:00:00.000000000 Z
16
- dependencies: []
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: git
19
+ requirement: !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
17
33
  description: Command line utility to fetch and manage recipes
18
34
  email:
19
35
  - mail@capo.io
20
- executables: []
36
+ executables:
37
+ - capo
21
38
  extensions: []
22
39
  extra_rdoc_files: []
23
40
  files:
@@ -26,8 +43,10 @@ files:
26
43
  - LICENSE.txt
27
44
  - README.md
28
45
  - Rakefile
46
+ - bin/capo
29
47
  - capo.gemspec
30
48
  - lib/capo.rb
49
+ - lib/capo/init.rb
31
50
  - lib/capo/version.rb
32
51
  homepage: http://capo.io
33
52
  licenses: []