Sha256: b10139296421616cf1caa9f293e3841a3b5492bfc741a673cb79afcb60a67dd9
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
require "bard/server" module Bard class Config def initialize project_name, path: nil, source: nil @project_name = project_name @servers = { local: Server.new( project_name, :local, false, "./", false, ), theia: Server.new( project_name, :theia, "gubito@gubs.pagekite.me", "Sites/#{project_name}", false, ), gubs: Server.new( project_name, :gubs, "botandrose@cloud.hackett.world:22022", "Sites/#{project_name}", false, ), ci: Server.new( project_name, :ci, "jenkins@ci.botandrose.com:22022", "jobs/#{project_name}/workspace", false, ), staging: Server.new( project_name, :staging, "www@#{project_name}.botandrose.com:22022", ), } if path && File.exist?(path) source = File.read(File.expand_path(path)) end if source instance_eval source end end attr_reader :project_name, :servers def server key, &block key = key.to_sym @servers[key] ||= Server.new(project_name, key) @servers[key].instance_eval &block if block_given? @servers[key] end def [] key key = key.to_sym if @servers[key].nil? && key == :production key = :staging end @servers[key] end def data *paths if paths.length == 0 Array(@data) else @data = paths end end def backup *args if args.length == 1 @backup = args.first elsif args.length == 0 return @backup if defined?(@backup) @backup = true else raise ArgumentError end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bard-1.0.1 | lib/bard/config.rb |
bard-1.0.0 | lib/bard/config.rb |