icy 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/Gemfile +3 -4
- data/README.md +4 -13
- data/icy.gemspec +1 -0
- data/lib/icy.rb +34 -2
- data/lib/icy/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f0d51967eda386cb9f13739476c4a0981e0a7a3
|
4
|
+
data.tar.gz: 70910a57cb7bec9bd1021d64608e296cd14aa5c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: badb3136b194dba1e2f146d4c7391aaa5959e414ff44404b54c3f9287b1250b00e88b33e47d4fa8bf8ecb95037894748f999150168a7fd07da8b0155bd7454e4
|
7
|
+
data.tar.gz: dc89a33cf0b68ac9c109549fdd8befc10d925898a06eff03db4ee161a882beb86d94227ae01c95776d83b4bd1ad46c199443c6904fdcfc97a3bebbb5ef196310
|
data/.rspec
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org' do
|
2
|
+
gemspec
|
3
|
+
end
|
data/README.md
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# Icy
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/icy`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
5
|
Add this line to your application's Gemfile:
|
@@ -22,15 +18,10 @@ Or install it yourself as:
|
|
22
18
|
|
23
19
|
## Usage
|
24
20
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
21
|
+
```
|
22
|
+
Icy.require_tree 'my_dir' # require every ruby file in this directory
|
23
|
+
```
|
32
24
|
|
33
25
|
## Contributing
|
34
26
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
-
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/austinthecoder/icy.
|
data/icy.gemspec
CHANGED
data/lib/icy.rb
CHANGED
@@ -1,5 +1,37 @@
|
|
1
|
-
require "
|
1
|
+
require "pathname"
|
2
2
|
|
3
3
|
module Icy
|
4
|
-
|
4
|
+
RUBY_EXTNAME = '.rb'
|
5
|
+
|
6
|
+
def self.require_tree(pathname, exclude: nil)
|
7
|
+
pathname = Pathname.new pathname
|
8
|
+
pathname_exclusions = Array(exclude).map { |exclude| Pathname.new exclude }
|
9
|
+
|
10
|
+
working_dir = if pathname.relative? || pathname_exclusions.any?
|
11
|
+
calling_filepath = caller[0].split(':')[0]
|
12
|
+
Pathname.new(calling_filepath).parent
|
13
|
+
end
|
14
|
+
|
15
|
+
pathname = working_dir.join(pathname) if pathname.relative?
|
16
|
+
|
17
|
+
pathname_exclusions = pathname_exclusions.map do |pathname_exclusion|
|
18
|
+
working_dir.join(pathname_exclusion) if pathname_exclusion.relative?
|
19
|
+
end
|
20
|
+
|
21
|
+
selected_children = pathname.children.reject do |child_pathname|
|
22
|
+
pathname_exclusions.any? { |exl| child_pathname == exl }
|
23
|
+
end
|
24
|
+
|
25
|
+
selected_children.each do |child|
|
26
|
+
if child.directory?
|
27
|
+
require_tree child
|
28
|
+
elsif child.extname == RUBY_EXTNAME
|
29
|
+
require_relative child
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
true
|
34
|
+
end
|
5
35
|
end
|
36
|
+
|
37
|
+
Icy.require_tree 'icy'
|
data/lib/icy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Schneider
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
41
55
|
description:
|
42
56
|
email:
|
43
57
|
- me@austinschneider.com
|
@@ -46,6 +60,7 @@ extensions: []
|
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
48
62
|
- ".gitignore"
|
63
|
+
- ".rspec"
|
49
64
|
- Gemfile
|
50
65
|
- README.md
|
51
66
|
- Rakefile
|