kalipso 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/VERSION +1 -1
- data/kalipso.gemspec +2 -1
- data/lib/kalipso.rb +12 -1
- data/lib/kalipso/cli.rb +19 -1
- data/lib/kalipso/public_key.rb +22 -0
- metadata +4 -3
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/kalipso.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kalipso}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Paul Campbell"]
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"kalipso.gemspec",
|
31
31
|
"lib/kalipso.rb",
|
32
32
|
"lib/kalipso/cli.rb",
|
33
|
+
"lib/kalipso/public_key.rb",
|
33
34
|
"lib/kalipso/site.rb"
|
34
35
|
]
|
35
36
|
s.homepage = %q{http://github.com/paulca/kalipso}
|
data/lib/kalipso.rb
CHANGED
@@ -13,6 +13,7 @@ require 'pathname'
|
|
13
13
|
|
14
14
|
# models
|
15
15
|
require 'kalipso/site'
|
16
|
+
require 'kalipso/public_key'
|
16
17
|
|
17
18
|
# app
|
18
19
|
Dir[File.expand_path('app/*/*.rb', __FILE__)].each do |file|
|
@@ -35,4 +36,14 @@ else
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
Jaysus::Remote.base_url = "http://#{token}:x@oncalypso.com/api/v1"
|
39
|
+
Jaysus::Remote.base_url = "http://#{token}:x@oncalypso.com/api/v1"
|
40
|
+
|
41
|
+
if !Jaysus::Local.store_dir.join('keys').exist?
|
42
|
+
key_dir = Jaysus::Local.store_dir.join('keys')
|
43
|
+
key_dir.mkpath unless key_dir.exist?
|
44
|
+
key_path = key_dir.join('id_rsa')
|
45
|
+
public_key_path = key_dir.join('id_rsa.pub')
|
46
|
+
puts "generating and uploading public key"
|
47
|
+
`ssh-keygen -N '' -t rsa -q -f #{key_path.to_s.strip}`
|
48
|
+
Kalipso::PublicKey::Remote.create(:key => public_key_path.read)
|
49
|
+
end
|
data/lib/kalipso/cli.rb
CHANGED
@@ -67,6 +67,23 @@ module Kalipso
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
desc "fetch", "download a site and link to to a directory"
|
71
|
+
def fetch(name)
|
72
|
+
site = Site::Remote.find_by_name(name)
|
73
|
+
if site.present?
|
74
|
+
puts "fetching #{site.name}"
|
75
|
+
local_site = Site::Local.find_or_create_by_id(site.id)
|
76
|
+
path = File.expand_path("~/Sites/oncalypso/#{name}")
|
77
|
+
pathname = Pathname.new(path)
|
78
|
+
pathname.mkpath unless pathname.exist?
|
79
|
+
local_site.update_attributes(site.attributes.merge(:path => path))
|
80
|
+
`rsync -arvH -e "ssh -i #{Jaysus::Local.store_dir.join('keys', 'id_rsa')}" sites@diddlydum.com:/home/sites/#{site.name}/ #{path.gsub(/\/+$/, '')}/`
|
81
|
+
puts "Site #{name} downloaded to #{path.gsub(/\/+$/, '')}"
|
82
|
+
else
|
83
|
+
"Site #{name} not found. Maybe try 'kalipso sync'"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
70
87
|
desc "upload", "upload a path, eg. kalipso upload SITENAME PATH"
|
71
88
|
def upload(name = nil)
|
72
89
|
if name.present?
|
@@ -81,7 +98,8 @@ module Kalipso
|
|
81
98
|
puts "uploading #{name} from #{path}"
|
82
99
|
if site.path.present?
|
83
100
|
puts "uploading #{site.path} to #{site.name}.oncalypso.com"
|
84
|
-
|
101
|
+
command = %Q[rsync -arvH -e "ssh -i #{Jaysus::Local.store_dir.join('keys', 'id_rsa')}" #{site.path.gsub(/\/+$/, '')}/ sites@diddlydum.com:/home/sites/#{site.name}]
|
102
|
+
`#{command}`
|
85
103
|
puts "#{site.path} uploaded to http://#{site.name}.oncalypso.com"
|
86
104
|
else
|
87
105
|
puts "You need to link this site first"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Kalipso
|
2
|
+
module PublicKey
|
3
|
+
|
4
|
+
class Base < Jaysus::Base
|
5
|
+
primary_key :id
|
6
|
+
attribute :id
|
7
|
+
attribute :key
|
8
|
+
attribute :user_id
|
9
|
+
attribute :created_at
|
10
|
+
attribute :updated_at
|
11
|
+
end
|
12
|
+
|
13
|
+
class Local < Base
|
14
|
+
include Jaysus::Local
|
15
|
+
end
|
16
|
+
|
17
|
+
class Remote < Base
|
18
|
+
include Jaysus::Remote
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kalipso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paul Campbell
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- kalipso.gemspec
|
192
192
|
- lib/kalipso.rb
|
193
193
|
- lib/kalipso/cli.rb
|
194
|
+
- lib/kalipso/public_key.rb
|
194
195
|
- lib/kalipso/site.rb
|
195
196
|
- spec/kalipso_spec.rb
|
196
197
|
- spec/lib/kalipso/cli_spec.rb
|