handyman 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9877db7b64d680a2db9cca7b00d0a2e03872ff9e
4
+ data.tar.gz: 543d592c9791e07f1bbcbc03af83ee14c5c35cde
5
+ SHA512:
6
+ metadata.gz: 873f9e753b66043391cd7d0d1a37343013bc74165a8d1b0b843cddbff0f7c5f35896ef21431224138d55045cb8e345f95f31685251c367ac30b84e0bcc75f852
7
+ data.tar.gz: d7a985cca5bdd2ce3da1b194eeb70d97d1f9169e63927cb755a2eb8085464cf687ff2420620213e6eeff83d84e6d49d179e61d7a87efbd8b8eb31f937084fb99
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in handyman.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Brandon Weaver
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # Handyman
2
+
3
+ Lightweight remote deployment and build tool.
4
+
5
+ ## Usage
6
+
7
+ Handyman::make(blueprint.yaml, 'ip', 'user', 'password')
8
+
9
+ ## Intended Improvements
10
+
11
+ Make a hosts and configuration file to take the need to input params past the blueprint out of the make command.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,17 @@
1
+ # Blueprint for Installing Rails
2
+ # ==============================
3
+ #
4
+ # Makes Ruby 2 and Rails 4
5
+
6
+ Git:
7
+ - 'apt-get install git'
8
+ - 'git config --global user.name %{name}'
9
+ - 'git config --global user.email %{email}'
10
+ Ruby:
11
+ - 'apt-get install curl'
12
+ - 'curl -L https://get.rvm.io | bash'
13
+ - 'rvm install 2.0'
14
+ Bundler:
15
+ - 'gem install bundler --pre'
16
+ Rails:
17
+ - 'gem install rails --no-rdoc --no-ri'
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'handyman/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "handyman"
8
+ spec.version = Handyman::VERSION
9
+ spec.authors = ["Brandon Weaver"]
10
+ spec.email = ["brandon_weaver@baweaver.com"]
11
+ spec.description = %q{Quick and Dirty Remote Builds}
12
+ spec.summary = %q{Herd Boxen in a more manageable fashion}
13
+ spec.homepage = "http://github.com/baweaver/handyman"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "net-ssh"
24
+ spec.add_development_dependency "highline"
25
+ end
@@ -0,0 +1,59 @@
1
+ require "handyman/version"
2
+ require 'net/ssh'
3
+ require 'highline'
4
+
5
+ module Handyman
6
+ class << self
7
+
8
+ # Build the instruction set to execute on the remote box
9
+ def make(blueprint, host, user='', password='')
10
+ user ||= ask("Username: "){ |q| q.echo = true }
11
+ password ||= ask("Password: "){ |q| q.echo = "*" }
12
+
13
+ blueprint = Blueprint.new(host, user, password)
14
+ blueprint.build
15
+ blueprint.execute
16
+ end
17
+
18
+ end
19
+
20
+ class Blueprint
21
+ attr_accessor :ssh, :run_list, :config_file, :opts
22
+
23
+ def initialize(host, user, password)
24
+ @ssh = Net::SSH.start(host, user, password: password)
25
+ @run_list = []
26
+ @config_file = 'lib/config.yml'
27
+ @opts = {
28
+ email: 'test@test.com',
29
+ name: 'John Doe'
30
+ }
31
+ end
32
+
33
+ def build
34
+ configuration_instructions.each do |instruction|
35
+ @run_list << { instruction[0] => instruction[1] }
36
+ end
37
+ end
38
+
39
+ def configuration_instructions
40
+ YAML.load interpolated_config
41
+ end
42
+
43
+ def interpolated_config
44
+ File.open(@config_file,'r').each_line.reduce(''){ |str, line|
45
+ str << line % opts
46
+ }
47
+ end
48
+
49
+ def execute
50
+ @run_list.each do |instruction|
51
+ instruction.each_pair do |title, commands|
52
+ puts title
53
+ commands.to_a.each{ |command| ssh.exec! command }
54
+ end
55
+ end
56
+ end
57
+
58
+ end
59
+ end
@@ -0,0 +1,3 @@
1
+ module Handyman
2
+ VERSION = "0.0.2"
3
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: handyman
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Brandon Weaver
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: net-ssh
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: highline
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Quick and Dirty Remote Builds
70
+ email:
71
+ - brandon_weaver@baweaver.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - blueprints/rails.yml
82
+ - handyman.gemspec
83
+ - lib/handyman.rb
84
+ - lib/handyman/version.rb
85
+ homepage: http://github.com/baweaver/handyman
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.0.0
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Herd Boxen in a more manageable fashion
109
+ test_files: []