dokkufy 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: 59f7a740715bc7ce0b69d757c24f0701a226c69e
4
+ data.tar.gz: 12b5d9e0e5a1f3669420a7bd2e07b922657521a6
5
+ SHA512:
6
+ metadata.gz: 79a9f3d72e8d00cc7760f695937a27371113ad3595ff861c20a1f9f82b0160ec8d039cd043d0bb9a135130c136b7df414ab577e8c8d135b03139db80c9196d67
7
+ data.tar.gz: 5dc10424069dacfc31619fa6aa14ea28f3171cc8b5e89ae86e3bdffb3e34f87e81f7814415b6251a6522cb6768e89b6731d7d0192ab554382d97b6db363b0acb
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dokkufy (0.0.1)
5
+ commander
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ commander (4.2.0)
11
+ highline (~> 1.6.11)
12
+ highline (1.6.21)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ dokkufy!
data/README.md ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/dokkufy ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ require 'dokkufy'
3
+ require 'commander'
4
+
5
+ Commander.configure do
6
+ program :name, 'Dokkufy'
7
+ program :version, Dokkufy::VERSION
8
+ program :description, 'An interactive script to enable Dokku on a server'
9
+ program :help, 'Author', 'Cristiano Betta <cbetta@gmail.com>'
10
+
11
+ command :'install' do |c|
12
+ c.action do
13
+ host = ask('Server hostname or IP: ')
14
+ username = ask('Username on server: ')
15
+
16
+ server = Dokkufy::Server.new(host, username)
17
+ server.ensure_passwordless_sudo
18
+ server.install_dokku
19
+
20
+ hostname = ask('Desired hostname (e.g. example.com): ')
21
+ server.configure_vhost(hostname)
22
+ server.setup_key
23
+ end
24
+ end
25
+
26
+ default_command :help
27
+ end
data/dokkufy.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "dokkufy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "dokkufy"
7
+ s.version = Dokkufy::VERSION
8
+ s.authors = ["Cristiano Betta"]
9
+ s.email = ["cbetta@gmail.com"]
10
+ s.homepage = "http://github.com/cbetta/dokkufy"
11
+ s.summary = "An interactive script to enable Dokku on a server"
12
+ s.description = "An interactive script to enable Dokku on a server"
13
+ s.license = 'MIT'
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency 'commander'
21
+ end
@@ -0,0 +1,25 @@
1
+ module Dokkufy
2
+ class Server
3
+ attr_accessor :host, :username
4
+
5
+ def initialize host, username
6
+ self.host = host
7
+ self.username = username
8
+ end
9
+
10
+ def setup_key
11
+ user = `echo $USER`
12
+ command = "cat ~/.ssh/id_rsa.pub | ssh #{username}@#{host} 'sudo sshcommand acl-add dokku #{user}'"
13
+ system command
14
+ end
15
+
16
+ def method_missing(m, *args, &block)
17
+ method_name = m.to_s
18
+ filename = Dokkufy::Utils.script method_name
19
+ server = "#{username}@#{host}"
20
+ `scp #{filename} #{server}:`
21
+ system("ssh -t -q #{server} 'OPTION=#{args.first} ./#{method_name}.sh'")
22
+ `ssh -t -q #{server} 'rm #{method_name}.sh'`
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ module Dokkufy
2
+ module Utils
3
+ def self.scripts_directory
4
+ t = [File.expand_path("#{File.dirname(File.expand_path($0))}/../scripts"),
5
+ "#{Gem.dir}/gems/#{Dokkufy::NAME}-#{Dokkufy::VERSION}/scripts"]
6
+ t.each {|i| return i if File.readable?(i) }
7
+ raise "No scripts found"
8
+ end
9
+
10
+ def self.script name
11
+ File.join(scripts_directory, "#{name}.sh")
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ module Dokkufy
2
+ VERSION = "0.0.1" unless defined? Dokkufy::VERSION
3
+ NAME = "dokkufy"
4
+ end
data/lib/dokkufy.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "dokkufy/version"
2
+ require "dokkufy/utils"
3
+ require "dokkufy/server"
4
+
5
+ module Dokkufy
6
+
7
+ end
@@ -0,0 +1 @@
1
+ sudo bash -c "echo $OPTION > /home/dokku/VHOST"
@@ -0,0 +1,6 @@
1
+ line="%$USER ALL = (ALL) NOPASSWD: ALL"
2
+
3
+ if ! sudo grep -qe "$line" "/etc/sudoers"; then
4
+ echo "Adding sudoers"
5
+ sudo bash -c "echo '$line' >> /etc/sudoers"
6
+ fi
@@ -0,0 +1,9 @@
1
+ # wget -qO- https://raw.github.com/progrium/dokku/v0.2.3/bootstrap.sh | sudo DOKKU_TAG=v0.2.3 bash
2
+ VERSION=$(lsb_release -sr)
3
+ OLD_VERSION="12.04"
4
+
5
+ if [ "$VERSION" == "$OLD_VERSION" ]; then
6
+ sudo apt-get install -y python-software-properties
7
+ fi
8
+
9
+ wget -qO- https://raw.github.com/progrium/dokku/v0.2.3/bootstrap.sh | sudo DOKKU_TAG=v0.2.3 bash
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dokkufy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Cristiano Betta
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commander
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: An interactive script to enable Dokku on a server
28
+ email:
29
+ - cbetta@gmail.com
30
+ executables:
31
+ - dokkufy
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - README.md
39
+ - Rakefile
40
+ - bin/dokkufy
41
+ - dokkufy.gemspec
42
+ - lib/dokkufy.rb
43
+ - lib/dokkufy/server.rb
44
+ - lib/dokkufy/utils.rb
45
+ - lib/dokkufy/version.rb
46
+ - scripts/configure_vhost.sh
47
+ - scripts/ensure_passwordless_sudo.sh
48
+ - scripts/install_dokku.sh
49
+ homepage: http://github.com/cbetta/dokkufy
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.2.2
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: An interactive script to enable Dokku on a server
73
+ test_files: []