Created
May 11, 2020 22:59
-
-
Save ioquatix/f470f7c7348b1f04bd7aeec9d794ae09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative 'lib/async/websocket/version' | |
Gem::Specification.new do |spec| | |
spec.name = "async-websocket" | |
spec.version = Async::WebSocket::VERSION | |
spec.authors = ["Samuel Williams"] | |
spec.email = ["[email protected]"] | |
spec.summary = %q{An async websocket library on top of websocket-driver.} | |
spec.homepage = "" | |
spec.license = "MIT" | |
spec.files = `git ls-files -z`.split("\x0") | |
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | |
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | |
spec.require_paths = ["lib"] | |
spec.add_dependency "async-io", "~> 1.23" | |
spec.add_dependency "async-http", "~> 0.51" | |
spec.add_dependency "protocol-websocket", "~> 0.7.0" | |
spec.add_development_dependency "async-rspec" | |
spec.add_development_dependency "falcon", "~> 0.34" | |
spec.add_development_dependency "covered" | |
spec.add_development_dependency "bundler" | |
spec.add_development_dependency "rspec", "~> 3.6" | |
spec.add_development_dependency "bake-bundler" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd async-websocket | |
% irb | |
irb(main):001:0> spec = Gem::Specification.load("async-websocket.gemspec") | |
irb(main):002:0> spec.files.first | |
=> ".editorconfig" | |
irb(main):003:0> spec.files | |
=> [".editorconfig", ".gitignore", ".rspec", ".travis.yml", "Gemfile", "README.md", "async-websocket.gemspec", "examples/chat/.env", "examples/chat/README.md", "examples/chat/client.rb", "examples/chat/config.ru", "examples/chat/multi-client.rb", "examples/mud/client.rb", "examples/mud/config.ru", "examples/rack/client.rb", "examples/rack/config.ru", "examples/utopia/.bowerrc", "examples/utopia/.gitignore", "examples/utopia/.rspec", "examples/utopia/Gemfile", "examples/utopia/Guardfile", "examples/utopia/README.md", "examples/utopia/Rakefile", "examples/utopia/config.ru", "examples/utopia/config/README.md", "examples/utopia/config/environment.rb", "examples/utopia/lib/readme.txt", "examples/utopia/pages/_heading.xnode", "examples/utopia/pages/_page.xnode", "examples/utopia/pages/client/client.js", "examples/utopia/pages/client/index.xnode", "examples/utopia/pages/errors/exception.xnode", "examples/utopia/pages/errors/file-not-found.xnode", "examples/utopia/pages/links.yaml", "examples/utopia/pages/server/controller.rb", "examples/utopia/public/_static/icon.png", "examples/utopia/public/_static/site.css", "examples/utopia/public/_static/utopia-background.svg", "examples/utopia/public/_static/utopia.svg", "examples/utopia/public/readme.txt", "examples/utopia/spec/spec_helper.rb", "examples/utopia/spec/website_context.rb", "examples/utopia/spec/website_spec.rb", "examples/utopia/tasks/bower.rake", "examples/utopia/tasks/deploy.rake", "examples/utopia/tasks/development.rake", "examples/utopia/tasks/environment.rake", "examples/utopia/tasks/log.rake", "examples/utopia/tasks/static.rake", "lib/async/websocket.rb", "lib/async/websocket/adapters/rack.rb", "lib/async/websocket/client.rb", "lib/async/websocket/connect_request.rb", "lib/async/websocket/connect_response.rb", "lib/async/websocket/connection.rb", "lib/async/websocket/error.rb", "lib/async/websocket/proxy.rb", "lib/async/websocket/request.rb", "lib/async/websocket/response.rb", "lib/async/websocket/server.rb", "lib/async/websocket/upgrade_request.rb", "lib/async/websocket/upgrade_response.rb", "lib/async/websocket/version.rb", "spec/async/websocket/adapters/rack/client.rb", "spec/async/websocket/adapters/rack/config.ru", "spec/async/websocket/adapters/rack_spec.rb", "spec/async/websocket/connection_spec.rb", "spec/async/websocket/server_examples.rb", "spec/async/websocket/server_spec.rb", "spec/async/websocket/upgrade.rb", "spec/spec_helper.rb"] | |
% cd lib | |
% irb | |
irb(main):001:0> spec = Gem::Specification.load("../async-websocket.gemspec") | |
irb(main):002:0> spec.files | |
=> ["async/websocket.rb", "async/websocket/adapters/rack.rb", "async/websocket/client.rb", "async/websocket/connect_request.rb", "async/websocket/connect_response.rb", "async/websocket/connection.rb", "async/websocket/error.rb", "async/websocket/proxy.rb", "async/websocket/request.rb", "async/websocket/response.rb", "async/websocket/server.rb", "async/websocket/upgrade_request.rb", "async/websocket/upgrade_response.rb", "async/websocket/version.rb"] |
If you change spec.files
:
spec.files = Dir['{bake,lib}/**/*']
It only works if the current working directory is the gem root and may produce erroneous results in any other case.
It seems like you can get the path to the original gemspec:
> spec.loaded_from
=> "/Users/samuel/Documents/socketry/async-websocket/async-websocket.gemspec"
So any other task should resolve relative paths to File.dirname(spec.loaded_from)
.
Maybe another option is to use:
Pathname.new(__dir__).glob('{bin,lib}/**/*')
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changing the directory makes the results of
spec.files
inconsistent.If we change
spec.files
:Then it becomes consistent:
Although
Dir[...]
also includes directories which will apparently be ignored.