Permalink
Browse files

Rename to Salticid

  • Loading branch information...
1 parent 33bc36b commit 761010823587fc7f0958c1c37e80bded16ca903c Kyle Kingsbury committed Jul 27, 2012
View
4 README
@@ -1,7 +1,7 @@
-Hydra
+Salticid
=====
-Hydra is a deployment tool I wrote for Vodpod and Showyou in a couple of weekends. Its only design goals were:
+Salticid is a deployment tool I wrote for Vodpod and Showyou in a couple of weekends. Its only design goals were:
1. Magic
2. More Magic
View
@@ -2,22 +2,22 @@
require 'rubygems'
require 'trollop'
-require "#{File.dirname(__FILE__)}/../lib/hydra"
-require 'hydra/interface'
+require "#{File.dirname(__FILE__)}/../lib/salticid"
+require 'salticid/interface'
opts = Trollop::options do
opt :exec, 'A command line to execute.', :type => :string
opt :group, 'One or more groups to run task on', :type => :string, :multi => true
opt :host, 'One or more hosts to run task on', :type => :string, :multi => true
- opt :load, 'Files to load', :default => [File.join(ENV["HOME"], '.hydrarc')], :multi => true
+ opt :load, 'Files to load', :default => [File.join(ENV["HOME"], '.salticidrc')], :multi => true
opt :role, 'One or more roles. Every host in the role will have the specified task run.', :type => :string, :multi => true
- opt :show, 'Show roles, tasks, hosts, and groups. Try --show hydra or --show <host>', :type => :string
+ opt :show, 'Show roles, tasks, hosts, and groups. Try --show salticid or --show <host>', :type => :string
end
task = ARGV.first
STDOUT.sync = true
-@h = Hydra.new
+@h = Salticid.new
# Load files
opts[:load].each do |file|
@@ -43,7 +43,7 @@ end
# Show info
if opts[:show]
case opts[:show]
- when 'hydra'
+ when 'salticid'
puts @h.to_string
else
begin
@@ -65,7 +65,7 @@ Trollop::die 'Nothing to do' if task.nil? and opts[:exec].nil?
# Run commands on the hosts
Thread.abort_on_exception = true
-interface = Hydra::Interface.new @h
+interface = Salticid::Interface.new @h
begin
interface.main
threads = hosts.map do |host|
@@ -5,23 +5,23 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
-class Hydra
+class Salticid
def self.log(str)
- File.open('hydra.log', 'a') do |f|
+ File.open('salticid.log', 'a') do |f|
f.puts str
end
end
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'net-ssh-shell', 'lib'))
require 'monkeypatch'
require 'snippets/init'
- require 'hydra/message'
- require 'hydra/task'
- require 'hydra/role'
- require 'hydra/role_proxy'
- require 'hydra/host'
- require 'hydra/gateway'
- require 'hydra/group'
+ require 'salticid/message'
+ require 'salticid/task'
+ require 'salticid/role'
+ require 'salticid/role_proxy'
+ require 'salticid/host'
+ require 'salticid/gateway'
+ require 'salticid/group'
attr_accessor :gw, :groups, :hosts, :roles, :tasks
@@ -43,7 +43,7 @@ def gw(name = nil, &block)
name = name.to_s
unless gw = @hosts.find{|h| h.name == name}
- gw = Hydra::Gateway.new(name, :hydra => self)
+ gw = Salticid::Gateway.new(name, :salticid => self)
@hosts << gw
# Set default gw
@gw = gw
@@ -60,7 +60,7 @@ def gw(name = nil, &block)
def host(name, &block)
name = name.to_s
unless host = @hosts.find{|h| h.name == name}
- host = Hydra::Host.new(name, :hydra => self)
+ host = Salticid::Host.new(name, :salticid => self)
@hosts << host
end
@@ -81,14 +81,14 @@ def hosts_for(string)
end
end
- # Assigns a group to this Hydra. Runs the optional block in the group's
+ # Assigns a group to this Salticid. Runs the optional block in the group's
# context. Returns the group.
def group(name, &block)
# Get group
- group = name if name.kind_of? Hydra::Group
+ group = name if name.kind_of? Salticid::Group
name = name.to_s
group ||= @groups.find{|g| g.name == name}
- group ||= Hydra::Group.new(name, :hydra => self)
+ group ||= Salticid::Group.new(name, :salticid => self)
# Store
@groups |= [group]
@@ -101,7 +101,7 @@ def group(name, &block)
group
end
- # Loads one or more file globs into the current hydra.
+ # Loads one or more file globs into the current salticid.
def load(*globs)
skips = globs.grep(/^-/)
(globs - skips).each do |glob|
@@ -119,7 +119,7 @@ def role(name, &block)
name = name.to_s
unless role = @roles.find{|r| r.name == name}
- role = Hydra::Role.new(name, :hydra => self)
+ role = Salticid::Role.new(name, :salticid => self)
@roles << role
end
@@ -137,7 +137,7 @@ def task(name, &block)
name = name.to_s
unless task = @tasks.find{|t| t.name == name}
- task = Hydra::Task.new(name, :hydra => self)
+ task = Salticid::Task.new(name, :salticid => self)
@tasks << task
end
@@ -149,10 +149,10 @@ def task(name, &block)
end
def to_s
- "Hydra"
+ "Salticid"
end
- # An involved description of the hydra
+ # An involved description of the salticid
def to_string
h = ''
h << "Groups\n"
@@ -1,4 +1,4 @@
-module Hydra
+module Salticid
def self.config
@config
end
@@ -1,4 +1,4 @@
-class Hydra::Gateway < Hydra::Host
+class Salticid::Gateway < Salticid::Host
def initialize(*args)
@tunnel_lock = Mutex.new
super *args
@@ -1,4 +1,4 @@
-class Hydra::Group
+class Salticid::Group
# A collection of hosts and other groups.
attr_reader :name
@@ -7,7 +7,7 @@ class Hydra::Group
def initialize(name, opts = {})
@name = name.to_s
- @hydra = opts[:hydra]
+ @salticid = opts[:salticid]
@parent = opts[:parent]
@hosts = []
@groups = []
@@ -38,7 +38,7 @@ def group(name, &block)
# Get group
name = name.to_s
group = @groups.find{|g| g.name == name}
- group ||= Hydra::Group.new(name, :hydra => @hydra, :parent => self)
+ group ||= Salticid::Group.new(name, :salticid => @salticid, :parent => self)
# Store
@groups |= [group]
@@ -53,13 +53,13 @@ def group(name, &block)
# Adds a host (by name) to the group. Returns the host.
def host(name)
- host = @hydra.host name
+ host = @salticid.host name
host.groups |= [self]
@hosts |= [host]
end
def inspect
- "#<Hydra::Group #{path}>"
+ "#<Salticid::Group #{path}>"
end
# Unknown methods are resolved as groups, then hosts. Blocks are instance_exec'd in the found context.
@@ -1,13 +1,13 @@
-class Hydra::Host
- attr_accessor :env, :name, :user, :groups, :roles, :tasks, :hydra, :password
+class Salticid::Host
+ attr_accessor :env, :name, :user, :groups, :roles, :tasks, :salticid, :password
def initialize(name, opts = {})
@name = name.to_s
@user = opts[:user].to_s
@groups = opts[:groups] || []
@roles = opts[:roles] || []
@tasks = opts[:tasks] || []
- @hydra = opts[:hydra]
+ @salticid = opts[:salticid]
@sudo = nil
@on_log = proc { |message| }
@@ -340,8 +340,8 @@ def group?(name)
# Adds this host to a group.
def group(name)
- group = name if name.kind_of? Hydra::Group
- group ||= @hydra.group name
+ group = name if name.kind_of? Salticid::Group
+ group ||= @salticid.group name
group.hosts |= [self]
@groups |= [group]
group
@@ -350,7 +350,7 @@ def group(name)
# Returns the gateway for this host.
def gw(gw = nil)
if gw
- @gw = @hydra.host(gw)
+ @gw = @salticid.host(gw)
else
@gw
end
@@ -425,16 +425,16 @@ def resolve_task(name)
@tasks.each do |task|
return task if task.name == name
end
- @hydra.tasks.each do |task|
+ @salticid.tasks.each do |task|
return task if task.name == name
end
nil
end
- # Assigns roles to a host from the Hydra. Roles are unique in hosts; repeat
+ # Assigns roles to a host from the Salticid. Roles are unique in hosts; repeat
# assignments will not result in more than one copy of the role.
def role(role)
- @roles = @roles | [@hydra.role(role)]
+ @roles = @roles | [@salticid.role(role)]
end
# Does this host have the given role?
@@ -525,7 +525,7 @@ def sudo_upload(local, remote, opts={})
# Finds (and optionally defines) a task.
#
- # Tasks are first resolved in the host's task list, then in the Hydra's task
+ # Tasks are first resolved in the host's task list, then in the Salticid's task
# list. Finally, tasks are created from scratch. Any invocation of task adds
# that task to this host.
#
@@ -538,12 +538,12 @@ def task(name, &block)
if task = @tasks.find{|t| t.name == name}
# Found in self
- elsif (task = @hydra.tasks.find{|t| t.name == name}) and not block_given?
- # Found in hydra
+ elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?
+ # Found in salticid
@tasks << task
else
# Create new task in self
- task = Hydra::Task.new(name, :hydra => @hydra)
+ task = Salticid::Task.new(name, :salticid => @salticid)
@tasks << task
end
@@ -1,4 +1,4 @@
-module Hydra::Host::IP
+module Salticid::Host::IP
# Host methods for IP addresses
# Get all active IP addresses.
@@ -1,11 +1,11 @@
-class Hydra
+class Salticid
class Interface
require 'ncurses'
- require 'hydra/interface/ncurses'
- require 'hydra/interface/resizable'
- require 'hydra/interface/view'
- require 'hydra/interface/tab_view'
- require 'hydra/interface/host_view'
+ require 'salticid/interface/ncurses'
+ require 'salticid/interface/resizable'
+ require 'salticid/interface/view'
+ require 'salticid/interface/tab_view'
+ require 'salticid/interface/host_view'
COLORS = {
:info => Ncurses::COLOR_WHITE,
@@ -32,9 +32,9 @@ def self.shutdown *args
end
end
- attr_reader :hosts, :hydra
+ attr_reader :hosts, :salticid
- def initialize(hydra)
+ def initialize(salticid)
self.class.interfaces << self
# Set up ncurses
@@ -47,7 +47,7 @@ def initialize(hydra)
Ncurses.start_color
Ncurses.use_default_colors
- @hydra = hydra
+ @salticid = salticid
@hosts = []
@tabs = TabView.new(
self,
@@ -1,4 +1,4 @@
-class Hydra
+class Salticid
class Interface
class HostView < View
File renamed without changes.
@@ -1,4 +1,4 @@
-class Hydra
+class Salticid
class Interface
module Resizeable
def resize(dimensions = nil)
@@ -1,4 +1,4 @@
-class Hydra
+class Salticid
class Interface
class TabView < View
@@ -1,4 +1,4 @@
-class Hydra
+class Salticid
class Interface
class View
include Resizeable
File renamed without changes.
Oops, something went wrong.

0 comments on commit 7610108

Please sign in to comment.