Can you please help me to understand stability concept in composer
What makes a package considered as a particular stability?
is it tag name?
is it branch name?
or something else?
When you create a package, how to set its stability, can you give examples for:
dev
alpha
beta
RC
stable
Can package A be considered stable if it requires as dependecy B that is dev?
If I have a package Bar tagged v0.1.3 with composer.json with
"minimum-stability": "stable"
and I require to Bar package another package by cli command
composer require symfony/dom-crawler:4.2
There is no problem and the package is installed.
But when I have package Baz that has same as Bar composer.json
"minimum-stability": "stable"
and i require to the Baz package of Bar
composer require bar/package
i get error:
Installation request for bar/package ^0.1.3 satisfiable by
bar/package[^0.1.3]
bar/package ^0.1.3 requires symfony/dom-crawler 4.2 -> satisfiable by
symfony/dom-crawler[v4.2.0] but these conflict with your requirements
or minimum-stability.
How this can conflict with minium stability?
Both Bar and Baz have the same minimum stability in their composer.json
"minimum-stability": "stable"
and when I requested symfony/dom-crawler in Bar there was no conflict, so why there is a conflict when i require Baz as depencedny in Bar?
Is package symfony/dom-crawler[v4.2.0] stable? and if not then what it is in terms of stability?
Related
We are using a the distribution gem for calculating a gamma distribution and because we specifically require the gamma quantile method, we also require gsl
https://github.com/sciruby/distribution
https://github.com/SciRuby/rb-gsl
This works fine locally but we are trying to push this to heroku and running into immediate problems.
From the looks of things, we require a gsl buildpack which are only supported up to version 1.16 of gsl. There doesn't appear to be a gsl buildpack for the current version 2.1. Installing GSL 1.16 locally appears to be really problematic and we haven't been successful doing this either.
Looking into this further, it looks like we would need to create a binary for the curret version which would need to be hosted on AWS. Seems a bit extreme for what is basically two methods.
Either, we need help building a buildpack or need an alternative to these two specific methods.
Distribution::Gamma.quantile
Distribution::Gamma::Ruby_.cdf
Any help is greatly appreciated
The installation instructions for rb-gsl say (slightly modified for clarity):
Ruby/GSL may be installed as a Ruby Gem by simply running
gem install gsl
Note that the GSL libraries must already be installed before Ruby/GSL can be installed:
Debian/Ubuntu: libgsl0-dev
Rather than a custom buildpack, I suspect you can get away with simply depending on the gsl gem and adding the apt buildpack for the Ubuntu dependency:
Add the apt buildpack early in your list of buildpacks, e.g. by running
heroku buildpacks:add --index 1 heroku-community/apt
Create an Aptfile in the root directory of your repository and list the Ubuntu packages you require inside it, e.g.
libgsl0-dev
Commit the Aptfile and redeploy
Note that the apt buildpack does not do dependency resolution. If libgsl0-dev requires other packages, you'll need to explicitly list them as well.
Bundler has a feature where you can install gems in parallel using the --jobs option. For example:
bundle install --jobs 4
Does a similar feature exist for RubyGems?
I want to be able to run gem update in the same way.
The root problem is that it takes FOREVER to update my global system gems.
No, this feature does not currently exist. However, there’s an unmerged pull request on RubyGems regarding downloading gems in parallel that may be integrated by the time you read this: https://github.com/rubygems/rubygems/pull/649. However, this PR does not address the installation of gems in parallel like Bundler does. So, some of functionality might partially be coming soon.
That said, telling RubyGems to do fewer things during installation is a good way to speed up installation. There are three relevant CLI options worth looking at.
Don't install documentation:
gem update --no-document
Don't attempt to upgrade gems already meeting version requirement:
gem update --conservative
Don't upgrade any dependencies that already meet version requirements:
gem update --minimal-deps
I recommend simply installing gems without documentation. The intent behind running a global gem update is usually “just give me all the latest stuff” so limiting the gems you’re updating would be in conflict that goal. However, many people don’t look at the RDocs generated for their installed gems, and it saves a lot of installation time.
http://guides.rubygems.org/command-reference/#gem-update
I see in composer you can specify "php": ">=5.3" as a requirement so I've tried doing
`"sass": "*"`
and I get a no matching package found error when I try to update my dependencies.
Is it possible to do something like this?
I do not think so. Composer is a PHP package manager written in PHP, while Sass is a Ruby tool. In addition, Ruby has its own package manager: RubyGems.
If you want to manage versions of Sass, I invite you to use Bundler and Gemfile.
I'm developing a ruby gem, and my requires are a mess.
The gem is a web Scraper, which depending on the given options, uses different methods to access the web, and thus needs to require different gems. Some users may never need some gems, or any of them.
My question is, what do I put in my .gemspec:
s.add_runtime_dependency #do I require all the gems here?
Where do I actually require the necessary gems in my code, and how do I do testing?
I don't know the conventions on this. Thanks.
*code: https://github.com/ZirconCode/Scrapah
RubyGems provides two main “types” of dependencies: runtime and development.
Runtime dependencies are what your gem needs to work (such as rails needing activesupport).
Development dependencies are useful for when someone wants to make modifications to your gem. When you specify development dependencies, another developer can run gem install --dev your_gem and RubyGems will grab both sets of dependencies (runtime and development). Typical development dependencies include test frameworks and build systems.
So in Gem Specification file you can add those gems that your gems need to work
Gem::Specification.new do |s|
s.name = "gem name"
s.version = "2.0.0"
s.add_runtime_dependency "daemons",
["= 1.1.0"]
s.add_development_dependency "bourne",
[">= 0"]
I am developing two gems, let's call them foo and bar. Also foo has a runtime dependency on bar. I am developing both these gems with bundler.
How can I specify bar as a dependency of foo and have bundler resolve that dependency to a local path, without polluting my Gemfile? At the moment the only way I can see to do this is to put gem "bar", path: "path/to/bar" in foo's Gemfile, and remove it once bar is on rubygems, but this solution is obviously unsatisfactory as it will break on anybody else's machine until that date.
It is not clear if the dependency is runtime or compile time.
Have you tried installing bar using the local .gem file? Once installed in GEM_HOME, your foo gem should detect it
cd /path/to/bar
rake install
then
cd /path/to/foo
rake build
You can specify the dependency as a git branch, and then map it to a local path using the instructions here: http://ryanbigg.com/2013/08/bundler-local-paths/