nu 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/nu.rb +1 -0
  2. data/lib/nu/cli.rb +23 -39
  3. data/lib/nu/project.rb +30 -0
  4. metadata +5 -4
data/lib/nu.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'nu/cli'
2
2
  require 'nu/loader'
3
3
  require 'nu/config'
4
+ require 'nu/project'
4
5
 
5
6
  #other fancy stuff
@@ -4,53 +4,37 @@ require 'yaml'
4
4
 
5
5
  module Nu
6
6
  class CLI < Thor
7
- include Thor::Actions
7
+ include Thor::Actions
8
8
 
9
-
10
- def initialize(*)
11
- super
12
- @config_file = ".nu/options.yaml"
13
- end
9
+ def initialize(*)
10
+ super
11
+
12
+ @proj = Nu::Project.new
13
+ end
14
14
 
15
15
  desc "install GEMNAME", "installs a gem in the 'pwd'"
16
- method_options :location => :string
16
+ method_options :location => :string
17
17
 
18
- def install(name)
19
- ensure_default_config
18
+ def install(*names)
19
+ @proj.ensure_default_config
20
20
 
21
- loc = get_location
22
- cl = options['location']
23
- loc = cl unless cl.nil?
21
+ loc = @proj.get_location
22
+ cl = options['location']
23
+ loc = cl unless cl.nil?
24
24
 
25
- Nu::Loader.load name, loc
26
- end
27
-
28
- desc "lib FOLDER", "where do you want to store the gems"
29
- def lib(folder)
30
- File.delete @config_file if File.exist? @config_file
31
- add_file @config_file
32
- content = YAML::dump( { 'lib' => folder })
33
- append_file @config_file, content
34
- end
35
-
36
- def self.source_root
37
- File.dirname(__FILE__)
38
- end
39
-
40
- private
41
- def ensure_default_config
42
- if File.exist? @config_file
43
- return
25
+ names.each do |n|
26
+ Nu::Loader.load n, loc
44
27
  end
45
- add_file @config_file
46
- content = YAML::dump( {'lib'=>'lib'} )
47
- append_file @config_file, content
48
- end
28
+ end
29
+
30
+ desc "lib FOLDER", "where do you want to store the gems"
31
+ def lib(folder)
32
+ @proj.set_location folder
33
+ end
49
34
 
50
- def get_location
51
- content = YAML.load_file @config_file
52
- content['lib']
53
- end
35
+ def self.source_root
36
+ File.dirname(__FILE__)
37
+ end
54
38
 
55
39
  end
56
40
  end
@@ -0,0 +1,30 @@
1
+ module Nu
2
+ class Project
3
+
4
+ def initialize
5
+ @config_file = ".nu/options.yaml"
6
+ end
7
+
8
+ def ensure_default_config
9
+ if File.exist? @config_file
10
+ return
11
+ end
12
+ add_file @config_file
13
+ content = YAML::dump( {'lib'=>'lib'} )
14
+ append_file @config_file, content
15
+ end
16
+
17
+ def get_location
18
+ content = YAML.load_file @config_file
19
+ content['lib']
20
+ end
21
+
22
+ def set_location(name)
23
+ File.delete @config_file if File.exist? @config_file
24
+
25
+ content = YAML::dump( { 'lib' => name })
26
+
27
+ File.open(@config_file, 'w') {|f| f.write(content) }
28
+ end
29
+ end
30
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 12
10
- version: 0.1.12
9
+ - 13
10
+ version: 0.1.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dru Sellers
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-07-17 00:00:00 -05:00
20
+ date: 2010-07-18 00:00:00 -05:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -50,6 +50,7 @@ files:
50
50
  - lib/nu/cli.rb
51
51
  - lib/nu/config.rb
52
52
  - lib/nu/loader.rb
53
+ - lib/nu/project.rb
53
54
  - lib/nu.rb
54
55
  has_rdoc: true
55
56
  homepage: http://groups.google.com/group/nu-net