Please note that as of Merb 1.0.5, this section is deprecated. Please refer to the information on bundling dependencies
In an app merb.thor will operate on your local ./gems directory. Without this directory (which is automatically created by merb-gen) it will operate on your system gems. In other words, if you use merb.thor outside of your app, you can manage your system gems in the same manner. Preferably you'd use merb:stack:install or merb:dependencies:install with a YAML configuration file.
Also, at all times, check if your config/dependencies.rb versions match your gem versions. Mismatches tend to occur, especially when running from edge.
Finally, 'merb' and 'bin/merb' are identical - both will pickup your local merb-core before starting your application. The latter is just useful if you don't have a system merb install available, during deployment for example.
Maybe one final tip: play around with a fresh merb app to get a feeling of what merb.thor can do. As all operations will happen local to the app, your system gems stay unaffected.
It's considered a best practice to keep merb.thor 'local', for example a new merb app will already have it installed in tasks/merb.thor; generally you shouldn't install it globally using 'thor install'. Having both a local and global merb.thor installed can lead to serious conflicts as their code will be merged.
First off all, see what tasks are available to you: thor -T
If you want to see the extended, more low-level tasks, check out: thor -T –all
Learn how to inspect your application:
thor merb:dependencies:list
This task takes all the same options as merb:dependencies:install, which is useful for knowing what's installed and what's going to be.
To see the actual local gems use:
thor merb:gem:list
Finally, a lot of tasks support a —dry-run option to preview what's going to happen.
If you just want to install your apps basic dependencies, use one of the following:
thor merb:dependencies:install stable
or, if you're more adventurous:
thor merb:dependencies:install edge
Both methods accept —include-dependencies which bundles any subdependencies as well. Add —force to start with a blank slate.
Note that some dependencies can't be inferred automatically, most notably the specific DO adapter you intend to use. In this case, just add the dependency in config/dependencies.rb:
dependency “do_sqlite3”
Alternatively, just install this afterwards, either from stable:
thor merb:gem:install do_sqlite3
or from edge:
thor merb:source:install do_sqlite3
The above should work for any specific gems your app requires, but didn't pickup with merb:dependencies:install - you can check with merb:dependencies:list.
To get a full merb stack, regardless of your app's actual dependencies, you can use the merb:stack tasks, which by default install from stable rubygems:
thor merb:stack:install –force
Add —edge to install from git HEAD, and —include-dependencies to bundle any subdependencies.
If you want full control over your apps dependencies, without infering these from your app automatically, you can always create a config/dependencies.yml file.
thor merb:dependencies:configure
The contents of this file looks similar to this:
- merb-core (= 0.9.8, runtime) - merb-slices (= 0.9.8, runtime)
You can use this config file by passing the —config option to the merb:dependencies:* tasks, for example, to see the contents:
thor merb:dependencies:list –config
Or more explicitly: thor merb:dependencies:list –config-file path/to/config.yml
This means you can easily define multiple configurations and easily switch between them (just use —force); for edge installs the version requirement will be ignored - this only applies to gems found in one of the git sources. These sources can be configured in config/sources.yml, for example:
merb-core: git://github.com/myfork/merb-core.git merb-more: git://github.com/myfork/merb-more.git
To see an overview of the basic tasks run thor -T. Add –all to see all tasks, including the more low-level ones.
The Dependencies tasks will install dependencies based on actual application dependencies. For this, the application is queried for any dependencies. All operations will be performed within this context.
By default all dependencies are listed, partitioned into system, local and currently missing dependencies. The first argument allows you to filter on any of the partitionings. A second argument can be used to filter on a set of known components, like all merb-more gems for example.
By default all required dependencies are installed. The first argument specifies which strategy to use: stable or edge. A second argument can be used to filter on a set of known components.
Existing dependencies will be clobbered; when :force ⇒ true then all gems will be cleared first, otherwise only existing local dependencies of the gems to be installed will be removed.
In addition to the options above, edge install uses the following:
By default all required dependencies are installed. An optional argument can be used to filter on a set of known components.
Existing dependencies will be clobbered; when :force ⇒ true then all gems will be cleared, otherwise only existing local dependencies of the matching component set will be removed.
This task should be executed as part of a deployment setup, where the deployment system runs this after the app has been installed. Usually triggered by Capistrano, God…
It will regenerate gems from the bundled gems cache for any gem that has C extensions - which need to be recompiled for the target deployment platform.
Note: gems/cache should be in your SCM for this to work correctly.
merb:dependencies:redeploy
A configuration yaml file will be created from the extracted application dependencies. The format of the configuration is as follows:
--- - merb-core (= 0.9.8, runtime) - merb-slices (= 0.9.8, runtime)
This format is exactly the same as Gem::Dependency#to_s returns.
The Stack tasks will install dependencies based on known sets of gems, regardless of actual application dependency settings.
Will list dependencies from known sets of gems.
See also: Merb::Dependencies#install and Merb::Dependencies#install_dependencies
See also: Merb::Dependencies#uninstall
Due to the specific nature of MiniGems it can only be installed system-wide.
By default all local gems are listed. When the first argument is 'all' the list is partitioned into system an local gems; specify 'system' to show only system gems. A second argument can be used to filter on a set of known components, like all merb-more gems for example.
All arguments should be names of gems to install.
When :force ⇒ true then any existing versions of the gems to be installed will be uninstalled first. It's important to note that so-called meta-gems or gems that exactly match a set of Merb::Stack.components will have their sub-gems uninstalled too. For example, uninstalling merb-more will install all contained gems: merb-action-args, merb-assets, merb-gen, …
By default all specified gems are uninstalled. It's important to note that so-called meta-gems or gems that match a set of Merb::Stack.components will have their sub-gems uninstalled too. For example, uninstalling merb-more will install all contained gems: merb-action-args, merb-assets, …
Existing dependencies will be clobbered; when :force ⇒ true then all gems will be cleared, otherwise only existing local dependencies of the matching component set will be removed.
All arguments should be names of gems to install.
When :force ⇒ true then any existing versions of the gems to be installed will be uninstalled first. It's important to note that so-called meta-gems or gems that exactly match a set of Merb::Stack.components will have their sub-gems uninstalled too. For example, uninstalling merb-more will install all contained gems: merb-action-args, merb-assets, merb-gen, …
By default all specified gems are uninstalled. It's important to note that so-called meta-gems or gems that match a set of Merb::Stack.components will have their sub-gems uninstalled too. For example, uninstalling merb-more will install all contained gems: merb-action-args, merb-assets, …
Existing dependencies will be clobbered; when :force ⇒ true then all gems will be cleared, otherwise only existing local dependencies of the matching component set will be removed. Additionally when :wipe ⇒ true, the matching git repositories will be removed from the source directory.
The arguments can be actual repository names (from Merb::Source.repos) or names of known merb stack gems. If the repo doesn't exist already, it will be created and cloned.
The repository can be a direct git url or a known -named- repository.
Git repository sources - pass source_config option to load a yaml configuration file - defaults to ./config/git-sources.yml and ~/.merb/git-sources.yml - which you need to create yourself.
Example of contents:
merb-core: git://github.com/myfork/merb-core.git merb-more: git://github.com/myfork/merb-more.git