gem-local 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +29 -5
- data/gem-local.gemspec +1 -1
- data/lib/rubygems/commands/local_command.rb +9 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 749ba5593040a0a6d9691df1d726376738440a42
|
4
|
+
data.tar.gz: 0fff9cc2a331ae5ea362eb3014c91485c4f3aff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dba1ffed3d5c94612b8c47635845ad225d65e7d25315b9318b751697e96d581e2dd9a5cafcbfc69d26fb00db59d23eaed5584be97543d3b73ede0b26e6c6bdc7
|
7
|
+
data.tar.gz: 983a1b2454d4310c5ece9a009dfe168350e747b79fe1eb55861034d6de4fd68339065d74a2c1d7056ed2efc942c00c96998ee9c4be66dc7e51f9fa454f646076
|
data/README.md
CHANGED
@@ -15,31 +15,49 @@ gem install gem-local
|
|
15
15
|
Usage
|
16
16
|
-----
|
17
17
|
|
18
|
-
|
18
|
+
### Initialization
|
19
|
+
|
20
|
+
If using git, inside a project with a `Gemfile` where you want to be able to toggle local bundler gem loadpaths, run:
|
19
21
|
|
20
22
|
```sh
|
21
23
|
gem local install
|
22
24
|
```
|
23
25
|
|
26
|
+
This ensures that the local `.bundle/config` and `.gemlocal` files don't get committed.
|
27
|
+
|
28
|
+
### Adding local repos
|
29
|
+
|
24
30
|
Define the dependencies of this project that you have local copies of, and their locations:
|
25
31
|
|
26
32
|
```sh
|
27
33
|
gem local add my-dependency ~/code/ruby/gems/my-dependency
|
28
34
|
```
|
29
35
|
|
36
|
+
This lets `git local` know about this dependency.
|
37
|
+
|
38
|
+
### Using local repos
|
39
|
+
|
30
40
|
When you want to use your local copy, run
|
31
41
|
|
32
42
|
```sh
|
33
43
|
gem local use my-dependency
|
34
44
|
```
|
35
45
|
|
46
|
+
It updates the **local** bundler config (not *global*, as bundler does by default, which many tutorials run with) to refer to the path you supplied it.
|
47
|
+
|
48
|
+
### Ignoring local repos
|
49
|
+
|
36
50
|
When you want to use the remote version again, run
|
37
51
|
|
38
52
|
```sh
|
39
53
|
gem local ignore my-dependency
|
40
54
|
```
|
41
55
|
|
42
|
-
|
56
|
+
This will remove it from your bundler config and update your `.gitlocal` accordingly to know it's been disabled.
|
57
|
+
|
58
|
+
### Multiple gems at once
|
59
|
+
|
60
|
+
The `use` and `ignore` commands (and their aliases--see the `help`) work for multiple registered gems at once, as well as all registered gems if you don't specify any.
|
43
61
|
|
44
62
|
```sh
|
45
63
|
gem local status
|
@@ -56,14 +74,14 @@ gem local ignore bar fizz
|
|
56
74
|
# on: buzz @ /Users/rubyist/code/oss/buzz
|
57
75
|
# off: metasyntactic @ /Users/rubyist/code/oss/variable
|
58
76
|
|
59
|
-
gem local
|
77
|
+
gem local enable
|
60
78
|
# on: foo @ /Users/rubyist/code/oss/foo
|
61
79
|
# on: bar @ /Users/rubyist/code/oss/bar
|
62
80
|
# on: fizz @ /Users/rubyist/code/oss/fizz
|
63
81
|
# on: buzz @ /Users/rubyist/code/oss/buzz
|
64
82
|
# on: metasyntactic @ /Users/rubyist/code/oss/variable
|
65
83
|
|
66
|
-
gem local
|
84
|
+
gem local disable
|
67
85
|
# off: foo @ /Users/rubyist/code/oss/foo
|
68
86
|
# off: bar @ /Users/rubyist/code/oss/bar
|
69
87
|
# off: fizz @ /Users/rubyist/code/oss/fizz
|
@@ -71,7 +89,9 @@ gem local ignore
|
|
71
89
|
# off: metasyntactic @ /Users/rubyist/code/oss/variable
|
72
90
|
```
|
73
91
|
|
74
|
-
|
92
|
+
### Rebuilding the local gem db
|
93
|
+
|
94
|
+
If invocations of `bundle config --local local...` cause your `.gemlocal` file to get out of sync with bundler's settings in `.bundle/config`, run
|
75
95
|
|
76
96
|
```sh
|
77
97
|
gem local rebuild
|
@@ -79,12 +99,16 @@ gem local rebuild
|
|
79
99
|
|
80
100
|
to update your file against bundler's configuration.
|
81
101
|
|
102
|
+
### Other commands
|
103
|
+
|
82
104
|
For other commands and usage, see
|
83
105
|
|
84
106
|
```sh
|
85
107
|
gem local help
|
86
108
|
```
|
87
109
|
|
110
|
+
### Detailed help
|
111
|
+
|
88
112
|
For details on a command, for example `install`, run
|
89
113
|
|
90
114
|
```sh
|
data/gem-local.gemspec
CHANGED
@@ -71,7 +71,7 @@ help [cmd] | Displays help information.
|
|
71
71
|
if name and location and args.empty?
|
72
72
|
setting = Setting.new(location)
|
73
73
|
if bundler_add name, setting
|
74
|
-
update_config(name, :
|
74
|
+
update_config(name, location: setting.location, status: setting.status)
|
75
75
|
end
|
76
76
|
else
|
77
77
|
arity_error __method__
|
@@ -111,7 +111,7 @@ help [cmd] | Displays help information.
|
|
111
111
|
names.each do |name|
|
112
112
|
if setting = config[name]
|
113
113
|
if bundler_add name, setting
|
114
|
-
update_config(name, :
|
114
|
+
update_config(name, status: "on")
|
115
115
|
else
|
116
116
|
raise "Could not activate gem, make sure `bundle config local.#{name}` #{setting.location} succeeds"
|
117
117
|
end
|
@@ -131,7 +131,7 @@ help [cmd] | Displays help information.
|
|
131
131
|
names.each do |name|
|
132
132
|
if setting = config[name]
|
133
133
|
if bundler_remove name, setting
|
134
|
-
update_config(name, :
|
134
|
+
update_config(name, status: "off")
|
135
135
|
else
|
136
136
|
raise "Could not deactivate gem, make sure `bundle config --delete local.#{name}` succeeds"
|
137
137
|
end
|
@@ -166,7 +166,7 @@ help [cmd] | Displays help information.
|
|
166
166
|
if args.empty?
|
167
167
|
File.open(find_file('.gitignore'), "a+") do |file|
|
168
168
|
%w[.bundle .gemlocal].each do |ignorable|
|
169
|
-
unless file.
|
169
|
+
unless file.each_line.any?{ |line| line.include? ignorable }
|
170
170
|
file.puts ignorable
|
171
171
|
end
|
172
172
|
end
|
@@ -355,9 +355,11 @@ private
|
|
355
355
|
end
|
356
356
|
end
|
357
357
|
|
358
|
-
def update_config(name,
|
359
|
-
new_setting = config[name]
|
360
|
-
|
358
|
+
def update_config(name, properties = {})
|
359
|
+
new_setting = config[name] || Setting.new(nil)
|
360
|
+
properties.each do |field, value|
|
361
|
+
new_setting.send(:"#{field}=", value)
|
362
|
+
end
|
361
363
|
config[name] = new_setting
|
362
364
|
write_config config
|
363
365
|
puts show_setting_for(name, new_setting)
|