legworker 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/legworker +74 -0
- data/legworker.gemspec +23 -0
- data/lib/legworker/version.rb +3 -0
- data/lib/legworker.rb +65 -0
- metadata +88 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 DrewDahlman
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Legworker
|
2
|
+
|
3
|
+
A collection of useful things from Legwork all in one Gem.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'legworker'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install legworker
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/legworker
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'legworker'
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
lw = Legworker::Legs.new
|
9
|
+
|
10
|
+
opt_parser = OptionParser.new do |opt|
|
11
|
+
opt.banner = "Usage: opt_parser COMMAND [OPTIONS]"
|
12
|
+
opt.separator ""
|
13
|
+
opt.separator "Commands"
|
14
|
+
opt.separator " vagrant: start new vagrant & puppet project"
|
15
|
+
opt.separator ""
|
16
|
+
opt.separator "Options"
|
17
|
+
|
18
|
+
opt.on("-h","--help","help") do
|
19
|
+
puts opt_parser
|
20
|
+
end
|
21
|
+
|
22
|
+
opt.on("-a","--application APPLICATION","Your Application Name") do |op|
|
23
|
+
puts "Application Name: #{op}"
|
24
|
+
options[:application_name] = op
|
25
|
+
end
|
26
|
+
|
27
|
+
opt.on("--devUser","--devUser DEVUSER","Your Development User") do |op|
|
28
|
+
puts "Development User: #{op}"
|
29
|
+
options[:dev_user] = op
|
30
|
+
end
|
31
|
+
|
32
|
+
opt.on("--devPass","--devPass DEVPASS","Your Development Password") do |op|
|
33
|
+
puts "Development Password: #{op}"
|
34
|
+
options[:dev_pass] = op
|
35
|
+
end
|
36
|
+
|
37
|
+
opt.on("--prodUser","--prodUser PRODUSER","Your Production User") do |op|
|
38
|
+
puts "Production User: #{op}"
|
39
|
+
options[:prod_user] = op
|
40
|
+
end
|
41
|
+
|
42
|
+
opt.on("--prodPass","--prodPass PRODPASS","Your Production Password") do |op|
|
43
|
+
puts "Production Password: #{op}"
|
44
|
+
options[:prod_pass] = op
|
45
|
+
end
|
46
|
+
|
47
|
+
opt.on("--dd","--devDatabase DATABASE","Your development database name") do |op|
|
48
|
+
puts "Development Database: #{op}"
|
49
|
+
options[:dev_database] = op
|
50
|
+
end
|
51
|
+
|
52
|
+
opt.on("--pd","--prodDatabase DATABASE","Your production database name") do |op|
|
53
|
+
puts "Production Database: #{op}"
|
54
|
+
options[:prod_database] = op
|
55
|
+
end
|
56
|
+
|
57
|
+
opt.on("vagrant") do
|
58
|
+
if options.size == 7
|
59
|
+
lw.vagrant(options)
|
60
|
+
else
|
61
|
+
puts "Oops looks like you're missing some options."
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
case ARGV[0]
|
68
|
+
when "vagrant"
|
69
|
+
|
70
|
+
else
|
71
|
+
puts "You need to specify an action. enter legworker -h to see documentation"
|
72
|
+
end
|
73
|
+
|
74
|
+
opt_parser.parse!
|
data/legworker.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'legworker/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "legworker"
|
8
|
+
spec.version = Legworker::VERSION
|
9
|
+
spec.authors = ["DrewDahlman"]
|
10
|
+
spec.email = ["info@drewdahlman.com"]
|
11
|
+
spec.description = %q{Legwork tool for usefull things.}
|
12
|
+
spec.summary = %q{Legwork tool for usefull things.}
|
13
|
+
spec.homepage = ""
|
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
|
+
end
|
data/lib/legworker.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require "legworker/version"
|
2
|
+
require "optparse"
|
3
|
+
|
4
|
+
module Legworker
|
5
|
+
class Legs
|
6
|
+
|
7
|
+
#----------------------------------------------------------------------------
|
8
|
+
#
|
9
|
+
# Download Vagrant & Puppet
|
10
|
+
#
|
11
|
+
#----------------------------------------------------------------------------
|
12
|
+
def vagrant(options)
|
13
|
+
|
14
|
+
# download useful things
|
15
|
+
system('curl -sS https://s3.amazonaws.com/legworker/Vagrantfile > Vagrantfile')
|
16
|
+
|
17
|
+
# download puppet.zip
|
18
|
+
system('curl -sS https://s3.amazonaws.com/legworker/puppet.zip > puppet.zip')
|
19
|
+
system('unzip puppet.zip -d config')
|
20
|
+
system('rm puppet.zip')
|
21
|
+
system('rm -rf config/__MACOSX || exit')
|
22
|
+
|
23
|
+
self.setup_app(options)
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
#----------------------------------------------------------------------------
|
28
|
+
#
|
29
|
+
# Setup Application & Databases
|
30
|
+
#
|
31
|
+
#----------------------------------------------------------------------------
|
32
|
+
def setup_app(options)
|
33
|
+
app_options = {}
|
34
|
+
vagrant_file = 'config/puppet/manifests/vagrant.pp'
|
35
|
+
|
36
|
+
file = File.open(vagrant_file)
|
37
|
+
contents = file.read
|
38
|
+
|
39
|
+
contents.gsub!('_APPLICATION_NAME_',options[:application_name])
|
40
|
+
contents.gsub!('_DEV_USER_',options[:dev_user])
|
41
|
+
contents.gsub!('_DEV_PASS_',options[:dev_pass])
|
42
|
+
contents.gsub!('_PROD_USER_',options[:prod_user])
|
43
|
+
contents.gsub!('_PROD_PASS_',options[:prod_pass])
|
44
|
+
|
45
|
+
File.open(vagrant_file, "w") { |f| f.puts contents }
|
46
|
+
|
47
|
+
database_yml = "config/puppet/templates/database.yml.erb"
|
48
|
+
|
49
|
+
db = File.open(database_yml)
|
50
|
+
db_contents = db.read
|
51
|
+
|
52
|
+
db_contents.gsub!("_DEV_DATABASE_",options[:dev_database])
|
53
|
+
db_contents.gsub!("_PROD_DATABASE_",options[:prod_database])
|
54
|
+
db_contents.gsub!('_DEV_USER_',options[:dev_user])
|
55
|
+
db_contents.gsub!('_DEV_PASS_',options[:dev_pass])
|
56
|
+
db_contents.gsub!('_PROD_USER_',options[:prod_user])
|
57
|
+
db_contents.gsub!('_PROD_PASS_',options[:prod_pass])
|
58
|
+
|
59
|
+
File.open(database_yml, "w") { |f| f.puts db_contents }
|
60
|
+
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: legworker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- DrewDahlman
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-09-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Legwork tool for usefull things.
|
47
|
+
email:
|
48
|
+
- info@drewdahlman.com
|
49
|
+
executables:
|
50
|
+
- legworker
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- LICENSE.txt
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- bin/legworker
|
60
|
+
- legworker.gemspec
|
61
|
+
- lib/legworker.rb
|
62
|
+
- lib/legworker/version.rb
|
63
|
+
homepage: ''
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.8.23
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Legwork tool for usefull things.
|
88
|
+
test_files: []
|