fjords 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fjords.rb +2 -0
- data/lib/fjords/rake_task.rb +59 -0
- data/lib/fjords/version.rb +1 -1
- metadata +5 -4
data/lib/fjords.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
require 'fjords-client'
|
4
|
+
|
5
|
+
module Fjords
|
6
|
+
class RakeTask < ::Rake::TaskLib
|
7
|
+
include ::Rake::DSL if defined?(::Rake::DSL)
|
8
|
+
|
9
|
+
attr_accessor :name, :username, :password, :domain, :path#, :domain_file
|
10
|
+
|
11
|
+
def initialize(*args, &task_block)
|
12
|
+
@name = args.shift || :fjords
|
13
|
+
|
14
|
+
desc "Push files to Fjords" unless ::Rake.application.last_comment
|
15
|
+
|
16
|
+
task name, *args do |_, task_args|
|
17
|
+
RakeFileUtils.send(:verbose, verbose) do
|
18
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
19
|
+
run_task
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def run_task
|
25
|
+
if !::Fjords::Client.logged_in?
|
26
|
+
if !username || !password
|
27
|
+
puts "Username and password are required"
|
28
|
+
exit(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
::Fjords::Client.login(username, password)
|
32
|
+
end
|
33
|
+
|
34
|
+
push_path = path || Dir.pwd
|
35
|
+
|
36
|
+
# puts "Deploying..."
|
37
|
+
cmd = "bundle exec fjords push"
|
38
|
+
cmd << %Q{ --path="#{push_path}" --no-progress}
|
39
|
+
|
40
|
+
if domain
|
41
|
+
cmd << %Q{ --domain="#{opts.domain}"}
|
42
|
+
cmd << %Q{ --overwrite}
|
43
|
+
end
|
44
|
+
# cmd << %Q{ --domain-file="#{opts.domain_file}"} if opts.domain_file
|
45
|
+
|
46
|
+
require 'pty'
|
47
|
+
begin
|
48
|
+
PTY.spawn(cmd) do |stdin, stdout, pid|
|
49
|
+
begin
|
50
|
+
stdin.each { |line| print line }
|
51
|
+
rescue Errno::EIO
|
52
|
+
end
|
53
|
+
end
|
54
|
+
rescue PTY::ChildExited
|
55
|
+
# puts "The child process exited!"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/fjords/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fjords
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: interact
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/fjords/cli/core.rb
|
93
93
|
- lib/fjords/cli/runner.rb
|
94
94
|
- lib/fjords/cli/usage.rb
|
95
|
+
- lib/fjords/rake_task.rb
|
95
96
|
- lib/fjords/version.rb
|
96
97
|
homepage: ''
|
97
98
|
licenses: []
|
@@ -107,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
108
|
version: '0'
|
108
109
|
segments:
|
109
110
|
- 0
|
110
|
-
hash:
|
111
|
+
hash: 3796084122860717256
|
111
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
113
|
none: false
|
113
114
|
requirements:
|
@@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
117
|
version: '0'
|
117
118
|
segments:
|
118
119
|
- 0
|
119
|
-
hash:
|
120
|
+
hash: 3796084122860717256
|
120
121
|
requirements: []
|
121
122
|
rubyforge_project:
|
122
123
|
rubygems_version: 1.8.23
|