dokku 0.0.1

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: 51ee91db468077040999c25753d694ca032f4139
4
+ data.tar.gz: 078cff2c5001f4691ffff48524c6ab3add3beb12
5
+ SHA512:
6
+ metadata.gz: 8bda642e4e3bffced6cedc72ae550cddf8a23d2464a114823485848af27550008f40694cd7c9c112bb39f79727810be99e1b8a402817ec2638e4a05544aa8699
7
+ data.tar.gz: 81a4ec93449795cf5e5f24a4b7f07174bc365a8167e99ed42ce2279e8d955e8699004af27f5435cdcde76022169721e681bfb3219cee961c8d2d92a20fc9d740
@@ -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,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dokku.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'pry', :require => 'pry'
8
+ gem 'pry-nav'
9
+ gem 'pry-remote'
10
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Teodor Pripoae
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,29 @@
1
+ # Dokku
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'dokku'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install dokku
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
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require 'pry'
5
+
6
+ # resolve bin path, ignoring symlinks
7
+ require "pathname"
8
+ bin_file = Pathname.new(__FILE__).realpath
9
+
10
+ # add self to libpath
11
+ $:.unshift File.expand_path("../../lib", bin_file)
12
+
13
+ # start up the CLI
14
+ require "dokku/cli"
15
+ Dokku::CLI.start(*ARGV)
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dokku/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dokku"
8
+ spec.version = Dokku::VERSION
9
+ spec.authors = ["Teodor Pripoae"]
10
+ spec.email = ["teodor.pripoae@gmail.com"]
11
+ spec.description = %q{Manage dokku applications}
12
+ spec.summary = %q{Manage dokku applications}
13
+ spec.homepage = "http://github.com/teodor-pripoae/dokku-gem"
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 "pry"
24
+ spec.add_development_dependency "pry-nav"
25
+ spec.add_development_dependency "pry-remote"
26
+ end
@@ -0,0 +1,5 @@
1
+ require "dokku/version"
2
+
3
+ module Dokku
4
+
5
+ end
@@ -0,0 +1,28 @@
1
+ require 'dokku'
2
+ require 'dokku/command'
3
+ require "dokku/helpers"
4
+
5
+ class Dokku::CLI
6
+ extend Dokku::Helpers
7
+
8
+ def self.start(*args)
9
+ begin
10
+ if $stdin.isatty
11
+ $stdin.sync = true
12
+ end
13
+ if $stdout.isatty
14
+ $stdout.sync = true
15
+ end
16
+ command = args.shift.strip rescue "help"
17
+ Dokku::Command.load
18
+ Dokku::Command.run(command, args)
19
+ rescue Interrupt
20
+ `stty icanon echo`
21
+ error("Command cancelled.")
22
+ rescue => error
23
+ error(error)
24
+ exit(1)
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1,34 @@
1
+ require 'dokku/helpers'
2
+
3
+ module Dokku
4
+ module Command
5
+ class CommandFailed < RuntimeError; end
6
+
7
+ extend Dokku::Helpers
8
+
9
+ def self.load
10
+ Dir[File.join(File.dirname(__FILE__), "command", "*.rb")].each do |file|
11
+ require file
12
+ end
13
+ end
14
+
15
+ def self.commands
16
+ @@commands ||= {}
17
+ end
18
+
19
+ def self.run(command, args=[])
20
+ begin
21
+ command = const_get(command.capitalize)
22
+ rescue
23
+ error("Command not found")
24
+ exit(1)
25
+ end
26
+
27
+ begin
28
+ command.send(:run, args)
29
+ # rescue
30
+ # raise CommandFailed
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ module Dokku
2
+ module Command
3
+ class Base
4
+ def self.run(args)
5
+ setup_cloud_and_app
6
+ end
7
+
8
+ def cloud
9
+ @cloud ||= ""
10
+ end
11
+
12
+ def app
13
+ @app ||= ""
14
+ end
15
+
16
+ def self.app_url
17
+ "http://#{@app}.#{@cloud}"
18
+ end
19
+
20
+ def self.setup_cloud_and_app
21
+ @remote_url = `git config --get remote.dokku.url`.strip
22
+ @git_user, @cloud, @app = @remote_url.split(/[@:]/)
23
+ end
24
+
25
+ def self.stop_app
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,22 @@
1
+ module Dokku
2
+ module Command
3
+ class Create < Base
4
+ def self.run(args)
5
+ super
6
+
7
+ @cloud = args.shift.strip #rescue Dokku::Command.run("help")
8
+ @app = args.shift.strip #rescue Dokku::Command.run("help")
9
+
10
+ add_git_remote
11
+ end
12
+
13
+ def self.git_url
14
+ "git@#{@cloud}:#{@app}"
15
+ end
16
+
17
+ def self.add_git_remote
18
+ `git remote add dokku #{git_url}`
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ module Dokku
2
+ module Command
3
+ class Delete < Base
4
+ def self.run(*args)
5
+ super
6
+
7
+ stop_app
8
+ destroy_app
9
+ rm_git_remote
10
+ end
11
+
12
+ def self.rm_git_remote
13
+ `git remote rm dokku`
14
+ end
15
+
16
+ def self.destroy_app
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ module Dokku
2
+ module Command
3
+ class Help < Base
4
+ def self.run(args)
5
+ super
6
+
7
+ puts "Help message"
8
+ exit(1)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Dokku
2
+ module Command
3
+ class Open < Base
4
+ def self.run(*args)
5
+ super
6
+
7
+ open_app
8
+ end
9
+
10
+ def self.open_app
11
+ `open #{app_url}`
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ module Dokku
2
+ module Helpers
3
+
4
+ extend self
5
+
6
+ def home_directory
7
+ running_on_windows? ? ENV['USERPROFILE'].gsub("\\","/") : ENV['HOME']
8
+ end
9
+
10
+ def running_on_windows?
11
+ RUBY_PLATFORM =~ /mswin32|mingw32/
12
+ end
13
+
14
+ def running_on_a_mac?
15
+ RUBY_PLATFORM =~ /-darwin\d/
16
+ end
17
+
18
+ def error(message)
19
+ puts "dokku Error: #{message}"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Dokku
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dokku
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Teodor Pripoae
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-04 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: pry
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: pry-nav
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
+ - !ruby/object:Gem::Dependency
70
+ name: pry-remote
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Manage dokku applications
84
+ email:
85
+ - teodor.pripoae@gmail.com
86
+ executables:
87
+ - dokku
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/dokku
97
+ - dokku.gemspec
98
+ - lib/dokku.rb
99
+ - lib/dokku/cli.rb
100
+ - lib/dokku/command.rb
101
+ - lib/dokku/command/base.rb
102
+ - lib/dokku/command/create.rb
103
+ - lib/dokku/command/delete.rb
104
+ - lib/dokku/command/help.rb
105
+ - lib/dokku/command/open.rb
106
+ - lib/dokku/helpers.rb
107
+ - lib/dokku/version.rb
108
+ homepage: http://github.com/teodor-pripoae/dokku-gem
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.0.0
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: Manage dokku applications
132
+ test_files: []