Skip to content

Commit

Permalink
Rename to tomo
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbrictson committed Jan 5, 2019
1 parent d3698b9 commit 9734696
Show file tree
Hide file tree
Showing 83 changed files with 319 additions and 327 deletions.
12 changes: 6 additions & 6 deletions README.md
@@ -1,6 +1,6 @@
# Jam
# Tomo

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jam`. To experiment with that code, run `bin/console` for an interactive prompt.
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tomo`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

Expand All @@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem
Add this line to your application's Gemfile:

```ruby
gem 'jam'
gem 'tomo'
```

And then execute:
Expand All @@ -18,7 +18,7 @@ And then execute:

Or install it yourself as:

$ gem install jam
$ gem install tomo

## Usage

Expand All @@ -32,12 +32,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jam. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tomo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Jam project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jam/blob/master/CODE_OF_CONDUCT.md).
Everyone interacting in the Tomo project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tomo/blob/master/CODE_OF_CONDUCT.md).
2 changes: 1 addition & 1 deletion bin/console
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "jam"
require "tomo"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
4 changes: 0 additions & 4 deletions exe/jam

This file was deleted.

4 changes: 4 additions & 0 deletions exe/tomo
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby

require "tomo"
Tomo::CLI.new.call(ARGV)
8 changes: 0 additions & 8 deletions ideas.rb

This file was deleted.

52 changes: 0 additions & 52 deletions lib/jam.rb

This file was deleted.

9 changes: 0 additions & 9 deletions lib/jam/commands.rb

This file was deleted.

8 changes: 0 additions & 8 deletions lib/jam/plugins.rb

This file was deleted.

11 changes: 0 additions & 11 deletions lib/jam/plugins/rails/plugin.rb

This file was deleted.

27 changes: 0 additions & 27 deletions lib/jam/ssh.rb

This file was deleted.

52 changes: 52 additions & 0 deletions lib/tomo.rb
@@ -0,0 +1,52 @@
module Tomo
autoload :CLI, "tomo/cli"
autoload :Colors, "tomo/colors"
autoload :Commands, "tomo/commands"
autoload :Error, "tomo/error"
autoload :Framework, "tomo/framework"
autoload :Host, "tomo/host"
autoload :Logger, "tomo/logger"
autoload :Path, "tomo/path"
autoload :Paths, "tomo/paths"
autoload :Plugin, "tomo/plugin"
autoload :Plugins, "tomo/plugins"
autoload :Project, "tomo/project"
autoload :Remote, "tomo/remote"
autoload :Result, "tomo/result"
autoload :Script, "tomo/script"
autoload :ShellBuilder, "tomo/shell_builder"
autoload :SSH, "tomo/ssh"
autoload :TaskLibrary, "tomo/task_library"
autoload :UnknownTaskError, "tomo/errors/unknown_task_error"
autoload :VERSION, "tomo/version"

class << self
attr_accessor :logger
attr_writer :debug

def load_project!(environment:, settings: {})
spec = Project::Specification.from_json(".tomo/project.json")
.for_environment(environment)

framework = Framework.configure do |config|
config.add_plugins(spec.plugins)
config.add_settings(spec.settings.merge(settings))
if File.file?(".tomo/tasks.rb")
config.add_task_library(TaskLibrary.from_script(".tomo/tasks.rb"))
end
end

Project.new(framework, spec)
end

def debug?
!!@debug
end

def bundled?
!!(defined?(Bundler) && ENV["BUNDLE_GEMFILE"])
end
end

self.logger = Logger.new
end
20 changes: 10 additions & 10 deletions lib/jam/cli.rb → lib/tomo/cli.rb
@@ -1,24 +1,24 @@
module Jam
module Tomo
class CLI
autoload :DeployOptions, "jam/cli/deploy_options"
autoload :Parser, "jam/cli/parser"
autoload :DeployOptions, "tomo/cli/deploy_options"
autoload :Parser, "tomo/cli/parser"

class << self
attr_accessor :show_backtrace
end

COMMANDS = {
"deploy" => Jam::Commands::Deploy,
"init" => Jam::Commands::Init,
"run" => Jam::Commands::Run,
"tasks" => Jam::Commands::Tasks
"deploy" => Tomo::Commands::Deploy,
"init" => Tomo::Commands::Init,
"run" => Tomo::Commands::Run,
"tasks" => Tomo::Commands::Tasks
}.freeze

def call(argv)
command = if COMMANDS.key?(argv.first)
COMMANDS[argv.shift].new
else
Jam::Commands::Default.new
Tomo::Commands::Default.new
end

options = command.parser.parse(argv)
Expand All @@ -32,9 +32,9 @@ def call(argv)
def handle_error(error)
raise error unless error.respond_to?(:to_console)

Jam.logger.error(error.to_console)
Tomo.logger.error(error.to_console)
status = error.respond_to?(:exit_status) ? error.exit_status : 1
exit(status) unless Jam::CLI.show_backtrace
exit(status) unless Tomo::CLI.show_backtrace

raise error
end
Expand Down
@@ -1,4 +1,4 @@
module Jam
module Tomo
class CLI
module DeployOptions
# rubocop:disable Metrics/MethodLength
Expand All @@ -19,7 +19,7 @@ def self.call(opts, results)
end

opts.on("--[no-]color", "Enable/disable color output") do |color|
color ? Jam::Colors.enable : Jam::Colors.disable
color ? Tomo::Colors.enable : Tomo::Colors.disable
end
end
# rubocop:enable Metrics/MethodLength
Expand Down
4 changes: 2 additions & 2 deletions lib/jam/cli/parser.rb → lib/tomo/cli/parser.rb
@@ -1,7 +1,7 @@
require "forwardable"
require "optparse"

module Jam
module Tomo
class CLI
class Parser
extend Forwardable
Expand Down Expand Up @@ -61,7 +61,7 @@ def add(parser_extensions)
def add_debug_option
on_tail("--[no-]debug",
"Enable/disable verbose debug logging") do |debug|
Jam.debug = debug
Tomo.debug = debug
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/jam/colors.rb → lib/tomo/colors.rb
@@ -1,4 +1,4 @@
module Jam
module Tomo
module Colors
ANSI_CODES = {
red: 31,
Expand Down Expand Up @@ -45,7 +45,7 @@ def tty?(io)

ANSI_CODES.each do |name, code|
define_method(name) do |str|
::Jam::Colors.enabled? ? "\e[0;#{code};49m#{str}\e[0m" : str
::Tomo::Colors.enabled? ? "\e[0;#{code};49m#{str}\e[0m" : str
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions lib/tomo/commands.rb
@@ -0,0 +1,9 @@
module Tomo
module Commands
autoload :Default, "tomo/commands/default"
autoload :Deploy, "tomo/commands/deploy"
autoload :Init, "tomo/commands/init"
autoload :Run, "tomo/commands/run"
autoload :Tasks, "tomo/commands/tasks"
end
end
14 changes: 7 additions & 7 deletions lib/jam/commands/default.rb → lib/tomo/commands/default.rb
@@ -1,22 +1,22 @@
module Jam
module Tomo
module Commands
class Default
# rubocop:disable Metrics/MethodLength
def parser
Jam::CLI::Parser.new do |parser|
parser.banner = "Usage: jam COMMAND [options]"
Tomo::CLI::Parser.new do |parser|
parser.banner = "Usage: tomo COMMAND [options]"
parser.usage = <<~USAGE
Jam is an extensible tool for deploying projects to remote hosts via SSH.
Tomo is an extensible tool for deploying projects to remote hosts via SSH.
Please specify a COMMAND, which can be:
#{Jam::CLI::COMMANDS.keys.map { |key| " - #{key}" }.join("\n")}
#{Tomo::CLI::COMMANDS.keys.map { |key| " - #{key}" }.join("\n")}
For additional help, run:
jam COMMAND -h
tomo COMMAND -h
USAGE
parser.on("-v", "--version") do
puts Jam::VERSION
puts Tomo::VERSION
exit
end
end
Expand Down

0 comments on commit 9734696

Please sign in to comment.