nu 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nu/cli.rb +8 -4
- data/lib/nu/loader.rb +8 -1
- data/lib/nu/project.rb +48 -18
- metadata +3 -3
data/lib/nu/cli.rb
CHANGED
@@ -16,9 +16,8 @@ module Nu
|
|
16
16
|
method_options :location => :string
|
17
17
|
|
18
18
|
def install(*names)
|
19
|
-
|
20
|
-
|
21
|
-
loc = @proj.get_location
|
19
|
+
|
20
|
+
loc = @proj.location
|
22
21
|
cl = options['location']
|
23
22
|
loc = cl unless cl.nil?
|
24
23
|
|
@@ -29,9 +28,14 @@ module Nu
|
|
29
28
|
|
30
29
|
desc "lib FOLDER", "where do you want to store the gems"
|
31
30
|
def lib(folder)
|
32
|
-
@proj.
|
31
|
+
@proj.location= folder
|
33
32
|
end
|
34
33
|
|
34
|
+
desc "uselongnames", "turn the option of name + version number on"
|
35
|
+
def uselongnames
|
36
|
+
@proj.use_long_names
|
37
|
+
end
|
38
|
+
|
35
39
|
def self.source_root
|
36
40
|
File.dirname(__FILE__)
|
37
41
|
end
|
data/lib/nu/loader.rb
CHANGED
@@ -6,6 +6,7 @@ module Nu
|
|
6
6
|
def self.load(name)
|
7
7
|
load(name, 'lib')
|
8
8
|
end
|
9
|
+
|
9
10
|
def self.load(name, location)
|
10
11
|
#improve the crap out of this
|
11
12
|
@gem_to_copy = name
|
@@ -60,9 +61,15 @@ module Nu
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def self.get_copy_to
|
64
|
+
proj = Nu::Project.new
|
65
|
+
|
63
66
|
spec = get_gemspec @gem_to_copy
|
64
67
|
#to be used in copying
|
65
|
-
|
68
|
+
if proj.should_use_long_names?
|
69
|
+
name = spec.full_name
|
70
|
+
else
|
71
|
+
name = spec.name
|
72
|
+
end
|
66
73
|
to = Dir.pwd + "/#{@location}/#{name}"
|
67
74
|
if Dir[to] == [] #may need a smarter guy here
|
68
75
|
FileUtils.mkpath to
|
data/lib/nu/project.rb
CHANGED
@@ -5,34 +5,64 @@ module Nu
|
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@config_file = ".nu/options.yaml"
|
8
|
+
ensure_default_config
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
if File.exist? @config_file
|
12
|
-
return
|
13
|
-
end
|
14
|
-
|
15
|
-
content = YAML::dump( {'lib'=>'lib'} )
|
16
|
-
add_file @config_file, content
|
17
|
-
end
|
11
|
+
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
#need to meta awesome this
|
14
|
+
def location
|
15
|
+
opts = get_options
|
16
|
+
opts['lib']
|
22
17
|
end
|
23
|
-
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
File.open(@config_file, 'w') {|f| f.write(content) }
|
18
|
+
#need to meta awesome this
|
19
|
+
def location=(name)
|
20
|
+
opts = get_options
|
21
|
+
opts['lib']=name
|
22
|
+
save_file(opts)
|
23
|
+
nil
|
30
24
|
end
|
25
|
+
|
26
|
+
#need to meta awesome this
|
27
|
+
def should_use_long_names?
|
28
|
+
opts = get_options
|
29
|
+
opts['uselongnames']
|
30
|
+
end
|
31
|
+
|
32
|
+
#need to meta awesome this
|
33
|
+
def use_long_names
|
34
|
+
opts = get_options
|
35
|
+
opts['uselongnames']=true
|
36
|
+
save_file(opts)
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
31
40
|
|
32
41
|
def add_file(name, content)
|
33
42
|
FileUtils.mkdir_p(File.dirname(name))
|
34
43
|
File.open(name, 'w'){|f| f.write(content)}
|
35
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def ensure_default_config
|
48
|
+
if File.exist? @config_file
|
49
|
+
return
|
50
|
+
end
|
51
|
+
|
52
|
+
save_file( {'lib'=>'lib','uselongnames'=>false} )
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_options
|
56
|
+
YAML.load_file @config_file
|
57
|
+
end
|
58
|
+
|
59
|
+
def save_file(opts)
|
60
|
+
content = YAML::dump(opts)
|
61
|
+
File.delete @config_file if File.exist? @config_file
|
62
|
+
dir_name = File.dirname(@config_file)
|
63
|
+
FileUtils.mkdir_p(dir_name) unless File.exist? dir_name
|
64
|
+
File.open(@config_file, 'w') {|f| f.write(content) }
|
65
|
+
end
|
36
66
|
|
37
67
|
end
|
38
68
|
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:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 15
|
10
|
+
version: 0.1.15
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dru Sellers
|