dockland 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 907e0e3617b1cc30019c5372adb9f25141ad6bd2
4
- data.tar.gz: a1d0bf00df87d99988e192a03b38fd7936f165ed
3
+ metadata.gz: c4aacb5b87342f2c03fafff0f6e2c92fd7231a3c
4
+ data.tar.gz: 328eb74242dcabc1200ec275068becec660cbf03
5
5
  SHA512:
6
- metadata.gz: eb1ea5c5029f25827a1df65a179190281ba71669d933ce2b2d23199c83e7c156a4c95a30d59134607741fa6d5d91b064a06a4c5ad68684c41df7b562fca7d873
7
- data.tar.gz: 889a5b5f832ea7b790f3974698e7c22150c94f08557b145436882c069f11087aae091e3e4cce5800f44f0f31fbf817bee6bab2f8f88c52bd971cd6c8f76bab5f
6
+ metadata.gz: 8ffdd4fe449d8e7576b8344a44df1b8d2cb37be971e91e5d01322b7f3329eebbfdff59429f1c544b8d9e295c773908239fde62142b7c28a6f533b2a51d4b1f35
7
+ data.tar.gz: 0fed6ecc2b3d0630294ca5326adc9ffc75fc779723df2aaec89ea2d66c9e75414b458c4e15f8831c8c2d34935c57afdd613157960046a66e772edf687d4b5dfc
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # 0.2.0
2
+
3
+ - Dockland detects automatically that given command requires <app_name>
4
+
5
+ # 0.0.1
6
+
7
+ - First release
data/README.md CHANGED
@@ -4,13 +4,13 @@ dokku pipeline
4
4
 
5
5
  ## Installation
6
6
 
7
- ```zsh
7
+ ```bash
8
8
  $ gem install dockland
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
- ```zsh
13
+ ```bash
14
14
  $ cd dokku-ready-project
15
15
  $ git config remote.dokku.url
16
16
  dokku@example.com:dokku-ready-project
@@ -28,7 +28,7 @@ KEY1: VALUE
28
28
 
29
29
  ## Contributing
30
30
 
31
- 1. Fork it ( https://github.com/[my-github-username]/dockland/fork )
31
+ 1. Fork it ( https://github.com/oame/dockland/fork )
32
32
  2. Create your feature branch (`git checkout -b my-new-feature`)
33
33
  3. Commit your changes (`git commit -am 'Add some feature'`)
34
34
  4. Push to the branch (`git push origin my-new-feature`)
data/lib/dockland.rb CHANGED
@@ -4,10 +4,10 @@ require 'dockland/cli'
4
4
  module Dockland
5
5
 
6
6
  private
7
- def self.dokku_remote
8
- dokku_uri = `git config remote.dokku.url`.strip
7
+ def self.parse_git_remote
8
+ dokku_uri = `git config remote.dokku.url`.strip || `git config remote.deploy.url`.strip
9
9
  if dokku_uri.empty?
10
- puts "dokku url not given. please add dokku url to git remote"
10
+ puts "dokku url not given. please run > $ git remote add dokku dokku@<host>:<app_name>"
11
11
  exit
12
12
  end
13
13
 
@@ -15,4 +15,16 @@ module Dockland
15
15
  return { username: username, host: host, app_name: app_name }
16
16
  end
17
17
 
18
+ def self.is_require_app_name?(command)
19
+ remote = parse_git_remote
20
+ line = `ssh -t #{remote[:username]}@#{remote[:host]} help 2> /dev/null | grep ' #{command}'`
21
+ line.include?('<app>')
22
+ end
23
+
24
+ def self.dokku_exec(command, options='')
25
+ remote = parse_git_remote
26
+ lines = `ssh -t #{remote[:username]}@#{remote[:host]} #{command} #{remote[:app_name] if is_require_app_name?(command)} #{options} 2> /dev/null`
27
+ lines.strip
28
+ end
29
+
18
30
  end
data/lib/dockland/cli.rb CHANGED
@@ -11,11 +11,15 @@ module Dockland
11
11
  puts "AppName: #{remote[:app_name]}"
12
12
  end
13
13
 
14
+ def help
15
+ puts Dockland.dokku_exec( 'help' )
16
+ end
17
+
14
18
  def method_missing(*args)
15
19
  command, *opt = args
16
- remote = Dockland.dokku_remote
17
- lines = `ssh -t #{remote[:username]}@#{remote[:host]} #{command.to_s} #{remote[:app_name]} #{opt.join(' ')} 2> /dev/null`
18
- puts lines.strip
20
+
21
+ lines = Dockland.dokku_exec( command.to_s, opt.join(' ') )
22
+ puts lines
19
23
  end
20
24
 
21
25
  end
@@ -1,3 +1,3 @@
1
1
  module Dockland
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockland
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - oame
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,6 +61,7 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
+ - CHANGELOG.md
64
65
  - Gemfile
65
66
  - LICENSE.txt
66
67
  - README.md