gem-local 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c56f0a1971952d39ceedbe5a450b2338961cdc3
4
- data.tar.gz: 00ba138c9313cbae22650b8f63bdf21df6dab016
3
+ metadata.gz: a6929870d4a726e783406ce179a666cb89e17022
4
+ data.tar.gz: 74de361c70467ea9e200918c1256598c418197e2
5
5
  SHA512:
6
- metadata.gz: f7a5f0b4667e35de56ddf8385b01bd713667823831a6a4cf46cb5ae015ac9f6bfe99e450f42753fcfdf6a4bcb7bf5f394ec558079b6a9ebd6444bf1bd9174265
7
- data.tar.gz: 1805baf85f4733b86e599ff0c02efdc4711872d80974e842dfcebf5799b4c2e11f1802e269d443eb1a9cc3286ea74dc02d8109a0aebe33be15511bbc50d06e2a
6
+ metadata.gz: 70cc81c6831fb21a3c292e614e924dc86f7ef9e62a32966a0e65ec214c5e7b66f3688caa21c614fc49b9c57b75c1b21416b800194cf7e4f9d4d41b79eb9f3fa4
7
+ data.tar.gz: 5ac285eaad739c7f8422ab7e34ffd09d960a6c75cc45b261ec70f2c5a8eda1543f4ab83c27cb12ac74e7662b7fb0a92e7c9754e21f91b5a3cb521ecfbba3c3eb
data/README.md CHANGED
@@ -39,7 +39,37 @@ When you want to use the remote version again, run
39
39
  gem local ignore my-dependency
40
40
  ```
41
41
 
42
- You can use/ignore multiple gems by supplying a list, or you can use/ignore all at once by not specifying any gem in particular.
42
+ These commands (and their aliases--see the docs) work for multiple registered gems at once, as well as all registered gems if you don't specify any.
43
+
44
+ ```sh
45
+ gem local status
46
+ # off: foo @ /Users/rubyist/code/oss/foo
47
+ # on: bar @ /Users/rubyist/code/oss/bar
48
+ # on: fizz @ /Users/rubyist/code/oss/fizz
49
+ # on: buzz @ /Users/rubyist/code/oss/buzz
50
+ # off: metasyntactic @ /Users/rubyist/code/oss/variable
51
+
52
+ gem local ignore bar fizz
53
+ # off: foo @ /Users/rubyist/code/oss/foo
54
+ # off: bar @ /Users/rubyist/code/oss/bar
55
+ # off: fizz @ /Users/rubyist/code/oss/fizz
56
+ # on: buzz @ /Users/rubyist/code/oss/buzz
57
+ # off: metasyntactic @ /Users/rubyist/code/oss/variable
58
+
59
+ gem local use
60
+ # on: foo @ /Users/rubyist/code/oss/foo
61
+ # on: bar @ /Users/rubyist/code/oss/bar
62
+ # on: fizz @ /Users/rubyist/code/oss/fizz
63
+ # on: buzz @ /Users/rubyist/code/oss/buzz
64
+ # on: metasyntactic @ /Users/rubyist/code/oss/variable
65
+
66
+ gem local ignore
67
+ # off: foo @ /Users/rubyist/code/oss/foo
68
+ # off: bar @ /Users/rubyist/code/oss/bar
69
+ # off: fizz @ /Users/rubyist/code/oss/fizz
70
+ # off: buzz @ /Users/rubyist/code/oss/buzz
71
+ # off: metasyntactic @ /Users/rubyist/code/oss/variable
72
+ ```
43
73
 
44
74
  If invocations of `bundle config local...` cause your `.gemlocal` file to get out of sync with bundler's settings, run
45
75
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "gem-local"
7
- spec.version = "0.1.2"
7
+ spec.version = "0.1.3"
8
8
  spec.authors = ["Chris Keele"]
9
9
  spec.email = ["dev@chriskeele.com"]
10
10
 
@@ -33,7 +33,7 @@ help [cmd] | Displays help information.
33
33
  end
34
34
 
35
35
  def usage
36
- "#{program_name} subcommand <gem> <path>" + "\n" + arguments
36
+ "#{program_name} subcommand [args...]"
37
37
  end
38
38
 
39
39
  def execute
@@ -47,6 +47,23 @@ help [cmd] | Displays help information.
47
47
  help
48
48
  end
49
49
  end
50
+
51
+ # Override core dispatcher to do our own help
52
+ def invoke_with_build_args(args, build_args)
53
+ handle_options args
54
+
55
+ options[:build_args] = build_args
56
+
57
+ self.ui = Gem::SilentUI.new if options[:silent]
58
+
59
+ if options[:help] then
60
+ puts full_help
61
+ elsif @when_invoked then
62
+ @when_invoked.call options
63
+ else
64
+ execute
65
+ end
66
+ end
50
67
 
51
68
  # COMMANDS
52
69
 
@@ -164,12 +181,28 @@ help [cmd] | Displays help information.
164
181
  if not cmd and args.empty?
165
182
  puts description + "\n" + arguments
166
183
  elsif cmd
167
- puts info_for(__method__)
184
+ puts info_for(cmd)
168
185
  else
169
186
  arity_error __method__
170
187
  end
171
188
  end
172
189
 
190
+ # Shows in `gem help local`
191
+ def full_help
192
+ [
193
+ usage,
194
+ nil,
195
+ 'Summary:',
196
+ summary,
197
+ nil,
198
+ 'Description:',
199
+ description,
200
+ nil,
201
+ 'Arguments:',
202
+ arguments,
203
+ ].join("\n")
204
+ end
205
+
173
206
  private
174
207
 
175
208
  # COMMANDS
@@ -178,49 +211,49 @@ private
178
211
  @cmds ||= {
179
212
  "add" => {
180
213
  description: "Adds or overwrites a local gem configuration and activates the gem from sourcein bundler.",
181
- usage: "add <gem> <path>",
214
+ usage: "gem local add <gem> <path>",
182
215
  arguments: "takes exactly two arguments",
183
216
  aliases: %w[new],
184
217
  },
185
218
  "status" => {
186
219
  description: "Displays the current local gem configuration, or the specified gem's config.",
187
- usage: "status [gem]",
220
+ usage: "gem local status [gem]",
188
221
  arguments: "takes zero or one arguments",
189
222
  aliases: %w[show],
190
223
  },
191
224
  "remove" => {
192
225
  description: "Remove a local gem from `gem local` management.",
193
- usage: "remove <gem>",
226
+ usage: "gem local remove <gem>",
194
227
  arguments: "takes exactly one argument",
195
228
  aliases: %w[delete],
196
229
  },
197
230
  "use" => {
198
231
  description: "Activates all registered local gems, or the specified gems, in bundler.",
199
- usage: "use [gem]",
232
+ usage: "gem local use [gem]",
200
233
  arguments: "takes any number of arguments",
201
234
  aliases: %w[on activate enable renable reactivate],
202
235
  },
203
236
  "ignore" => {
204
237
  description: "Deactivates all registered local gems, or the specified gems, in bundler.",
205
- usage: "ignore [gem]",
238
+ usage: "gem local ignore [gem]",
206
239
  arguments: "takes any number of arguments",
207
240
  aliases: %w[off remote deactivate disable],
208
241
  },
209
242
  "rebuild" => {
210
243
  description: "Regenerates your local `.gemlocal` file from the bundle config if they get out of sync.",
211
- usage: "rebuild",
244
+ usage: "gem local rebuild",
212
245
  arguments: "takes zero arguments",
213
246
  aliases: %w[],
214
247
  },
215
248
  "install" => {
216
249
  description: "Adds `.gemlocal` and `.bundle` artifacts to project `.gitignore`",
217
- usage: "install",
250
+ usage: "gem local install",
218
251
  arguments: "takes zero arguments",
219
252
  aliases: %w[init],
220
253
  },
221
254
  "help" => {
222
255
  description: "Displays help information, either about `gem local` or a `gem local` subcommand.",
223
- usage: "help [cmd]",
256
+ usage: "gem local help [cmd]",
224
257
  arguments: "takes zero or one arguments",
225
258
  aliases: %w[],
226
259
  },
@@ -249,7 +282,11 @@ private
249
282
  end
250
283
 
251
284
  def aliases_for(info)
252
- "aliases: "+ Array(info[:aliases]).flatten.join(', ')
285
+ "aliases: " + if info[:aliases].length > 0
286
+ Array(info[:aliases]).flatten.join(', ')
287
+ else
288
+ 'none'
289
+ end
253
290
  end
254
291
 
255
292
  def description_for(info)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Keele