nu 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/nu/app.rb +26 -10
  2. data/lib/nu/settings.rb +3 -3
  3. metadata +4 -4
data/lib/nu/app.rb CHANGED
@@ -13,7 +13,7 @@ class App
13
13
  def initialize(arguments, stdin, stdout)
14
14
 
15
15
  #special case, they want to know our version
16
- if arguments.count == 1 && arguments[0] == '--version'
16
+ if arguments.length == 1 && arguments[0] == '--version'
17
17
  output_version
18
18
  exit 0
19
19
  end
@@ -31,15 +31,23 @@ class App
31
31
  begin
32
32
  OptionParser.new do |opts|
33
33
 
34
- opts.banner = ["Usage: nu install PACKAGE [options]",
35
- "\nConfig: nu config NAME VALUE",
36
- "\nReport: nu report"]
34
+ opts.banner = "\nUsage:" +
35
+ "\n nu -h/--help" +
36
+ "\n nu --version" +
37
+ "\n nu COMMAND [arguments...] [options...]" +
38
+ "\n\nExamples:" +
39
+ "\n nu install fluentnhibernate" +
40
+ "\n nu install nunit --version 2.5.7.10213.20100801" +
41
+ "\n nu config lib.location ./lib" +
42
+ "\n nu report" +
43
+ "\n nu install fluentnhibernate --report" +
44
+ "\n\nOptions and Switches:"
37
45
 
38
46
  opts.on('-v', '--version VERSION','Specify version of package to install' ) do |ver|
39
47
  @options.package_version = ver
40
48
  end
41
49
 
42
- opts.on('-r','--report', 'Report on the packages currently installed in the lib folder') do
50
+ opts.on('-r','--report', 'Report on the packages currently installed in the lib folder. When called as a switch it will run the report AFTER executing the requested command.') do
43
51
  @commands << lambda {Nu::Api.output_report}
44
52
  end
45
53
 
@@ -86,7 +94,7 @@ class App
86
94
  protected
87
95
 
88
96
  def extract_commands
89
- if @arguments.count > 0
97
+ if @arguments.length > 0
90
98
  @options.command = @arguments[0].downcase
91
99
  case @options.command
92
100
  when 'report'
@@ -100,21 +108,21 @@ class App
100
108
  # @options.package = @arguments[1]
101
109
  # @commands << lambda {Nu::Api.uninstall_package(@options.package, @options.package_version)}
102
110
  when 'config'
103
- if @arguments.count == 2
111
+ if @arguments.length == 2
104
112
  @commands << lambda {puts "#{@arguments[1]} = #{Nu::Api.get_setting(@arguments[1])}"}
105
113
  else
106
114
  assert_param_count(3)
107
115
  @commands << lambda do
108
116
  Nu::Api.store_setting(@arguments[1], @arguments[2])
109
117
  puts "#{@arguments[1]} = #{Nu::Api.get_setting(@arguments[1])}"
110
- end if @arguments.count == 3
118
+ end if @arguments.length == 3
111
119
  end
112
120
  end
113
121
  end
114
122
  end
115
123
 
116
124
  def assert_param_count(count)
117
- unless @arguments.count == count
125
+ unless @arguments.length == count
118
126
  @help_command.call
119
127
  end
120
128
  end
@@ -126,7 +134,7 @@ class App
126
134
 
127
135
  # True if required arguments were provided
128
136
  def arguments_valid?
129
- true if @commands.count > 0
137
+ true if @commands.length > 0
130
138
  end
131
139
 
132
140
  def output_inputs
@@ -140,7 +148,12 @@ class App
140
148
 
141
149
  def output_help(opts)
142
150
  output_version
151
+ output_description
143
152
  puts opts
153
+ puts "\n\nFurther Information:" +
154
+ "\n http://nu.wikispot.org" +
155
+ "\n http://groups.google.com/group/nu-net"
156
+ puts ''
144
157
  exit 0
145
158
  end
146
159
 
@@ -148,4 +161,7 @@ class App
148
161
  puts Nu::Api.version_string
149
162
  end
150
163
 
164
+ def output_description
165
+ puts "Nu will automatically download and install specified library packages into your lib folder, along with all their dependencies.\n"
166
+ end
151
167
  end
data/lib/nu/settings.rb CHANGED
@@ -14,8 +14,8 @@ module Nu
14
14
  def target.get_setting_by_path(path, logger)
15
15
  path = path.split('.') if path.class == String
16
16
  obj = self
17
- path.count.times do
18
- if path.count == 1
17
+ path.length.times do
18
+ if path.length == 1
19
19
  return obj.send(path.to_s)
20
20
  else
21
21
  part = path.shift
@@ -27,7 +27,7 @@ module Nu
27
27
  end
28
28
 
29
29
  def target.set_setting(settings_object, path, value, logger)
30
- if path.count == 1
30
+ if path.length == 1
31
31
  logger.call("Assigning value: #{value.to_s}")
32
32
  begin
33
33
  if value.match(/^\d*\.\d*$/)
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dru Sellers
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-08-29 00:00:00 -05:00
21
+ date: 2010-08-30 00:00:00 -05:00
22
22
  default_executable:
23
23
  dependencies: []
24
24