opskit 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/lib/opskit/cli.rb +15 -13
- data/lib/opskit/templates/apache.erb.conf +2 -2
- data/lib/opskit/version.rb +1 -1
- data/lib/opskit/vhost.rb +6 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 438c4e6212e6b7e5c0b02008ae7b7bc7a488429a
|
4
|
+
data.tar.gz: 0860307a8c7d2deadde4dde2e8826c5f716951d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7675b7bcf64b4bdb6ce950327af612ee1e535ee295c0153c07a2400d1b53368278592d80f878c3f23670a26458de1062dd69ae3fff1f819ba264d5a36ff20952
|
7
|
+
data.tar.gz: 5e16042bd5d6f394b2ed8a01f4384c833b9b4f80e3ec311694b2151a96ffa7fc082ae25b317156dd7371474caaaf846a46afb2acfc11fd8af27a41ef764b6297
|
data/lib/opskit/cli.rb
CHANGED
@@ -1,25 +1,27 @@
|
|
1
1
|
require 'thor'
|
2
|
-
require 'thor/
|
2
|
+
require 'thor/actions'
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
module OpsKit
|
6
6
|
class OdinSon < Thor
|
7
|
-
|
7
|
+
include Thor::Actions
|
8
8
|
|
9
|
-
desc "
|
10
|
-
def
|
11
|
-
conf =
|
12
|
-
conf
|
13
|
-
|
14
|
-
end
|
15
|
-
vhost = OpsKit::VHost.new( template, conf )
|
9
|
+
desc "export", "Generates vhost and host file config"
|
10
|
+
def export
|
11
|
+
conf = {}
|
12
|
+
conf[:url] = ask "What is the dev url?"
|
13
|
+
conf[:docroot] = ask "What is the docroot?"
|
16
14
|
|
17
|
-
if
|
18
|
-
|
15
|
+
if yes?("Is it a custom template? y/n")
|
16
|
+
conf[:template_path] = ask "What is the template path?"
|
19
17
|
else
|
20
|
-
|
21
|
-
puts vhost.vhost_location
|
18
|
+
conf[:template] = ask "What is the template?"
|
22
19
|
end
|
20
|
+
|
21
|
+
vhost = OpsKit::VHost.new( conf )
|
22
|
+
|
23
|
+
system "echo '#{vhost.render}' | sudo tee #{ vhost.vhost_location }"
|
24
|
+
system "echo '127.0.0.1\t#{ conf[:url]}' | sudo tee -a /etc/hosts"
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<VirtualHost *:80>
|
2
2
|
ServerName <%= url %>
|
3
|
-
DocumentRoot
|
3
|
+
DocumentRoot <%= Dir.pwd %>/<%= docroot %>
|
4
4
|
|
5
|
-
<Directory "
|
5
|
+
<Directory "<%= Dir.pwd %>/<%= docroot %>/"
|
6
6
|
Options Indexes FollowSymLinks Includes ExecCGI
|
7
7
|
AllowOverride All
|
8
8
|
Require all granted
|
data/lib/opskit/version.rb
CHANGED
data/lib/opskit/vhost.rb
CHANGED
@@ -2,19 +2,16 @@ module OpsKit
|
|
2
2
|
class VHost
|
3
3
|
PROVIDERS = Dir.entries( File.join( File.dirname(__FILE__), "templates/" ) ).select {|f| !File.directory? f}.map{ |e| e.split('.').first.to_sym }
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :conf
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@provider = provider
|
7
|
+
def initialize( conf = {} )
|
9
8
|
@conf = conf
|
10
9
|
end
|
11
10
|
|
12
11
|
def render
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
file_path = File.join( File.dirname(__FILE__), "templates/#{ @provider }.erb.conf" )
|
17
|
-
elsif @conf[ :template_path ]
|
12
|
+
if PROVIDERS.include? @conf[ :template ].to_sym
|
13
|
+
file_path = File.join( File.dirname(__FILE__), "templates/#{ @conf[ :template ] }.erb.conf" )
|
14
|
+
elsif @conf[ :template ]
|
18
15
|
file_path = @conf[ :template ]
|
19
16
|
end
|
20
17
|
|
@@ -24,7 +21,7 @@ module OpsKit
|
|
24
21
|
end
|
25
22
|
|
26
23
|
def vhost_location
|
27
|
-
case @
|
24
|
+
case @conf[ :template ].to_sym
|
28
25
|
when :apache
|
29
26
|
"/etc/apache2/sites-available/#{ @conf[:url] }.conf"
|
30
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opskit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "ClikeX\n\n"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|