This gem is intended to provide a bunch of recurrent dev tasks, such as:
- packaging (
gem,rubyc) - running automated tests (
rspec) - generating documentation (
yardoc) - checking and/or correcting coding style (
rubocop) - running virtual machines (
vagrant)
and so on.
Automation mostly relies on the gem (and gemspec) standards,
most tasks SHOULD run in a sufficient gem context.
gem 'rake', '~> 13.0'
gem 'kamaze-project', '~> 1.0'gem install kamaze-projectSome dependencies are optional, as seen inspecting the
gems.rb file.
For example, rspec is considered as a development dependency,
but rspec is required by the test task.
The listen gem is optional, due to
several system incompatibilities;
listen gem is only used by some "watch optional tasks".
Example (gems.rb) with optional dependencies :
group :development do
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 0.79'
gem 'rugged', '~> 0.28'
gem 'sys-proc', '~> 1.1'
# 'listen' is used to "watch"
# but could be incompatible with some systems
gem 'listen', '~> 3.2'
end
group :doc do
gem 'yard', '~> 0.9'
end
group :repl do
gem 'pry', '~> 0.12'
end
group :test do
gem 'rspec', '~> 3.7'
endSome system dependencies are required to install rugged
as native extensions:
makeorgmakecmakepkg-configlibssl-dev(asked for OpenSSL TLS backend)
depending on Linux distributions, and/or package managers, dependency names are likely to change.
This gem keeps ease of use (and DRY) in mind.
Sample of use:
require 'kamaze/project'
Kamaze::Project.instance do |project|
project.subject = Kamaze::Project
project.name = :'kamaze-project'
project.tasks = [
'cs:correct', 'cs:control', 'cs:pre-commit',
'doc', 'doc:watch', 'gem', 'gem:compile',
'shell', 'sources:license', 'test', 'version:edit',
]
end.load!A project has a name and a subject.
Project name SHOULD be the same as the name of the (eventually)
generated gem package name.
When project is instantiated,
a dotenv (.env) file CAN be read, evaluated and loaded.
This could be useful to set specific environment variables,
such as automake's flag variables:
export CPPFLAGS='-P'On the other hand, .env file COULD define the project name:
export PROJECT_NAME='kamaze-project'When project name is defined, on instantiation, the PROJECT_NAME
environment variable is ignored, and has no effect.
Furthermore a mode SHOULD be defined, using environment:
export PROJECT_MODE='development'Kamaze::Project provides several tools. Tools are aimed to afford
easy-to-use and agnostic integration (with low dependency to rake)
of tools such as gem, rubocop, rspec or yardoc.
Some cli tools integrations, when it is not possible to do otherwise,
are also provided; such as rubyc or vagrant.
Furthermore, adding a new tool is really easy.
require 'kamaze/project'
class AwesomeTool < Kamaze::Project::Tools::BaseTool
def run
# do something awesome
end
end
Kamaze::Project.instance do |project|
# initialization (as seen above)
project.tools = {
awesome: AwesomeTool,
}
end.load!
# your tool is accessible (through DSL):
tools.fetch(:awesome)