depends-client 0.2.0.beta1 → 0.2.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/depends/cli.rb CHANGED
@@ -48,4 +48,36 @@ command :upload do |c|
48
48
 
49
49
  Depends::Commands::Upload.new.run(options)
50
50
  end
51
+ end
52
+
53
+ command :config do |c|
54
+ c.syntax = 'config'
55
+ c.description = 'Configure the depends client'
56
+ c.option '--key KEY', String, 'The key to use to access the depends server'
57
+ c.option '--server SERVER', String, 'The URL of the depends server'
58
+ c.option '--cache CACHE', String, 'The path to the folder to use for caching dependencies'
59
+ c.option '--overwrite','Overwrite an existing config file'
60
+
61
+ c.action do |args,options|
62
+ config_file = File.expand_path( '~/.depends/config.rb' )
63
+ config_dir = File.dirname(config_file)
64
+
65
+ if File.exists? config_file and not options.overwrite
66
+ say("Your configuration already exists, please specify --overwrite if you wish to overwrite the existing config")
67
+ exit(1)
68
+ end
69
+
70
+ options.key = ask("Depends server key ") unless options.key
71
+
72
+ config_content = ''
73
+ config_content << "api_key '#{options.key}'"
74
+ config_content << "server '#{options.server}" if options.server
75
+ config_content << "cache '#{options.cache}'" if options.cache
76
+
77
+ Dir.mkdir config_dir unless File.directory? config_dir
78
+
79
+ file = File.new(config_file,'w+')
80
+ file.write(config_content)
81
+
82
+ end
51
83
  end
@@ -1,9 +1,18 @@
1
- require 'benchmark'
2
1
  module Depends
3
2
  module Commands
4
3
  class Install
5
4
 
6
5
  def run
6
+
7
+ if RUBY_PLATFORM =~ /mingw32|mswin32/
8
+ begin
9
+ require 'win32/dir'
10
+ rescue LoadError
11
+ color("Failed to require win32/dir, please make sure the gem is installed or in your bundle",:red)
12
+ exit(1)
13
+ end
14
+ end
15
+
7
16
  Depends::Config.load
8
17
  say 'Installing Dependencies...'
9
18
  check_for_file
@@ -7,8 +7,11 @@ module Depends
7
7
  server 'https://depends.aws.af.cm'
8
8
 
9
9
  def self.load(file = '~/.depends/config.rb')
10
- config_file = File.expand_path(file)
11
- Depends::Config.from_file(config_file)
10
+ config_file = File.expand_path(file)
11
+ Depends::Config.from_file(config_file)
12
+ rescue
13
+ color("Failed to load config file, please run 'depend config'", :red)
14
+ exit(1)
12
15
  end
13
16
  end
14
17
  end
@@ -33,7 +33,11 @@ module Depends
33
33
  end
34
34
 
35
35
  def source(source, options = {})
36
- depends_source Depends::Util.depends_source(source)
36
+ color("source is a depreciated dsl option", :yellow)
37
+ end
38
+
39
+ def key(*args)
40
+ color("key is a depreciated dsl option", :yellow)
37
41
  end
38
42
 
39
43
  def to_definition
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depends-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.beta1
4
+ version: 0.2.0.beta2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-21 00:00:00.000000000 Z
13
+ date: 2012-11-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nestful
@@ -151,7 +151,6 @@ extra_rdoc_files: []
151
151
  files:
152
152
  - bin/depend
153
153
  - lib/depends/cli.rb
154
- - lib/depends/commands/configure.rb
155
154
  - lib/depends/commands/install.rb
156
155
  - lib/depends/commands/list.rb
157
156
  - lib/depends/commands/upload.rb
@@ -1,9 +0,0 @@
1
- module Depends
2
- module Commands
3
- class Configure
4
- def run
5
- Depends::Config.load
6
- end
7
- end
8
- end
9
- end