carat 1.9.9.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.travis.yml +24 -0
- data/CHANGELOG.md +2006 -0
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +23 -0
- data/DEVELOPMENT.md +119 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +32 -0
- data/Rakefile +308 -0
- data/bin/carat +21 -0
- data/bin/carat_ruby +56 -0
- data/carat.gemspec +32 -0
- data/lib/carat.rb +446 -0
- data/lib/carat/anonymizable_uri.rb +32 -0
- data/lib/carat/capistrano.rb +16 -0
- data/lib/carat/cli.rb +407 -0
- data/lib/carat/cli/binstubs.rb +38 -0
- data/lib/carat/cli/cache.rb +35 -0
- data/lib/carat/cli/check.rb +35 -0
- data/lib/carat/cli/clean.rb +26 -0
- data/lib/carat/cli/common.rb +56 -0
- data/lib/carat/cli/config.rb +84 -0
- data/lib/carat/cli/console.rb +38 -0
- data/lib/carat/cli/exec.rb +44 -0
- data/lib/carat/cli/gem.rb +195 -0
- data/lib/carat/cli/init.rb +33 -0
- data/lib/carat/cli/inject.rb +33 -0
- data/lib/carat/cli/install.rb +156 -0
- data/lib/carat/cli/open.rb +23 -0
- data/lib/carat/cli/outdated.rb +80 -0
- data/lib/carat/cli/package.rb +45 -0
- data/lib/carat/cli/platform.rb +43 -0
- data/lib/carat/cli/show.rb +74 -0
- data/lib/carat/cli/update.rb +73 -0
- data/lib/carat/cli/viz.rb +27 -0
- data/lib/carat/constants.rb +5 -0
- data/lib/carat/current_ruby.rb +183 -0
- data/lib/carat/definition.rb +628 -0
- data/lib/carat/dep_proxy.rb +43 -0
- data/lib/carat/dependency.rb +110 -0
- data/lib/carat/deployment.rb +59 -0
- data/lib/carat/deprecate.rb +15 -0
- data/lib/carat/dsl.rb +331 -0
- data/lib/carat/endpoint_specification.rb +76 -0
- data/lib/carat/env.rb +75 -0
- data/lib/carat/environment.rb +42 -0
- data/lib/carat/fetcher.rb +423 -0
- data/lib/carat/friendly_errors.rb +85 -0
- data/lib/carat/gem_helper.rb +180 -0
- data/lib/carat/gem_helpers.rb +26 -0
- data/lib/carat/gem_installer.rb +9 -0
- data/lib/carat/gem_path_manipulation.rb +8 -0
- data/lib/carat/gem_tasks.rb +2 -0
- data/lib/carat/graph.rb +169 -0
- data/lib/carat/index.rb +197 -0
- data/lib/carat/injector.rb +64 -0
- data/lib/carat/installer.rb +339 -0
- data/lib/carat/lazy_specification.rb +83 -0
- data/lib/carat/lockfile_parser.rb +167 -0
- data/lib/carat/match_platform.rb +13 -0
- data/lib/carat/psyched_yaml.rb +26 -0
- data/lib/carat/remote_specification.rb +57 -0
- data/lib/carat/resolver.rb +334 -0
- data/lib/carat/retry.rb +60 -0
- data/lib/carat/ruby_dsl.rb +11 -0
- data/lib/carat/ruby_version.rb +117 -0
- data/lib/carat/rubygems_ext.rb +170 -0
- data/lib/carat/rubygems_integration.rb +619 -0
- data/lib/carat/runtime.rb +289 -0
- data/lib/carat/settings.rb +208 -0
- data/lib/carat/setup.rb +24 -0
- data/lib/carat/shared_helpers.rb +149 -0
- data/lib/carat/similarity_detector.rb +63 -0
- data/lib/carat/source.rb +46 -0
- data/lib/carat/source/git.rb +294 -0
- data/lib/carat/source/git/git_proxy.rb +162 -0
- data/lib/carat/source/path.rb +226 -0
- data/lib/carat/source/path/installer.rb +43 -0
- data/lib/carat/source/rubygems.rb +381 -0
- data/lib/carat/source_list.rb +101 -0
- data/lib/carat/spec_set.rb +154 -0
- data/lib/carat/ssl_certs/.document +1 -0
- data/lib/carat/ssl_certs/AddTrustExternalCARoot-2048.pem +25 -0
- data/lib/carat/ssl_certs/AddTrustExternalCARoot.pem +32 -0
- data/lib/carat/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/carat/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/carat/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/carat/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/carat/ssl_certs/certificate_manager.rb +66 -0
- data/lib/carat/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/carat/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/carat/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
- data/lib/carat/templates/Executable +16 -0
- data/lib/carat/templates/Executable.standalone +12 -0
- data/lib/carat/templates/Gemfile +4 -0
- data/lib/carat/templates/newgem/.travis.yml.tt +3 -0
- data/lib/carat/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
- data/lib/carat/templates/newgem/Gemfile.tt +4 -0
- data/lib/carat/templates/newgem/LICENSE.txt.tt +21 -0
- data/lib/carat/templates/newgem/README.md.tt +39 -0
- data/lib/carat/templates/newgem/Rakefile.tt +25 -0
- data/lib/carat/templates/newgem/bin/console.tt +14 -0
- data/lib/carat/templates/newgem/bin/setup.tt +7 -0
- data/lib/carat/templates/newgem/exe/newgem.tt +3 -0
- data/lib/carat/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/carat/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/carat/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/carat/templates/newgem/gitignore.tt +16 -0
- data/lib/carat/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/carat/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/carat/templates/newgem/newgem.gemspec.tt +43 -0
- data/lib/carat/templates/newgem/rspec.tt +2 -0
- data/lib/carat/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/carat/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/carat/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/carat/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/carat/ui.rb +7 -0
- data/lib/carat/ui/rg_proxy.rb +21 -0
- data/lib/carat/ui/shell.rb +103 -0
- data/lib/carat/ui/silent.rb +44 -0
- data/lib/carat/vendor/molinillo/lib/molinillo.rb +5 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/dependency_graph.rb +266 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/errors.rb +69 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/gem_metadata.rb +3 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +90 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/modules/ui.rb +63 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/resolution.rb +415 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/resolver.rb +43 -0
- data/lib/carat/vendor/molinillo/lib/molinillo/state.rb +43 -0
- data/lib/carat/vendor/net/http/faster.rb +26 -0
- data/lib/carat/vendor/net/http/persistent.rb +1230 -0
- data/lib/carat/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/carat/vendor/thor/lib/thor.rb +484 -0
- data/lib/carat/vendor/thor/lib/thor/actions.rb +319 -0
- data/lib/carat/vendor/thor/lib/thor/actions/create_file.rb +103 -0
- data/lib/carat/vendor/thor/lib/thor/actions/create_link.rb +59 -0
- data/lib/carat/vendor/thor/lib/thor/actions/directory.rb +118 -0
- data/lib/carat/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
- data/lib/carat/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
- data/lib/carat/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
- data/lib/carat/vendor/thor/lib/thor/base.rb +656 -0
- data/lib/carat/vendor/thor/lib/thor/command.rb +133 -0
- data/lib/carat/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/carat/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/carat/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/carat/vendor/thor/lib/thor/error.rb +32 -0
- data/lib/carat/vendor/thor/lib/thor/group.rb +281 -0
- data/lib/carat/vendor/thor/lib/thor/invocation.rb +178 -0
- data/lib/carat/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/lib/carat/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
- data/lib/carat/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/lib/carat/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/carat/vendor/thor/lib/thor/parser/argument.rb +73 -0
- data/lib/carat/vendor/thor/lib/thor/parser/arguments.rb +175 -0
- data/lib/carat/vendor/thor/lib/thor/parser/option.rb +125 -0
- data/lib/carat/vendor/thor/lib/thor/parser/options.rb +218 -0
- data/lib/carat/vendor/thor/lib/thor/rake_compat.rb +71 -0
- data/lib/carat/vendor/thor/lib/thor/runner.rb +322 -0
- data/lib/carat/vendor/thor/lib/thor/shell.rb +81 -0
- data/lib/carat/vendor/thor/lib/thor/shell/basic.rb +421 -0
- data/lib/carat/vendor/thor/lib/thor/shell/color.rb +149 -0
- data/lib/carat/vendor/thor/lib/thor/shell/html.rb +126 -0
- data/lib/carat/vendor/thor/lib/thor/util.rb +267 -0
- data/lib/carat/vendor/thor/lib/thor/version.rb +3 -0
- data/lib/carat/vendored_fileutils.rb +9 -0
- data/lib/carat/vendored_molinillo.rb +2 -0
- data/lib/carat/vendored_persistent.rb +11 -0
- data/lib/carat/vendored_thor.rb +3 -0
- data/lib/carat/version.rb +6 -0
- data/lib/carat/vlad.rb +11 -0
- data/lib/carat/worker.rb +73 -0
- data/man/carat-config.ronn +178 -0
- data/man/carat-exec.ronn +136 -0
- data/man/carat-install.ronn +383 -0
- data/man/carat-package.ronn +66 -0
- data/man/carat-platform.ronn +42 -0
- data/man/carat-update.ronn +188 -0
- data/man/carat.ronn +98 -0
- data/man/gemfile.5.ronn +473 -0
- data/man/index.txt +7 -0
- metadata +321 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
carat-package(1) -- Package your needed `.gem` files into your application
|
|
2
|
+
===========================================================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
|
|
6
|
+
`carat package`
|
|
7
|
+
|
|
8
|
+
## DESCRIPTION
|
|
9
|
+
|
|
10
|
+
Copy all of the `.gem` files needed to run the application into the
|
|
11
|
+
`vendor/cache` directory. In the future, when running [carat install(1)][carat-install],
|
|
12
|
+
use the gems in the cache in preference to the ones on `rubygems.org`.
|
|
13
|
+
|
|
14
|
+
## GIT AND PATH GEMS
|
|
15
|
+
|
|
16
|
+
Since Carat 1.2, the `carat package` command can also package `:git` and
|
|
17
|
+
`:path` dependencies besides .gem files. This needs to be explicitly enabled
|
|
18
|
+
via the `--all` option. Once used, the `--all` option will be remembered.
|
|
19
|
+
|
|
20
|
+
## SUPPORT FOR MULTIPLE PLATFORMS
|
|
21
|
+
|
|
22
|
+
When using gems that have different packages for different platforms, Carat
|
|
23
|
+
1.8 and newer support caching of gems for other platforms in `vendor/cache`.
|
|
24
|
+
This needs to be enabled via the `--all-platforms` option. This setting will be
|
|
25
|
+
remembered in your local carat configuration.
|
|
26
|
+
|
|
27
|
+
## REMOTE FETCHING
|
|
28
|
+
|
|
29
|
+
By default, if you simply run [carat install(1)][carat-install] after running
|
|
30
|
+
[carat package(1)][carat-package], carat will still connect to `rubygems.org`
|
|
31
|
+
to check whether a platform-specific gem exists for any of the gems
|
|
32
|
+
in `vendor/cache`.
|
|
33
|
+
|
|
34
|
+
For instance, consider this Gemfile(5):
|
|
35
|
+
|
|
36
|
+
source "https://rubygems.org"
|
|
37
|
+
|
|
38
|
+
gem "nokogiri"
|
|
39
|
+
|
|
40
|
+
If you run `carat package` under C Ruby, carat will retrieve
|
|
41
|
+
the version of `nokogiri` for the `"ruby"` platform. If you deploy
|
|
42
|
+
to JRuby and run `carat install`, carat is forced to check to
|
|
43
|
+
see whether a `"java"` platformed `nokogiri` exists.
|
|
44
|
+
|
|
45
|
+
Even though the `nokogiri` gem for the Ruby platform is
|
|
46
|
+
_technically_ acceptable on JRuby, it actually has a C extension
|
|
47
|
+
that does not run on JRuby. As a result, carat will, by default,
|
|
48
|
+
still connect to `rubygems.org` to check whether it has a version
|
|
49
|
+
of one of your gems more specific to your platform.
|
|
50
|
+
|
|
51
|
+
This problem is also not just limited to the `"java"` platform.
|
|
52
|
+
A similar (common) problem can happen when developing on Windows
|
|
53
|
+
and deploying to Linux, or even when developing on OSX and
|
|
54
|
+
deploying to Linux.
|
|
55
|
+
|
|
56
|
+
If you know for sure that the gems packaged in `vendor/cache`
|
|
57
|
+
are appropriate for the platform you are on, you can run
|
|
58
|
+
`carat install --local` to skip checking for more appropriate
|
|
59
|
+
gems, and just use the ones in `vendor/cache`.
|
|
60
|
+
|
|
61
|
+
One way to be sure that you have the right platformed versions
|
|
62
|
+
of all your gems is to run `carat package` on an identical
|
|
63
|
+
machine and check in the gems. For instance, you can run
|
|
64
|
+
`carat package` on an identical staging box during your
|
|
65
|
+
staging process, and check in the `vendor/cache` before
|
|
66
|
+
deploying to production.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
carat-platform(1) -- Displays platform compatibility information
|
|
2
|
+
=================================================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
|
|
6
|
+
`carat platform` [--ruby]
|
|
7
|
+
|
|
8
|
+
## DESCRIPTION
|
|
9
|
+
|
|
10
|
+
`platform` will display information from your Gemfile, Gemfile.lock, and Ruby
|
|
11
|
+
VM about your platform.
|
|
12
|
+
|
|
13
|
+
For instance, using this Gemfile(5):
|
|
14
|
+
|
|
15
|
+
source "https://rubygems.org"
|
|
16
|
+
|
|
17
|
+
ruby "1.9.3"
|
|
18
|
+
|
|
19
|
+
gem "rack"
|
|
20
|
+
|
|
21
|
+
If you run `carat platform` on Ruby 1.9.3, it will display the following output:
|
|
22
|
+
|
|
23
|
+
Your platform is: x86_64-linux
|
|
24
|
+
|
|
25
|
+
Your app has gems that work on these platforms:
|
|
26
|
+
* ruby
|
|
27
|
+
|
|
28
|
+
Your Gemfile specifies a Ruby version requirement:
|
|
29
|
+
* ruby 1.9.3
|
|
30
|
+
|
|
31
|
+
Your current platform satisfies the Ruby version requirement.
|
|
32
|
+
|
|
33
|
+
`platform` will list all the platforms in your `Gemfile.lock` as well as the
|
|
34
|
+
`ruby` directive if applicable from your Gemfile(5). It will also let you know
|
|
35
|
+
if the `ruby` directive requirement has been met. If `ruby` directive doesn't
|
|
36
|
+
match the running Ruby VM, it will tell you what part does not.
|
|
37
|
+
|
|
38
|
+
## OPTIONS
|
|
39
|
+
|
|
40
|
+
* `--ruby`:
|
|
41
|
+
It will just display the ruby directive information, so you don't have to
|
|
42
|
+
parse it from the Gemfile(5).
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
carat-update(1) -- Update your gems to the latest available versions
|
|
2
|
+
=====================================================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
|
|
6
|
+
`carat update` <*gems> [--group=NAME] [--source=NAME] [--local]
|
|
7
|
+
|
|
8
|
+
## DESCRIPTION
|
|
9
|
+
|
|
10
|
+
Update the gems specified (all gems, if none are specified), ignoring
|
|
11
|
+
the previously installed gems specified in the `Gemfile.lock`. In
|
|
12
|
+
general, you should use [carat install(1)][carat-install] to install the same exact
|
|
13
|
+
gems and versions across machines.
|
|
14
|
+
|
|
15
|
+
You would use `carat update` to explicitly update the version of a
|
|
16
|
+
gem.
|
|
17
|
+
|
|
18
|
+
## OPTIONS
|
|
19
|
+
|
|
20
|
+
* `--group=<name>`:
|
|
21
|
+
Only update the gems in the specified group. For instance, you can update all gems
|
|
22
|
+
in the development group with `carat update --group development`. You can also
|
|
23
|
+
call `carat update rails --group test` to update the rails gem and all gems in
|
|
24
|
+
the test group, for example.
|
|
25
|
+
|
|
26
|
+
* `--source=<name>`:
|
|
27
|
+
The name of a `:git` or `:path` source used in the Gemfile(5). For
|
|
28
|
+
instance, with a `:git` source of `http://github.com/rails/rails.git`,
|
|
29
|
+
you would call `carat update --source rails`
|
|
30
|
+
|
|
31
|
+
* `--local`:
|
|
32
|
+
Do not attempt to fetch gems remotely and use the gem cache instead.
|
|
33
|
+
|
|
34
|
+
## UPDATING ALL GEMS
|
|
35
|
+
|
|
36
|
+
If you run `carat update` with no parameters, carat will ignore
|
|
37
|
+
any previously installed gems and resolve all dependencies again
|
|
38
|
+
based on the latest versions of all gems available in the sources.
|
|
39
|
+
|
|
40
|
+
Consider the following Gemfile(5):
|
|
41
|
+
|
|
42
|
+
source "https://rubygems.org"
|
|
43
|
+
|
|
44
|
+
gem "rails", "3.0.0.rc"
|
|
45
|
+
gem "nokogiri"
|
|
46
|
+
|
|
47
|
+
When you run [carat install(1)][carat-install] the first time, carat will resolve
|
|
48
|
+
all of the dependencies, all the way down, and install what you need:
|
|
49
|
+
|
|
50
|
+
Fetching gem metadata from https://rubygems.org/.........
|
|
51
|
+
Resolving dependencies...
|
|
52
|
+
Installing builder 2.1.2
|
|
53
|
+
Installing abstract 1.0.0
|
|
54
|
+
Installing rack 1.2.8
|
|
55
|
+
Using carat 1.7.6
|
|
56
|
+
Installing rake 10.4.0
|
|
57
|
+
Installing polyglot 0.3.5
|
|
58
|
+
Installing mime-types 1.25.1
|
|
59
|
+
Installing i18n 0.4.2
|
|
60
|
+
Installing mini_portile 0.6.1
|
|
61
|
+
Installing tzinfo 0.3.42
|
|
62
|
+
Installing rack-mount 0.6.14
|
|
63
|
+
Installing rack-test 0.5.7
|
|
64
|
+
Installing treetop 1.4.15
|
|
65
|
+
Installing thor 0.14.6
|
|
66
|
+
Installing activesupport 3.0.0.rc
|
|
67
|
+
Installing erubis 2.6.6
|
|
68
|
+
Installing activemodel 3.0.0.rc
|
|
69
|
+
Installing arel 0.4.0
|
|
70
|
+
Installing mail 2.2.20
|
|
71
|
+
Installing activeresource 3.0.0.rc
|
|
72
|
+
Installing actionpack 3.0.0.rc
|
|
73
|
+
Installing activerecord 3.0.0.rc
|
|
74
|
+
Installing actionmailer 3.0.0.rc
|
|
75
|
+
Installing railties 3.0.0.rc
|
|
76
|
+
Installing rails 3.0.0.rc
|
|
77
|
+
Installing nokogiri 1.6.5
|
|
78
|
+
|
|
79
|
+
Bundle complete! 2 Gemfile dependencies, 26 gems total.
|
|
80
|
+
Use `carat show [gemname]` to see where a bundled gem is installed.
|
|
81
|
+
|
|
82
|
+
As you can see, even though you have just two gems in the Gemfile(5), your application
|
|
83
|
+
actually needs 26 different gems in order to run. Carat remembers the exact versions
|
|
84
|
+
it installed in `Gemfile.lock`. The next time you run [carat install(1)][carat-install], carat skips
|
|
85
|
+
the dependency resolution and installs the same gems as it installed last time.
|
|
86
|
+
|
|
87
|
+
After checking in the `Gemfile.lock` into version control and cloning it on another
|
|
88
|
+
machine, running [carat install(1)][carat-install] will _still_ install the gems that you installed
|
|
89
|
+
last time. You don't need to worry that a new release of `erubis` or `mail` changes
|
|
90
|
+
the gems you use.
|
|
91
|
+
|
|
92
|
+
However, from time to time, you might want to update the gems you are using to the
|
|
93
|
+
newest versions that still match the gems in your Gemfile(5).
|
|
94
|
+
|
|
95
|
+
To do this, run `carat update`, which will ignore the `Gemfile.lock`, and resolve
|
|
96
|
+
all the dependencies again. Keep in mind that this process can result in a significantly
|
|
97
|
+
different set of the 25 gems, based on the requirements of new gems that the gem
|
|
98
|
+
authors released since the last time you ran `carat update`.
|
|
99
|
+
|
|
100
|
+
## UPDATING A LIST OF GEMS
|
|
101
|
+
|
|
102
|
+
Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the
|
|
103
|
+
gems that you specified locked to the versions in the `Gemfile.lock`.
|
|
104
|
+
|
|
105
|
+
For instance, in the scenario above, imagine that `nokogiri` releases version `1.4.4`, and
|
|
106
|
+
you want to update it _without_ updating Rails and all of its dependencies. To do this,
|
|
107
|
+
run `carat update nokogiri`.
|
|
108
|
+
|
|
109
|
+
Carat will update `nokogiri` and any of its dependencies, but leave alone Rails and
|
|
110
|
+
its dependencies.
|
|
111
|
+
|
|
112
|
+
## OVERLAPPING DEPENDENCIES
|
|
113
|
+
|
|
114
|
+
Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same
|
|
115
|
+
second-level dependency. For instance, consider the case of `thin` and
|
|
116
|
+
`rack-perftools-profiler`.
|
|
117
|
+
|
|
118
|
+
source "https://rubygems.org"
|
|
119
|
+
|
|
120
|
+
gem "thin"
|
|
121
|
+
gem "rack-perftools-profiler"
|
|
122
|
+
|
|
123
|
+
The `thin` gem depends on `rack >= 1.0`, while `rack-perftools-profiler` depends
|
|
124
|
+
on `rack ~> 1.0`. If you run carat install, you get:
|
|
125
|
+
|
|
126
|
+
Fetching source index for https://rubygems.org/
|
|
127
|
+
Installing daemons (1.1.0)
|
|
128
|
+
Installing eventmachine (0.12.10) with native extensions
|
|
129
|
+
Installing open4 (1.0.1)
|
|
130
|
+
Installing perftools.rb (0.4.7) with native extensions
|
|
131
|
+
Installing rack (1.2.1)
|
|
132
|
+
Installing rack-perftools_profiler (0.0.2)
|
|
133
|
+
Installing thin (1.2.7) with native extensions
|
|
134
|
+
Using carat (1.0.0.rc.3)
|
|
135
|
+
|
|
136
|
+
In this case, the two gems have their own set of dependencies, but they share
|
|
137
|
+
`rack` in common. If you run `carat update thin`, carat will update `daemons`,
|
|
138
|
+
`eventmachine` and `rack`, which are dependencies of `thin`, but not `open4` or
|
|
139
|
+
`perftools.rb`, which are dependencies of `rack-perftools_profiler`. Note that
|
|
140
|
+
`carat update thin` will update `rack` even though it's _also_ a dependency of
|
|
141
|
+
`rack-perftools_profiler`.
|
|
142
|
+
|
|
143
|
+
`In short`, when you update a gem using `carat update`, carat will update all
|
|
144
|
+
dependencies of that gem, including those that are also dependencies of another gem.
|
|
145
|
+
|
|
146
|
+
In this scenario, updating the `thin` version manually in the Gemfile(5),
|
|
147
|
+
and then running [carat install(1)][carat-install] will only update `daemons` and `eventmachine`,
|
|
148
|
+
but not `rack`. For more information, see the `CONSERVATIVE UPDATING` section
|
|
149
|
+
of [carat install(1)][carat-install].
|
|
150
|
+
|
|
151
|
+
## RECOMMENDED WORKFLOW
|
|
152
|
+
|
|
153
|
+
In general, when working with an application managed with carat, you should
|
|
154
|
+
use the following workflow:
|
|
155
|
+
|
|
156
|
+
* After you create your Gemfile(5) for the first time, run
|
|
157
|
+
|
|
158
|
+
$ carat install
|
|
159
|
+
|
|
160
|
+
* Check the resulting `Gemfile.lock` into version control
|
|
161
|
+
|
|
162
|
+
$ git add Gemfile.lock
|
|
163
|
+
|
|
164
|
+
* When checking out this repository on another development machine, run
|
|
165
|
+
|
|
166
|
+
$ carat install
|
|
167
|
+
|
|
168
|
+
* When checking out this repository on a deployment machine, run
|
|
169
|
+
|
|
170
|
+
$ carat install --deployment
|
|
171
|
+
|
|
172
|
+
* After changing the Gemfile(5) to reflect a new or update dependency, run
|
|
173
|
+
|
|
174
|
+
$ carat install
|
|
175
|
+
|
|
176
|
+
* Make sure to check the updated `Gemfile.lock` into version control
|
|
177
|
+
|
|
178
|
+
$ git add Gemfile.lock
|
|
179
|
+
|
|
180
|
+
* If [carat install(1)][carat-install] reports a conflict, manually update the specific
|
|
181
|
+
gems that you changed in the Gemfile(5)
|
|
182
|
+
|
|
183
|
+
$ carat update rails thin
|
|
184
|
+
|
|
185
|
+
* If you want to update all the gems to the latest possible versions that
|
|
186
|
+
still match the gems listed in the Gemfile(5), run
|
|
187
|
+
|
|
188
|
+
$ carat update
|
data/man/carat.ronn
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
carat(1) -- Ruby Dependency Management
|
|
2
|
+
=======================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
|
|
6
|
+
`carat` COMMAND [--no-color] [--verbose] [ARGS]
|
|
7
|
+
|
|
8
|
+
## DESCRIPTION
|
|
9
|
+
|
|
10
|
+
Carat manages an `application's dependencies` through its entire life
|
|
11
|
+
across many machines systematically and repeatably.
|
|
12
|
+
|
|
13
|
+
See [the carat website](https://github.com/caratrb/carat) for information on getting
|
|
14
|
+
started, and Gemfile(5) for more information on the `Gemfile` format.
|
|
15
|
+
|
|
16
|
+
## OPTIONS
|
|
17
|
+
|
|
18
|
+
* `--no-color`:
|
|
19
|
+
Prints all output without color
|
|
20
|
+
|
|
21
|
+
* `--verbose`:
|
|
22
|
+
Prints out additional logging information
|
|
23
|
+
|
|
24
|
+
## BUNDLE COMMANDS
|
|
25
|
+
|
|
26
|
+
We divide `carat` subcommands into primary commands and utilities.
|
|
27
|
+
|
|
28
|
+
## PRIMARY COMMANDS
|
|
29
|
+
|
|
30
|
+
* [carat install(1)][carat-install]:
|
|
31
|
+
Install the gems specified by the `Gemfile` or `Gemfile.lock`
|
|
32
|
+
|
|
33
|
+
* [carat update(1)][carat-update]:
|
|
34
|
+
Update dependencies to their latest versions
|
|
35
|
+
|
|
36
|
+
* [carat package(1)][carat-package]:
|
|
37
|
+
Package the .gem files required by your application into the
|
|
38
|
+
`vendor/cache` directory
|
|
39
|
+
|
|
40
|
+
* [carat exec(1)][carat-exec]:
|
|
41
|
+
Execute a script in the context of the current carat
|
|
42
|
+
|
|
43
|
+
* [carat config(1)][carat-config]:
|
|
44
|
+
Specify and read configuration options for carat
|
|
45
|
+
|
|
46
|
+
* `carat help(1)`:
|
|
47
|
+
Displays detailed help for each subcommand
|
|
48
|
+
|
|
49
|
+
## UTILITIES
|
|
50
|
+
|
|
51
|
+
* `carat check(1)`:
|
|
52
|
+
Determine whether the requirements for your application are installed
|
|
53
|
+
and available to carat
|
|
54
|
+
|
|
55
|
+
* `carat list(1)`:
|
|
56
|
+
Show all of the gems in the current carat
|
|
57
|
+
|
|
58
|
+
* `carat show(1)`:
|
|
59
|
+
Show the source location of a particular gem in the carat
|
|
60
|
+
|
|
61
|
+
* `carat outdated(1)`:
|
|
62
|
+
Show all of the outdated gems in the current carat
|
|
63
|
+
|
|
64
|
+
* `carat console(1)`:
|
|
65
|
+
Start an IRB session in the context of the current carat
|
|
66
|
+
|
|
67
|
+
* `carat open(1)`:
|
|
68
|
+
Open an installed gem in the editor
|
|
69
|
+
|
|
70
|
+
* `carat viz(1)`:
|
|
71
|
+
Generate a visual representation of your dependencies
|
|
72
|
+
|
|
73
|
+
* `carat init(1)`:
|
|
74
|
+
Generate a simple `Gemfile`, placed in the current directory
|
|
75
|
+
|
|
76
|
+
* `carat gem(1)`:
|
|
77
|
+
Create a simple gem, suitable for development with carat
|
|
78
|
+
|
|
79
|
+
* [carat platform(1)][carat-platform]:
|
|
80
|
+
Displays platform compatibility information
|
|
81
|
+
|
|
82
|
+
* `carat clean(1)`:
|
|
83
|
+
Cleans up unused gems in your carat directory
|
|
84
|
+
|
|
85
|
+
## PLUGINS
|
|
86
|
+
|
|
87
|
+
When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES,
|
|
88
|
+
Carat will try to find an executable on your path named `carat-<command>`
|
|
89
|
+
and execute it, passing down any extra arguments to it.
|
|
90
|
+
|
|
91
|
+
## OBSOLETE
|
|
92
|
+
|
|
93
|
+
These commands are obsolete and should no longer be used
|
|
94
|
+
|
|
95
|
+
* `carat lock(1)`
|
|
96
|
+
* `carat unlock(1)`
|
|
97
|
+
* `carat cache(1)`
|
|
98
|
+
|
data/man/gemfile.5.ronn
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
Gemfile(5) -- A format for describing gem dependencies for Ruby programs
|
|
2
|
+
========================================================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
|
|
6
|
+
A `Gemfile` describes the gem dependencies required to execute associated
|
|
7
|
+
Ruby code.
|
|
8
|
+
|
|
9
|
+
Place the `Gemfile` in the root of the directory containing the associated
|
|
10
|
+
code. For instance, in a Rails application, place the `Gemfile` in the same
|
|
11
|
+
directory as the `Rakefile`.
|
|
12
|
+
|
|
13
|
+
## SYNTAX
|
|
14
|
+
|
|
15
|
+
A `Gemfile` is evaluated as Ruby code, in a context which makes available
|
|
16
|
+
a number of methods used to describe the gem requirements.
|
|
17
|
+
|
|
18
|
+
## GLOBAL SOURCES (#source)
|
|
19
|
+
|
|
20
|
+
At the top of the `Gemfile`, add a line for the `Rubygems` source that contains
|
|
21
|
+
the gems listed in the `Gemfile`.
|
|
22
|
+
|
|
23
|
+
source "https://rubygems.org"
|
|
24
|
+
|
|
25
|
+
It is possible, but not recommended as of Carat 1.7, to add multiple global
|
|
26
|
+
`source` lines. Each of these `source`s `MUST` be a valid Rubygems repository.
|
|
27
|
+
|
|
28
|
+
Sources are checked for gems following the heuristics described in
|
|
29
|
+
[SOURCE PRIORITY][]. If a gem is found in more than one global source, Carat
|
|
30
|
+
will print a warning after installing the gem indicating which source was used,
|
|
31
|
+
and listing the other sources where the gem is available. A specific source can
|
|
32
|
+
be selected for gems that need to use a non-standard repository, suppressing
|
|
33
|
+
this warning, by using the [`:source` option](#SOURCE-source-) or a
|
|
34
|
+
[`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
|
|
35
|
+
|
|
36
|
+
### CREDENTIALS (#credentials)
|
|
37
|
+
|
|
38
|
+
Some gem sources require a username and password. Use `carat config` to set
|
|
39
|
+
the username and password for any sources that need it. The command must be run
|
|
40
|
+
once on each computer that will install the Gemfile, but this keeps the
|
|
41
|
+
credentials from being stored in plain text in version control.
|
|
42
|
+
|
|
43
|
+
carat config gems.example.com user:password
|
|
44
|
+
|
|
45
|
+
For some sources, like a company Gemfury account, it may be easier to simply
|
|
46
|
+
include the credentials in the Gemfile as part of the source URL.
|
|
47
|
+
|
|
48
|
+
source "https://user:password@gems.example.com"
|
|
49
|
+
|
|
50
|
+
Credentials in the source URL will take precedence over credentials set using
|
|
51
|
+
`config`.
|
|
52
|
+
|
|
53
|
+
## RUBY (#ruby)
|
|
54
|
+
|
|
55
|
+
If your application requires a specific Ruby version or engine, specify your
|
|
56
|
+
requirements using the `ruby` method, with the following arguments.
|
|
57
|
+
All parameters are `OPTIONAL` unless otherwise specified.
|
|
58
|
+
|
|
59
|
+
### VERSION (required)
|
|
60
|
+
|
|
61
|
+
The version of Ruby that your application requires. If your application
|
|
62
|
+
requires an alternate Ruby engine, such as JRuby or Rubinius, this should be
|
|
63
|
+
the Ruby version that the engine is compatible with.
|
|
64
|
+
|
|
65
|
+
ruby "1.9.3"
|
|
66
|
+
|
|
67
|
+
### ENGINE (:engine)
|
|
68
|
+
|
|
69
|
+
Each application _may_ specify a Ruby engine. If an engine is specified, an
|
|
70
|
+
engine version _must_ also be specified.
|
|
71
|
+
|
|
72
|
+
### ENGINE VERSION (:engine_version)
|
|
73
|
+
|
|
74
|
+
Each application _may_ specify a Ruby engine version. If an engine version is
|
|
75
|
+
specified, an engine _must_ also be specified. If the engine is "ruby" the
|
|
76
|
+
engine version specified _must_ match the Ruby version.
|
|
77
|
+
|
|
78
|
+
ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
|
|
79
|
+
|
|
80
|
+
### PATCHLEVEL (:patchlevel)
|
|
81
|
+
|
|
82
|
+
Each application _may_ specify a Ruby patchlevel.
|
|
83
|
+
|
|
84
|
+
ruby "2.0.0", :patchlevel => "247"
|
|
85
|
+
|
|
86
|
+
## GEMS (#gem)
|
|
87
|
+
|
|
88
|
+
Specify gem requirements using the `gem` method, with the following arguments.
|
|
89
|
+
All parameters are `OPTIONAL` unless otherwise specified.
|
|
90
|
+
|
|
91
|
+
### NAME (required)
|
|
92
|
+
|
|
93
|
+
For each gem requirement, list a single _gem_ line.
|
|
94
|
+
|
|
95
|
+
gem "nokogiri"
|
|
96
|
+
|
|
97
|
+
### VERSION
|
|
98
|
+
|
|
99
|
+
Each _gem_ `MAY` have one or more version specifiers.
|
|
100
|
+
|
|
101
|
+
gem "nokogiri", ">= 1.4.2"
|
|
102
|
+
gem "RedCloth", ">= 4.1.0", "< 4.2.0"
|
|
103
|
+
|
|
104
|
+
### REQUIRE AS (:require)
|
|
105
|
+
|
|
106
|
+
Each _gem_ `MAY` specify files that should be used when autorequiring via
|
|
107
|
+
`Carat.require`. You may pass an array with multiple files or `true` if file
|
|
108
|
+
you want `required` has same name as _gem_ or `false` to
|
|
109
|
+
prevent any file from being autorequired.
|
|
110
|
+
|
|
111
|
+
gem "redis", :require => ["redis/connection/hiredis", "redis"]
|
|
112
|
+
gem "webmock", :require => false
|
|
113
|
+
gem "debugger", :require => true
|
|
114
|
+
|
|
115
|
+
The argument defaults to the name of the gem. For example, these are identical:
|
|
116
|
+
|
|
117
|
+
gem "nokogiri"
|
|
118
|
+
gem "nokogiri", :require => "nokogiri"
|
|
119
|
+
gem "nokogiri", :require => true
|
|
120
|
+
|
|
121
|
+
### GROUPS (:group or :groups)
|
|
122
|
+
|
|
123
|
+
Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
|
|
124
|
+
not specify membership in any group is placed in the `default` group.
|
|
125
|
+
|
|
126
|
+
gem "rspec", :group => :test
|
|
127
|
+
gem "wirble", :groups => [:development, :test]
|
|
128
|
+
|
|
129
|
+
The Carat runtime allows its two main methods, `Carat.setup` and
|
|
130
|
+
`Carat.require`, to limit their impact to particular groups.
|
|
131
|
+
|
|
132
|
+
# setup adds gems to Ruby's load path
|
|
133
|
+
Carat.setup # defaults to all groups
|
|
134
|
+
require "carat/setup" # same as Carat.setup
|
|
135
|
+
Carat.setup(:default) # only set up the _default_ group
|
|
136
|
+
Carat.setup(:test) # only set up the _test_ group (but `not` _default_)
|
|
137
|
+
Carat.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
|
|
138
|
+
|
|
139
|
+
# require requires all of the gems in the specified groups
|
|
140
|
+
Carat.require # defaults to just the _default_ group
|
|
141
|
+
Carat.require(:default) # identical
|
|
142
|
+
Carat.require(:default, :test) # requires the _default_ and _test_ groups
|
|
143
|
+
Carat.require(:test) # requires just the _test_ group
|
|
144
|
+
|
|
145
|
+
The Carat CLI allows you to specify a list of groups whose gems `carat install` should
|
|
146
|
+
not install with the `--without` option. To specify multiple groups to ignore, specify a
|
|
147
|
+
list of groups separated by spaces.
|
|
148
|
+
|
|
149
|
+
carat install --without test
|
|
150
|
+
carat install --without development test
|
|
151
|
+
|
|
152
|
+
After running `carat install --without test`, carat will remember that you excluded
|
|
153
|
+
the test group in the last installation. The next time you run `carat install`,
|
|
154
|
+
without any `--without option`, carat will recall it.
|
|
155
|
+
|
|
156
|
+
Also, calling `Carat.setup` with no parameters, or calling `require "carat/setup"`
|
|
157
|
+
will setup all groups except for the ones you excluded via `--without` (since they
|
|
158
|
+
are obviously not available).
|
|
159
|
+
|
|
160
|
+
Note that on `carat install`, carat downloads and evaluates all gems, in order to
|
|
161
|
+
create a single canonical list of all of the required gems and their dependencies.
|
|
162
|
+
This means that you cannot list different versions of the same gems in different
|
|
163
|
+
groups. For more details, see [Understanding Carat](http://carat.io/rationale.html).
|
|
164
|
+
|
|
165
|
+
### PLATFORMS (:platforms)
|
|
166
|
+
|
|
167
|
+
If a gem should only be used in a particular platform or set of platforms, you can
|
|
168
|
+
specify them. Platforms are essentially identical to groups, except that you do not
|
|
169
|
+
need to use the `--without` install-time flag to exclude groups of gems for other
|
|
170
|
+
platforms.
|
|
171
|
+
|
|
172
|
+
There are a number of `Gemfile` platforms:
|
|
173
|
+
|
|
174
|
+
* `ruby`:
|
|
175
|
+
C Ruby (MRI) or Rubinius, but `NOT` Windows
|
|
176
|
+
* `ruby_18`:
|
|
177
|
+
_ruby_ `AND` version 1.8
|
|
178
|
+
* `ruby_19`:
|
|
179
|
+
_ruby_ `AND` version 1.9
|
|
180
|
+
* `ruby_20`:
|
|
181
|
+
_ruby_ `AND` version 2.0
|
|
182
|
+
* `ruby_21`:
|
|
183
|
+
_ruby_ `AND` version 2.1
|
|
184
|
+
* `ruby_22`:
|
|
185
|
+
_ruby_ `AND` version 2.2
|
|
186
|
+
* `mri`:
|
|
187
|
+
Same as _ruby_, but not Rubinius
|
|
188
|
+
* `mri_18`:
|
|
189
|
+
_mri_ `AND` version 1.8
|
|
190
|
+
* `mri_19`:
|
|
191
|
+
_mri_ `AND` version 1.9
|
|
192
|
+
* `mri_20`:
|
|
193
|
+
_mri_ `AND` version 2.0
|
|
194
|
+
* `mri_21`:
|
|
195
|
+
_mri_ `AND` version 2.1
|
|
196
|
+
* `mri_22`:
|
|
197
|
+
_mri_ `AND` version 2.2
|
|
198
|
+
* `rbx`:
|
|
199
|
+
Same as _ruby_, but only Rubinius (not MRI)
|
|
200
|
+
* `jruby`:
|
|
201
|
+
JRuby
|
|
202
|
+
* `mswin`:
|
|
203
|
+
Windows
|
|
204
|
+
* `mingw`:
|
|
205
|
+
Windows 32 bit 'mingw32' platform (aka RubyInstaller)
|
|
206
|
+
* `mingw_18`:
|
|
207
|
+
_mingw_ `AND` version 1.8
|
|
208
|
+
* `mingw_19`:
|
|
209
|
+
_mingw_ `AND` version 1.9
|
|
210
|
+
* `mingw_20`:
|
|
211
|
+
_mingw_ `AND` version 2.0
|
|
212
|
+
* `mingw_21`:
|
|
213
|
+
_mingw_ `AND` version 2.1
|
|
214
|
+
* `mingw_22`:
|
|
215
|
+
_mingw_ `AND` version 2.2
|
|
216
|
+
* `x64_mingw`:
|
|
217
|
+
Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
|
|
218
|
+
* `x64_mingw_20`:
|
|
219
|
+
_x64_mingw_ `AND` version 2.0
|
|
220
|
+
* `x64_mingw_21`:
|
|
221
|
+
_x64_mingw_ `AND` version 2.1
|
|
222
|
+
* `x64_mingw_22`:
|
|
223
|
+
_x64_mingw_ `AND` version 2.2
|
|
224
|
+
|
|
225
|
+
As with groups, you can specify one or more platforms:
|
|
226
|
+
|
|
227
|
+
gem "weakling", :platforms => :jruby
|
|
228
|
+
gem "ruby-debug", :platforms => :mri_18
|
|
229
|
+
gem "nokogiri", :platforms => [:mri_18, :jruby]
|
|
230
|
+
|
|
231
|
+
All operations involving groups (`carat install`, `Carat.setup`,
|
|
232
|
+
`Carat.require`) behave exactly the same as if any groups not
|
|
233
|
+
matching the current platform were explicitly excluded.
|
|
234
|
+
|
|
235
|
+
### SOURCE (:source)
|
|
236
|
+
|
|
237
|
+
You can select an alternate Rubygems repository for a gem using the ':source'
|
|
238
|
+
option.
|
|
239
|
+
|
|
240
|
+
gem "some_internal_gem", :source => "https://gems.example.com"
|
|
241
|
+
|
|
242
|
+
This forces the gem to be loaded from this source and ignores any global sources
|
|
243
|
+
declared at the top level of the file. If the gem does not exist in this source,
|
|
244
|
+
it will not be installed.
|
|
245
|
+
|
|
246
|
+
Carat will search for child dependencies of this gem by first looking in the
|
|
247
|
+
source selected for the parent, but if they are not found there, it will fall
|
|
248
|
+
back on global sources using the ordering described in [SOURCE PRIORITY][].
|
|
249
|
+
|
|
250
|
+
Selecting a specific source repository this way also suppresses the ambiguous
|
|
251
|
+
gem warning described above in
|
|
252
|
+
[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES-source-).
|
|
253
|
+
|
|
254
|
+
### GIT (:git)
|
|
255
|
+
|
|
256
|
+
If necessary, you can specify that a gem is located at a particular
|
|
257
|
+
git repository using the `:git` parameter. The repository can be accessed via
|
|
258
|
+
several protocols:
|
|
259
|
+
|
|
260
|
+
* `HTTP(S)`:
|
|
261
|
+
gem "rails", :git => "https://github.com/rails/rails.git"
|
|
262
|
+
* `SSH`:
|
|
263
|
+
gem "rails", :git => "git@github.com:rails/rails.git"
|
|
264
|
+
* `git`:
|
|
265
|
+
gem "rails", :git => "git://github.com/rails/rails.git"
|
|
266
|
+
|
|
267
|
+
If using SSH, the user that you use to run `carat install` `MUST` have the
|
|
268
|
+
appropriate keys available in their `$HOME/.ssh`.
|
|
269
|
+
|
|
270
|
+
`NOTE`: `http://` and `git://` URLs should be avoided if at all possible. These
|
|
271
|
+
protocols are unauthenticated, so a man-in-the-middle attacker can deliver
|
|
272
|
+
malicious code and compromise your system. HTTPS and SSH are strongly
|
|
273
|
+
preferred.
|
|
274
|
+
|
|
275
|
+
The `group`, `platforms`, and `require` options are available and behave
|
|
276
|
+
exactly the same as they would for a normal gem.
|
|
277
|
+
|
|
278
|
+
A git repository `SHOULD` have at least one file, at the root of the
|
|
279
|
+
directory containing the gem, with the extension `.gemspec`. This file
|
|
280
|
+
`MUST` contain a valid gem specification, as expected by the `gem build`
|
|
281
|
+
command.
|
|
282
|
+
|
|
283
|
+
If a git repository does not have a `.gemspec`, carat will attempt to
|
|
284
|
+
create one, but it will not contain any dependencies, executables, or
|
|
285
|
+
C extension compilation instructions. As a result, it may fail to properly
|
|
286
|
+
integrate into your application.
|
|
287
|
+
|
|
288
|
+
If a git repository does have a `.gemspec` for the gem you attached it
|
|
289
|
+
to, a version specifier, if provided, means that the git repository is
|
|
290
|
+
only valid if the `.gemspec` specifies a version matching the version
|
|
291
|
+
specifier. If not, carat will print a warning.
|
|
292
|
+
|
|
293
|
+
gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git"
|
|
294
|
+
# carat install will fail, because the .gemspec in the rails
|
|
295
|
+
# repository's master branch specifies version 3.0.0
|
|
296
|
+
|
|
297
|
+
If a git repository does `not` have a `.gemspec` for the gem you attached
|
|
298
|
+
it to, a version specifier `MUST` be provided. Carat will use this
|
|
299
|
+
version in the simple `.gemspec` it creates.
|
|
300
|
+
|
|
301
|
+
Git repositories support a number of additional options.
|
|
302
|
+
|
|
303
|
+
* `branch`, `tag`, and `ref`:
|
|
304
|
+
You `MUST` only specify at most one of these options. The default
|
|
305
|
+
is `:branch => "master"`
|
|
306
|
+
* `submodules`:
|
|
307
|
+
Specify `:submodules => true` to cause carat to expand any
|
|
308
|
+
submodules included in the git repository
|
|
309
|
+
|
|
310
|
+
If a git repository contains multiple `.gemspecs`, each `.gemspec`
|
|
311
|
+
represents a gem located at the same place in the file system as
|
|
312
|
+
the `.gemspec`.
|
|
313
|
+
|
|
314
|
+
|~rails [git root]
|
|
315
|
+
| |-rails.gemspec [rails gem located here]
|
|
316
|
+
|~actionpack
|
|
317
|
+
| |-actionpack.gemspec [actionpack gem located here]
|
|
318
|
+
|~activesupport
|
|
319
|
+
| |-activesupport.gemspec [activesupport gem located here]
|
|
320
|
+
|...
|
|
321
|
+
|
|
322
|
+
To install a gem located in a git repository, carat changes to
|
|
323
|
+
the directory containing the gemspec, runs `gem build name.gemspec`
|
|
324
|
+
and then installs the resulting gem. The `gem build` command,
|
|
325
|
+
which comes standard with Rubygems, evaluates the `.gemspec` in
|
|
326
|
+
the context of the directory in which it is located.
|
|
327
|
+
|
|
328
|
+
### GIT SOURCE (:git_source)
|
|
329
|
+
|
|
330
|
+
A custom git source can be defined via the `git_source` method. Provide the source's name
|
|
331
|
+
as an argument, and a block which receives a single argument and interpolates it into a
|
|
332
|
+
string to return the full repo address:
|
|
333
|
+
|
|
334
|
+
git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
|
|
335
|
+
gem 'rails', :stash => 'forks/rails'
|
|
336
|
+
|
|
337
|
+
In addition, if you wish to choose a specific branch:
|
|
338
|
+
|
|
339
|
+
gem "rails", :stash => "forks/rails", :branch => "branch_name"
|
|
340
|
+
|
|
341
|
+
### GITHUB (:github)
|
|
342
|
+
|
|
343
|
+
`NOTE`: This shorthand should be avoided until Carat 2.0, since it
|
|
344
|
+
currently expands to an insecure `git://` URL. This allows a
|
|
345
|
+
man-in-the-middle attacker to compromise your system.
|
|
346
|
+
|
|
347
|
+
If the git repository you want to use is hosted on GitHub and is public, you can use the
|
|
348
|
+
:github shorthand to specify just the github username and repository name (without the
|
|
349
|
+
trailing ".git"), separated by a slash. If both the username and repository name are the
|
|
350
|
+
same, you can omit one.
|
|
351
|
+
|
|
352
|
+
gem "rails", :github => "rails/rails"
|
|
353
|
+
gem "rails", :github => "rails"
|
|
354
|
+
|
|
355
|
+
Are both equivalent to
|
|
356
|
+
|
|
357
|
+
gem "rails", :git => "git://github.com/rails/rails.git"
|
|
358
|
+
|
|
359
|
+
Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument.
|
|
360
|
+
|
|
361
|
+
### GIST (:gist)
|
|
362
|
+
|
|
363
|
+
If the git repository you want to use is hosted as a Github Gist and is public, you can use
|
|
364
|
+
the :gist shorthand to specify just the gist identifier (without the trailing ".git").
|
|
365
|
+
|
|
366
|
+
gem "the_hatch", :gist => "4815162342"
|
|
367
|
+
|
|
368
|
+
Is equivalent to:
|
|
369
|
+
|
|
370
|
+
gem "the_hatch", :git => "https://gist.github.com/4815162342.git"
|
|
371
|
+
|
|
372
|
+
Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument.
|
|
373
|
+
|
|
374
|
+
### BITBUCKET (:bitbucket)
|
|
375
|
+
|
|
376
|
+
If the git repository you want to use is hosted on Bitbucket and is public, you can use the
|
|
377
|
+
:bitbucket shorthand to specify just the bitbucket username and repository name (without the
|
|
378
|
+
trailing ".git"), separated by a slash. If both the username and repository name are the
|
|
379
|
+
same, you can omit one.
|
|
380
|
+
|
|
381
|
+
gem "rails", :bitbucket => "rails/rails"
|
|
382
|
+
gem "rails", :bitbucket => "rails"
|
|
383
|
+
|
|
384
|
+
Are both equivalent to
|
|
385
|
+
|
|
386
|
+
gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git"
|
|
387
|
+
|
|
388
|
+
Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument.
|
|
389
|
+
|
|
390
|
+
### PATH (:path)
|
|
391
|
+
|
|
392
|
+
You can specify that a gem is located in a particular location
|
|
393
|
+
on the file system. Relative paths are resolved relative to the
|
|
394
|
+
directory containing the `Gemfile`.
|
|
395
|
+
|
|
396
|
+
Similar to the semantics of the `:git` option, the `:path`
|
|
397
|
+
option requires that the directory in question either contains
|
|
398
|
+
a `.gemspec` for the gem, or that you specify an explicit
|
|
399
|
+
version that carat should use.
|
|
400
|
+
|
|
401
|
+
Unlike `:git`, carat does not compile C extensions for
|
|
402
|
+
gems specified as paths.
|
|
403
|
+
|
|
404
|
+
gem "rails", :path => "vendor/rails"
|
|
405
|
+
|
|
406
|
+
If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories.
|
|
407
|
+
|
|
408
|
+
path 'components' do
|
|
409
|
+
gem 'admin_ui'
|
|
410
|
+
gem 'public_ui'
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
## BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS
|
|
414
|
+
|
|
415
|
+
The `:source`, `:git`, `:path`, `:group`, and `:platforms` options may be
|
|
416
|
+
applied to a group of gems by using block form.
|
|
417
|
+
|
|
418
|
+
source "https://gems.example.com" do
|
|
419
|
+
gem "some_internal_gem"
|
|
420
|
+
gem "another_internal_gem"
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
git "https://github.com/rails/rails.git" do
|
|
424
|
+
gem "activesupport"
|
|
425
|
+
gem "actionpack"
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
platforms :ruby do
|
|
429
|
+
gem "ruby-debug"
|
|
430
|
+
gem "sqlite3"
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
group :development do
|
|
434
|
+
gem "wirble"
|
|
435
|
+
gem "faker"
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
In the case of the `git` block form, the `:ref`, `:branch`, `:tag`,
|
|
439
|
+
and `:submodules` options may be passed to the `git` method, and
|
|
440
|
+
all gems in the block will inherit those options.
|
|
441
|
+
|
|
442
|
+
## GEMSPEC (#gemspec)
|
|
443
|
+
|
|
444
|
+
If you wish to use Carat to help install dependencies for a gem while it is
|
|
445
|
+
being developed, use the `gemspec` method to pull in the dependencies listed in
|
|
446
|
+
the `.gemspec` file.
|
|
447
|
+
|
|
448
|
+
The `gemspec` method adds any runtime dependencies as gem requirements in the
|
|
449
|
+
default group. It also adds development dependencies as gem requirements in the
|
|
450
|
+
`development` group. Finally, it adds a gem requirement on your project (`:path
|
|
451
|
+
=> '.'`). In conjunction with `Carat.setup`, this allows you to require project
|
|
452
|
+
files in your test code as you would if the project were installed as a gem; you
|
|
453
|
+
need not manipulate the load path manually or require project files via relative
|
|
454
|
+
paths.
|
|
455
|
+
|
|
456
|
+
The `gemspec` method supports optional `:path`, `:name`, and `:development_group`
|
|
457
|
+
options, which control where carat looks for the `.gemspec`, what named
|
|
458
|
+
`.gemspec` it uses (if more than one is present), and which group development
|
|
459
|
+
dependencies are included in.
|
|
460
|
+
|
|
461
|
+
## SOURCE PRIORITY
|
|
462
|
+
|
|
463
|
+
When attempting to locate a gem to satisfy a gem requirement,
|
|
464
|
+
carat uses the following priority order:
|
|
465
|
+
|
|
466
|
+
1. The source explicitly attached to the gem (using `:source`, `:path`, or
|
|
467
|
+
`:git`)
|
|
468
|
+
2. For implicit gems (dependencies of explicit gems), any source, git, or path
|
|
469
|
+
repository declared on the parent. This results in carat prioritizing the
|
|
470
|
+
ActiveSupport gem from the Rails git repository over ones from
|
|
471
|
+
`rubygems.org`
|
|
472
|
+
3. The sources specified via global `source` lines, searching each source in
|
|
473
|
+
your `Gemfile` from last added to first added.
|