gem-console 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gem/console/version.rb +1 -1
- data/lib/gem/console.rb +1 -1
- metadata +1 -2
- data/lib/gem/console/tasks/console.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c459197692a954a83098a50defe4c6af2137102f
|
4
|
+
data.tar.gz: 46d6613d18fa141f515f587435f28dd7616670f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c23826cc702fff40e9203d39dc1f59d690e76fc82a8d71661822fbc5d55ab03d733ef3d8abcb1c90349ca38d846aa9e4d7276123502575e6822dcf175065b82
|
7
|
+
data.tar.gz: 0832ec10e1632a633d4760752604181258a31b92e5ec32655dc75cb608942916d66e946b2040342a8980f6771f40724fd269595e1375ff6258ebfd643a49278d
|
data/lib/gem/console/version.rb
CHANGED
data/lib/gem/console.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Keele
|
@@ -55,7 +55,6 @@ files:
|
|
55
55
|
- gem-console.gemspec
|
56
56
|
- lib/gem-console.rb
|
57
57
|
- lib/gem/console.rb
|
58
|
-
- lib/gem/console/tasks/console.rb
|
59
58
|
- lib/gem/console/version.rb
|
60
59
|
homepage: ''
|
61
60
|
licenses:
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
|
3
|
-
module Gem
|
4
|
-
module Console
|
5
|
-
|
6
|
-
class << self
|
7
|
-
|
8
|
-
def enable(library_load_file = $library_load_file)
|
9
|
-
|
10
|
-
library_load_file ||= catch(:file) do
|
11
|
-
throw_or_recurse Dir[File.join 'lib', '*']
|
12
|
-
end
|
13
|
-
|
14
|
-
desc 'Open a console preloaded with this library'
|
15
|
-
task :console, :cmd do |_, args|
|
16
|
-
args.with_defaults(cmd: pry_enabled? ? 'pry' : 'irb')
|
17
|
-
sh [
|
18
|
-
'bundle exec',
|
19
|
-
args.cmd,
|
20
|
-
"-I lib",
|
21
|
-
"-r #{library_load_file}"
|
22
|
-
].join(' ')
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def throw_or_recurse(paths)
|
28
|
-
files, dirs = paths.partition do |path|
|
29
|
-
File.file? path
|
30
|
-
end
|
31
|
-
files.each do |file|
|
32
|
-
puts "Considering #{file}..."
|
33
|
-
throw :file, file if File.extname(file) == '.rb'
|
34
|
-
end if not files.empty?
|
35
|
-
dirs.each do |dir|
|
36
|
-
puts "recursing #{dir}..."
|
37
|
-
throw_or_recurse Dir[dir]
|
38
|
-
end if not dirs.empty?
|
39
|
-
raise 'No library file to load `rake console` from found.' +
|
40
|
-
'Set $library_load_file in your Rakefile or ' +
|
41
|
-
'provide a path in your `Gem::Console.enable` invocation.'
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
def pry_enabled?
|
46
|
-
begin
|
47
|
-
require 'pry'
|
48
|
-
rescue LoadError
|
49
|
-
false
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|