punt 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34dfefa7e3ce411685269697e3e481ea681315ca
4
+ data.tar.gz: 732aee71382e7b463e0875f5b763cc11759e77ab
5
+ SHA512:
6
+ metadata.gz: be4525111464a98a12535b0f2a0a33125ab8d0c694436dbfa5a0b7dc19b213031a8f52b215cf6961c581a2069650ea0b2e5f8e4d64313eaa18646e04cd7972bb
7
+ data.tar.gz: d30fa67e9910700a468f970bb743791336b95d3de5a9253cbdabafd9f0ec401de866b75d59e2aa4a1cf116505e1c36c0e42f2fd82509c7e4752a94c8dc4cea4a
@@ -0,0 +1,8 @@
1
+ staging:
2
+ mode: scp
3
+ host:
4
+ cwd: clients/apsis
5
+ username:
6
+ files:
7
+ - file1.txt: remote/file1.txt
8
+ - directory1: remote/directory1
data/bin/punt ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'punt'
4
+
5
+ Punt.cmd(ARGV)
data/lib/punt.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'yaml'
2
+
3
+ require 'punt/cmd/cmd'
4
+ require 'punt/cmd/cmd_init'
5
+
6
+ class Punt
7
+ CMDS = [CmdInit.new].sort { |first, second| first.name <=> second.name }
8
+
9
+ def self.cmd(argv)
10
+ first = argv.shift
11
+ matching_cmd = find_cmd(first)
12
+
13
+ usage and return unless matching_cmd
14
+
15
+ matching_cmd.run(argv)
16
+ end
17
+
18
+ private
19
+ def self.find_cmd(arg)
20
+ return CMDS.reject {|cmd| cmd.name != arg }.first
21
+ end
22
+
23
+ def self.usage()
24
+ puts "Usage: punt [cmd] [cmd-arguments]"
25
+ puts ""
26
+ puts "punt recognizes the following commands:"
27
+ puts ""
28
+ CMDS.each do |cmdClazz|
29
+ puts "\t#{cmdClazz.name} - #{cmdClazz.summary}"
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,36 @@
1
+ class Cmd
2
+
3
+ def setup
4
+ end
5
+
6
+ def self.tag(hash)
7
+ hash.each do |key, value|
8
+ self.class_eval("def #{key}() \"#{value}\"; end")
9
+ end
10
+ end
11
+
12
+ def name
13
+ raise NotImplementedError
14
+ end
15
+
16
+ def summary
17
+ "No Summary Provided"
18
+ end
19
+
20
+ def options()
21
+ nil
22
+ end
23
+
24
+ def run(argv)
25
+ nil
26
+ end
27
+
28
+ protected
29
+
30
+ ### Asset Utilities ###
31
+
32
+ def asset_path(*path)
33
+ return File.join(File.dirname(__FILE__), "..", "..", "..", "assets", path)
34
+ end
35
+
36
+ end
@@ -0,0 +1,30 @@
1
+ class CmdInit < Cmd
2
+ tag name: "init"
3
+ tag summary: "Initializes the directory with a basic puntfile.yml"
4
+
5
+ def run(argv)
6
+ copy_without_overwriting "puntfile.yml"
7
+ end
8
+
9
+ private
10
+
11
+ def copy_without_overwriting(*asset)
12
+ p = paths(asset)
13
+ FileUtils.cp(p[:src], p[:dst]) unless File.exists?(p[:dst])
14
+ end
15
+
16
+ def paths(*asset)
17
+ {
18
+ src: src_path(asset),
19
+ dst: dst_path(asset)
20
+ }
21
+ end
22
+
23
+ def src_path(*asset)
24
+ asset_path("init", asset)
25
+ end
26
+
27
+ def dst_path(*asset)
28
+ File.join(asset)
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: punt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Noah Callaway
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Minimal deployment tool that can copy files to specific hosts over SCP
14
+ and/or SFTP
15
+ email: noah@apsis.io
16
+ executables:
17
+ - punt
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - assets/init/puntfile.yml
22
+ - bin/punt
23
+ - lib/punt.rb
24
+ - lib/punt/cmd/cmd.rb
25
+ - lib/punt/cmd/cmd_init.rb
26
+ homepage: http://rubygems.org/gems/punt
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.4.8
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Simple deployment tool for deploying via SCP and SFTP
50
+ test_files: []