devpack 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -47
- data/.ruby-version +1 -0
- data/README.md +22 -22
- data/devpack.gemspec +3 -2
- data/lib/devpack.rb +12 -2
- data/lib/devpack/gem_spec.rb +5 -1
- data/lib/devpack/gems.rb +17 -4
- data/lib/devpack/initializers.rb +2 -2
- data/lib/devpack/messages.rb +10 -2
- data/lib/devpack/version.rb +1 -1
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335c743ca50fef7d6141bc5a0c8f1a4525fe4a5aeca591be30fbe2501f160b94
|
4
|
+
data.tar.gz: ead8cd42535bd8a0e5cc869786b9cc49e257706b0e47ed583714e01765a1cb32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c7652e4385dd4cf5a5ae4faaf791ecbe9a53900eccc88ae62fa50c2a98e922eab7191c459992d488d511b65a441874f2920fd142fe19f265e5b0a70306732c0
|
7
|
+
data.tar.gz: 0a129da29674bc71c1ea270c6f9aa5cef1eb31fe98828b2d0b8b9ee98e36277e3a8cb07e7e3156a756e34ddc1bbd6ae055c0c849001dbf6fb40dd9d98c870fa6
|
data/.rubocop.yml
CHANGED
@@ -3,52 +3,6 @@ Metrics/BlockLength:
|
|
3
3
|
- "spec/**/*"
|
4
4
|
|
5
5
|
AllCops:
|
6
|
+
NewCops: enable
|
6
7
|
Exclude:
|
7
8
|
- "spec/fixtures/**/*"
|
8
|
-
|
9
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
10
|
-
Enabled: true
|
11
|
-
Layout/SpaceAroundMethodCallOperator:
|
12
|
-
Enabled: true
|
13
|
-
Lint/DeprecatedOpenSSLConstant:
|
14
|
-
Enabled: true
|
15
|
-
Lint/MixedRegexpCaptureTypes:
|
16
|
-
Enabled: true
|
17
|
-
Lint/RaiseException:
|
18
|
-
Enabled: true
|
19
|
-
Lint/StructNewOverride:
|
20
|
-
Enabled: true
|
21
|
-
Style/ExponentialNotation:
|
22
|
-
Enabled: true
|
23
|
-
Style/HashEachMethods:
|
24
|
-
Enabled: true
|
25
|
-
Style/HashTransformKeys:
|
26
|
-
Enabled: true
|
27
|
-
Style/HashTransformValues:
|
28
|
-
Enabled: true
|
29
|
-
Style/RedundantFetchBlock:
|
30
|
-
Enabled: true
|
31
|
-
Style/RedundantRegexpCharacterClass:
|
32
|
-
Enabled: true
|
33
|
-
Style/RedundantRegexpEscape:
|
34
|
-
Enabled: true
|
35
|
-
Style/SlicingWithRange:
|
36
|
-
Enabled: true
|
37
|
-
Lint/DuplicateElsifCondition:
|
38
|
-
Enabled: true
|
39
|
-
Style/AccessorGrouping:
|
40
|
-
Enabled: true
|
41
|
-
Style/ArrayCoercion:
|
42
|
-
Enabled: true
|
43
|
-
Style/BisectedAttrAccessor:
|
44
|
-
Enabled: true
|
45
|
-
Style/CaseLikeIf:
|
46
|
-
Enabled: true
|
47
|
-
Style/HashAsLastArrayItem:
|
48
|
-
Enabled: true
|
49
|
-
Style/HashLikeCase:
|
50
|
-
Enabled: true
|
51
|
-
Style/RedundantAssignment:
|
52
|
-
Enabled: true
|
53
|
-
Style/RedundantFileExtensionInRequire:
|
54
|
-
Enabled: true
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.8
|
data/README.md
CHANGED
@@ -4,46 +4,46 @@ Include a single gem in your `Gemfile` to allow developers to optionally include
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Create a file named `.devpack` in your project's directory, or in any parent directory:
|
8
|
+
|
9
|
+
```
|
10
|
+
# .devpack
|
11
|
+
awesome_print
|
12
|
+
byebug
|
13
|
+
better_errors
|
14
|
+
|
15
|
+
# Optionally specify a version:
|
16
|
+
pry:0.13.1
|
17
|
+
```
|
18
|
+
|
19
|
+
Add _Devpack_ to any project's `Gemfile`:
|
8
20
|
|
9
21
|
```ruby
|
22
|
+
# Gemfile
|
10
23
|
group :development, :test do
|
11
|
-
gem 'devpack', '~> 0.3.
|
24
|
+
gem 'devpack', '~> 0.3.2'
|
12
25
|
end
|
13
26
|
```
|
14
27
|
|
15
|
-
|
28
|
+
Rebuild your bundle:
|
16
29
|
|
17
30
|
```bash
|
18
|
-
|
31
|
+
bundle install
|
19
32
|
```
|
20
33
|
|
21
34
|
## Usage
|
22
35
|
|
23
|
-
|
36
|
+
Load _Devpack_ (if your gems are not auto-loaded as in e.g. a _Rails_ application environment):
|
24
37
|
|
25
|
-
```
|
26
|
-
# .devpack
|
27
|
-
awesome_print
|
28
|
-
byebug
|
29
|
-
better_errors
|
30
|
-
|
31
|
-
# Optionally specify a version:
|
32
|
-
pry:0.13.1
|
33
|
-
```
|
34
|
-
|
35
|
-
All listed gems will be automatically required when _Devpack_ is loaded.
|
36
|
-
|
37
|
-
If your gems are not auto-loaded (e.g. by _Rails_) then you must require the gem:
|
38
38
|
```ruby
|
39
39
|
require 'devpack'
|
40
40
|
```
|
41
41
|
|
42
|
-
|
42
|
+
_Devpack_ will attempt to load all configured gems immediately, providing feedback to _stderr_. All dependencies are loaded with `require` after being recursively verified for compatibily with bundled gems before loading.
|
43
43
|
|
44
|
-
|
44
|
+
It is recommended to use a [global configuration](#global-configuration).
|
45
45
|
|
46
|
-
|
46
|
+
When using a per-project configuration, `.devpack` files should be added to `.gitignore`.
|
47
47
|
|
48
48
|
### Initializers
|
49
49
|
|
@@ -70,7 +70,7 @@ Bullet.enable = true
|
|
70
70
|
```
|
71
71
|
|
72
72
|
### Global Configuration
|
73
|
-
|
73
|
+
<a name="global-configuration"></a>
|
74
74
|
To configure globally simply save your `.devpack` configuration file to any parent directory of your project directory, e.g. `~/.devpack`.
|
75
75
|
|
76
76
|
This strategy also applies to `.devpack_initializers`.
|
data/devpack.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = 'Allow developers to optionally include a set of development gems without adding to the Gemfile.'
|
13
13
|
spec.homepage = 'https://github.com/bobf/devpack'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
16
16
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
18
|
spec.metadata['source_code_uri'] = spec.homepage
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'byebug', '~> 11.1'
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.9'
|
30
30
|
spec.add_development_dependency 'rspec-its', '~> 1.3'
|
31
|
-
spec.add_development_dependency 'rubocop', '~>
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 1.8'
|
32
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.1'
|
32
33
|
spec.add_development_dependency 'strong_versions', '~> 0.4.4'
|
33
34
|
end
|
data/lib/devpack.rb
CHANGED
@@ -17,9 +17,11 @@ require 'devpack/version'
|
|
17
17
|
module Devpack
|
18
18
|
class Error < StandardError; end
|
19
19
|
|
20
|
+
class GemNotFoundError < Error; end
|
21
|
+
|
20
22
|
class << self
|
21
|
-
def warn(message)
|
22
|
-
prefixed = message.split("\n").map { |line| "
|
23
|
+
def warn(level, message)
|
24
|
+
prefixed = message.split("\n").map { |line| "#{prefix(level)} #{line}" }.join("\n")
|
23
25
|
Kernel.warn(prefixed)
|
24
26
|
end
|
25
27
|
|
@@ -38,6 +40,14 @@ module Devpack
|
|
38
40
|
def config
|
39
41
|
@config ||= Devpack::Config.new(Dir.pwd)
|
40
42
|
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def prefix(level)
|
47
|
+
color = { success: '32', info: '36', error: '31' }.fetch(level)
|
48
|
+
icon = { success: '✓', info: 'ℹ', error: '✗' }.fetch(level)
|
49
|
+
"\e[34m[\e[39mdevpack\e[34m]\e[39m \e[#{color}m#{icon}\e[39m"
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
43
53
|
|
data/lib/devpack/gem_spec.rb
CHANGED
@@ -12,7 +12,7 @@ module Devpack
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def require_paths(visited = Set.new)
|
15
|
-
raise
|
15
|
+
raise GemNotFoundError, @requirement.nil? ? '-' : required_version if gemspec.nil?
|
16
16
|
|
17
17
|
(immediate_require_paths + dependency_require_paths(visited)).compact.flatten.uniq
|
18
18
|
end
|
@@ -41,6 +41,10 @@ module Devpack
|
|
41
41
|
matched.version != spec.version
|
42
42
|
end
|
43
43
|
|
44
|
+
def required_version
|
45
|
+
@requirement.requirements.first.last.version
|
46
|
+
end
|
47
|
+
|
44
48
|
def compatible_specs?(specs, dependencies)
|
45
49
|
specs.all? { |spec| compatible_dependencies?(dependencies, spec) }
|
46
50
|
end
|
data/lib/devpack/gems.rb
CHANGED
@@ -8,6 +8,8 @@ module Devpack
|
|
8
8
|
def initialize(config, glob = GemGlob.new)
|
9
9
|
@config = config
|
10
10
|
@gem_glob = glob
|
11
|
+
@failures = []
|
12
|
+
@missing = []
|
11
13
|
end
|
12
14
|
|
13
15
|
def load
|
@@ -15,12 +17,20 @@ module Devpack
|
|
15
17
|
|
16
18
|
gems, time = timed { load_devpack }
|
17
19
|
names = gems.map(&:first)
|
18
|
-
|
20
|
+
summarize(gems, time)
|
19
21
|
names
|
20
22
|
end
|
21
23
|
|
22
24
|
private
|
23
25
|
|
26
|
+
def summarize(gems, time)
|
27
|
+
@failures.each do |failure|
|
28
|
+
warn(:error, Messages.failure(failure[:name], failure[:message]))
|
29
|
+
end
|
30
|
+
warn(:success, Messages.loaded(@config.devpack_path, gems, time.round(2)))
|
31
|
+
warn(:info, Messages.install_missing(@missing)) unless @missing.empty?
|
32
|
+
end
|
33
|
+
|
24
34
|
def load_devpack
|
25
35
|
@config.requested_gems.map do |requested|
|
26
36
|
name, _, version = requested.partition(':')
|
@@ -32,7 +42,10 @@ module Devpack
|
|
32
42
|
[name, activate(name, requirement)]
|
33
43
|
rescue LoadError => e
|
34
44
|
deactivate(name)
|
35
|
-
|
45
|
+
@failures << { name: name, message: load_error_message(e) }
|
46
|
+
nil
|
47
|
+
rescue GemNotFoundError => e
|
48
|
+
@missing << { name: name, version: e.message == '-' ? nil : e.message }
|
36
49
|
nil
|
37
50
|
end
|
38
51
|
|
@@ -52,8 +65,8 @@ module Devpack
|
|
52
65
|
Gem.loaded_specs.delete(name)
|
53
66
|
end
|
54
67
|
|
55
|
-
def warn(message)
|
56
|
-
Devpack.warn(message)
|
68
|
+
def warn(level, message)
|
69
|
+
Devpack.warn(level, message)
|
57
70
|
end
|
58
71
|
|
59
72
|
def load_error_message(error)
|
data/lib/devpack/initializers.rb
CHANGED
@@ -15,7 +15,7 @@ module Devpack
|
|
15
15
|
return if path.nil?
|
16
16
|
|
17
17
|
args = path, initializers, time.round(2)
|
18
|
-
Devpack.warn(Messages.loaded_initializers(*args))
|
18
|
+
Devpack.warn(:success, Messages.loaded_initializers(*args))
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -27,7 +27,7 @@ module Devpack
|
|
27
27
|
def load_initializer(path)
|
28
28
|
require path
|
29
29
|
rescue ScriptError, StandardError => e
|
30
|
-
Devpack.warn(Messages.initializer_failure(path, message(e)))
|
30
|
+
Devpack.warn(:error, Messages.initializer_failure(path, message(e)))
|
31
31
|
nil
|
32
32
|
end
|
33
33
|
|
data/lib/devpack/messages.rb
CHANGED
@@ -25,8 +25,12 @@ module Devpack
|
|
25
25
|
"Loaded #{initializers.compact.size} initializer(s) from '#{path}' in #{time} seconds"
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
|
28
|
+
def install_missing(missing)
|
29
|
+
gems = missing.map do |spec|
|
30
|
+
spec[:version].nil? ? spec[:name] : "#{spec[:name]}==#{spec[:version]}"
|
31
|
+
end
|
32
|
+
|
33
|
+
"Install #{missing.size} missing gem(s): #{command(gems)}"
|
30
34
|
end
|
31
35
|
|
32
36
|
private
|
@@ -34,6 +38,10 @@ module Devpack
|
|
34
38
|
def indented(message)
|
35
39
|
message.split("\n").map { |line| " #{line}" }.join("\n")
|
36
40
|
end
|
41
|
+
|
42
|
+
def command(gems)
|
43
|
+
"bundle exec gem install #{gems.join(' ')}"
|
44
|
+
end
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
data/lib/devpack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '1.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '1.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.1'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: strong_versions
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,6 +105,7 @@ files:
|
|
91
105
|
- ".gitignore"
|
92
106
|
- ".rspec"
|
93
107
|
- ".rubocop.yml"
|
108
|
+
- ".ruby-version"
|
94
109
|
- CHANGELOG.md
|
95
110
|
- Gemfile
|
96
111
|
- LICENSE.txt
|
@@ -125,14 +140,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
140
|
requirements:
|
126
141
|
- - ">="
|
127
142
|
- !ruby/object:Gem::Version
|
128
|
-
version: 2.
|
143
|
+
version: 2.5.0
|
129
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
145
|
requirements:
|
131
146
|
- - ">="
|
132
147
|
- !ruby/object:Gem::Version
|
133
148
|
version: '0'
|
134
149
|
requirements: []
|
135
|
-
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.7.6.2
|
136
152
|
signing_key:
|
137
153
|
specification_version: 4
|
138
154
|
summary: Conveniently tailor your development environment
|