freighthop 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Vagrantfile +4 -4
- data/bin/fh +60 -26
- data/lib/freighthop/version.rb +1 -1
- data/lib/freighthop.rb +8 -0
- data/local_modules/freighthop/manifests/packages.pp +1 -0
- data/local_modules/freighthop/manifests/params.pp +2 -2
- data/modules/freighthop/manifests/packages.pp +1 -0
- data/modules/freighthop/manifests/params.pp +2 -2
- metadata +3 -8
data/Vagrantfile
CHANGED
@@ -22,13 +22,13 @@ Vagrant.configure('2') do |config|
|
|
22
22
|
|
23
23
|
node_config.vm.provider :vmware_fusion do |v|
|
24
24
|
v.vmx['displayName'] = Freighthop.hostname
|
25
|
-
v.vmx['memsize'] =
|
26
|
-
v.vmx['numvcpus'] =
|
25
|
+
v.vmx['memsize'] = Freighthop.ram
|
26
|
+
v.vmx['numvcpus'] = Freighthop.cpus
|
27
27
|
end
|
28
28
|
|
29
29
|
node_config.vm.provider :virtualbox do |v|
|
30
|
-
v.customize ['modifyvm', :id, '--memory',
|
31
|
-
v.customize ['modifyvm', :id, '--cpus',
|
30
|
+
v.customize ['modifyvm', :id, '--memory', Freighthop.ram]
|
31
|
+
v.customize ['modifyvm', :id, '--cpus', Freighthop.cpus]
|
32
32
|
end
|
33
33
|
|
34
34
|
node_config.vm.synced_folder(
|
data/bin/fh
CHANGED
@@ -1,46 +1,80 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
FREIGHTHOP_VAGRANT_DOTFILE_PATH = File.expand_path('~/.freighthop.d/vagrant')
|
4
|
+
FREIGHTHOP_VAGRANT_CWD = File.expand_path(File.dirname(__FILE__))
|
5
5
|
|
6
|
-
unless File.directory?(
|
6
|
+
unless File.directory?(FREIGHTHOP_VAGRANT_DOTFILE_PATH)
|
7
7
|
require 'fileutils'
|
8
|
-
FileUtils.mkdir_p(
|
8
|
+
FileUtils.mkdir_p(FREIGHTHOP_VAGRANT_DOTFILE_PATH)
|
9
9
|
end
|
10
10
|
|
11
|
-
ENV['VAGRANT_DOTFILE_PATH'] =
|
12
|
-
ENV['VAGRANT_CWD'] =
|
11
|
+
ENV['VAGRANT_DOTFILE_PATH'] = FREIGHTHOP_VAGRANT_DOTFILE_PATH
|
12
|
+
ENV['VAGRANT_CWD'] = FREIGHTHOP_VAGRANT_CWD
|
13
13
|
|
14
14
|
PROJECT_NAME = File.basename(Dir.pwd)
|
15
15
|
PROJECT_DIR = "/srv/#{PROJECT_NAME}"
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
17
|
+
def print_usage
|
18
|
+
puts <<USAGETEXT
|
19
|
+
NAME
|
20
|
+
fh - freighthop's friendly helper
|
21
|
+
|
22
|
+
DESCRIPTION
|
23
|
+
The fh command is used to interact with a freighthop-managed vm from the root
|
24
|
+
of your project directory.
|
25
|
+
|
26
|
+
SYNOPSIS
|
27
|
+
fh <COMMAND> [args...]
|
28
|
+
|
29
|
+
COMMANDS
|
30
|
+
up - boot freighthop vm
|
31
|
+
halt - shutdown freighthop vm
|
32
|
+
destroy - shutdown and delete vm
|
33
|
+
provision - rerun provisioning on a booted freighthop vm
|
34
|
+
reload - restart freighthop vm (picks up new config changes)
|
35
|
+
status - check the current status of the freighthop vm
|
36
|
+
ssh - opens a root shell inside the project dir of the freighthop vm
|
37
|
+
(other) - see below
|
38
|
+
help - this help
|
39
|
+
|
40
|
+
PASSTHROUGH TO VM
|
41
|
+
Anything that does not match the above list will be passed through to the
|
42
|
+
freighthop vm.
|
43
|
+
|
44
|
+
The command will be run in a bash shell, as root, from inside the shared
|
45
|
+
project directory.
|
46
|
+
|
47
|
+
This allows you to specify relative commands like ./script/server and expect
|
48
|
+
them to behave properly.
|
20
49
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
50
|
+
EXAMPLES
|
51
|
+
Install gem dependencies:
|
52
|
+
fh bundle install
|
53
|
+
|
54
|
+
Start a Rails 4 server:
|
55
|
+
fh ./bin/rails server
|
56
|
+
|
57
|
+
Run a ruby test:
|
58
|
+
fh ruby -Itest test/unit/object_test.rb
|
59
|
+
|
60
|
+
Install leiningen dependencies:
|
61
|
+
fh lein deps
|
62
|
+
|
63
|
+
Run a ring server:
|
64
|
+
fh lein ring server-headless
|
65
|
+
USAGETEXT
|
29
66
|
end
|
30
67
|
|
31
68
|
subcommand, *rest = ARGV
|
32
69
|
case subcommand
|
33
|
-
when '
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
`vagrant ssh-config > /tmp/freighthop.ssh-config`
|
38
|
-
exec %Q(ssh -t -F /tmp/freighthop.ssh-config #{PROJECT_NAME} 'sudo /bin/bash -l -c "cd #{PROJECT_DIR}; #{console_command} #{rest.join(' ')}"')
|
39
|
-
when 'rake' then
|
40
|
-
exec vagrant_ssh("bundle exec rake #{rest.join(' ')}")
|
70
|
+
when 'help' then
|
71
|
+
print_usage
|
72
|
+
when 'up', 'halt', 'destroy', 'provision', 'reload', 'status' then
|
73
|
+
exec %Q(vagrant #{subcommand} #{rest.join(' ')})
|
41
74
|
when 'ssh' then
|
42
75
|
`vagrant ssh-config > /tmp/freighthop.ssh-config`
|
43
76
|
exec %Q(ssh -t -F /tmp/freighthop.ssh-config #{PROJECT_NAME} 'cd #{PROJECT_DIR}; sudo /bin/bash -l -i')
|
44
77
|
else
|
45
|
-
|
78
|
+
`vagrant ssh-config > /tmp/freighthop.ssh-config`
|
79
|
+
exec %Q(ssh -t -F /tmp/freighthop.ssh-config #{PROJECT_NAME} 'cd #{PROJECT_DIR}; sudo /bin/bash -l -c "#{rest.unshift(subcommand).join(' ')}"')
|
46
80
|
end
|
data/lib/freighthop/version.rb
CHANGED
data/lib/freighthop.rb
CHANGED
@@ -2,9 +2,9 @@ class freighthop::params {
|
|
2
2
|
$database_flavors = []
|
3
3
|
$databases = []
|
4
4
|
$database_users = []
|
5
|
-
$packages = [
|
5
|
+
$packages = []
|
6
6
|
$ppas = []
|
7
|
-
$languages = [
|
7
|
+
$languages = []
|
8
8
|
$ruby_version = '1.9.3-p392'
|
9
9
|
$app_name = $::hostname
|
10
10
|
$app_root = "/srv/${app_name}"
|
@@ -2,9 +2,9 @@ class freighthop::params {
|
|
2
2
|
$database_flavors = []
|
3
3
|
$databases = []
|
4
4
|
$database_users = []
|
5
|
-
$packages = [
|
5
|
+
$packages = []
|
6
6
|
$ppas = []
|
7
|
-
$languages = [
|
7
|
+
$languages = []
|
8
8
|
$ruby_version = '1.9.3-p392'
|
9
9
|
$app_name = $::hostname
|
10
10
|
$app_root = "/srv/${app_name}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freighthop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -650,18 +650,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
650
650
|
- - ! '>='
|
651
651
|
- !ruby/object:Gem::Version
|
652
652
|
version: '0'
|
653
|
-
segments:
|
654
|
-
- 0
|
655
|
-
hash: -2753549700317476048
|
656
653
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
657
654
|
none: false
|
658
655
|
requirements:
|
659
656
|
- - ! '>='
|
660
657
|
- !ruby/object:Gem::Version
|
661
658
|
version: '0'
|
662
|
-
segments:
|
663
|
-
- 0
|
664
|
-
hash: -2753549700317476048
|
665
659
|
requirements: []
|
666
660
|
rubyforge_project:
|
667
661
|
rubygems_version: 1.8.23
|
@@ -670,3 +664,4 @@ specification_version: 3
|
|
670
664
|
summary: ! 'Vagrant on Rails: quickly spin up a Vagrant VM to serve your rack-compatible
|
671
665
|
app.'
|
672
666
|
test_files: []
|
667
|
+
has_rdoc:
|