nu 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/nu +6 -0
  2. data/lib/cli.rb +67 -0
  3. data/lib/loader.rb +22 -0
  4. metadata +74 -0
data/bin/nu ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path('../../lib/cli', __FILE__)
4
+ require File.expand_path('../../lib/loader', __FILE__)
5
+
6
+ Nu::CLI.start
data/lib/cli.rb ADDED
@@ -0,0 +1,67 @@
1
+ require 'FileUtils'
2
+
3
+ module Nu
4
+ class CLI
5
+
6
+ def self.start
7
+
8
+ #improve the crap out of this
9
+ action = ARGV[0]
10
+ @gem_to_copy = ARGV[1]
11
+
12
+
13
+ l = Nu::Loader.new
14
+ if !l.available? @gem_to_copy
15
+ puts "Gem unavailable - please install it"
16
+ return
17
+ else
18
+ puts "Found Gem"
19
+ end
20
+ #TODO: better error handling flow control for above
21
+
22
+
23
+
24
+ start_here = get_copy_from()
25
+ puts "Copy From: #{start_here}"
26
+
27
+ to = get_copy_to()
28
+ puts "Copy To: #{to}"
29
+
30
+ FileUtils.copy_entry start_here, to
31
+ #files = get_files()
32
+ #files.each do |file|
33
+ #someone please show me how to do this better
34
+ # from = File.expand_path(file, start_here+"/..")
35
+ #puts "copy #{from} #{to}"
36
+ #FileUtils.copy(from, to)
37
+ #end
38
+ end
39
+
40
+ def self.get_copy_from
41
+ l = Nu::Loader.new
42
+ libdir = l.get_libdir @gem_to_copy
43
+ #puts File.expand_path libdir
44
+ #try Dir.glob("{bin,lib}/**/*")
45
+ libdir.gsub '{lib}','lib'
46
+ end
47
+
48
+ def self.get_files
49
+ l = Nu::Loader.new
50
+ spec = l.get_gemspec @gem_to_copy
51
+ files = spec.lib_files #get full path
52
+ files
53
+ end
54
+
55
+ def self.get_copy_to
56
+ l = Nu::Loader.new
57
+ spec = l.get_gemspec @gem_to_copy
58
+ #to be used in copying
59
+ name = spec.full_name
60
+ to = Dir.pwd + "/lib/#{name}"
61
+ if Dir[to] == [] #may need a smarter guy here
62
+ FileUtils.mkpath to
63
+ end
64
+ to
65
+ end
66
+ end
67
+ end
data/lib/loader.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+
3
+ module Nu
4
+ class Loader
5
+
6
+ def get_libdir(name)
7
+ g = get_gemspec name
8
+ l = Gem.searcher.lib_dirs_for g
9
+ #scrub and return?
10
+ l
11
+ end
12
+
13
+ def get_gemspec(name)
14
+ gems = Gem.source_index.find_name name
15
+ return gems.last if gems.length > 0
16
+ end
17
+
18
+ def available? (name)
19
+ Gem.available? name
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nu
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 10
10
+ version: 0.1.10
11
+ platform: ruby
12
+ authors:
13
+ - Dru Sellers
14
+ - Chris Patterson
15
+ - Rob Reynold
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2010-07-16 00:00:00 -05:00
21
+ default_executable:
22
+ dependencies: []
23
+
24
+ description: Nu manages an application's dependencies through its entire life, across many machines, systematically and repeatably
25
+ email:
26
+ - nu-net@googlegroups.com
27
+ executables:
28
+ - nu
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - bin/nu
35
+ - lib/cli.rb
36
+ - lib/loader.rb
37
+ has_rdoc: true
38
+ homepage: http://groups.google.com/group/nu-net
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ hash: 3
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 23
61
+ segments:
62
+ - 1
63
+ - 3
64
+ - 6
65
+ version: 1.3.6
66
+ requirements: []
67
+
68
+ rubyforge_project: nu
69
+ rubygems_version: 1.3.7
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: The best way to manage your application's dependencies in .net
73
+ test_files: []
74
+