fjords 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,8 @@ module Fjords
6
6
  autoload :Usage, "#{FJORDS_CLI_ROOT}/cli/usage"
7
7
  autoload :Runner, "#{FJORDS_CLI_ROOT}/cli/runner"
8
8
  end
9
+
10
+ autoload :RakeTask, "#{FJORDS_CLI_ROOT}/rake_task"
9
11
  end
10
12
 
11
13
  require "#{FJORDS_CLI_ROOT}/version"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Fjords
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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.1
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-09 00:00:00.000000000 Z
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: -1246193583979943233
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: -1246193583979943233
120
+ hash: 3796084122860717256
120
121
  requirements: []
121
122
  rubyforge_project:
122
123
  rubygems_version: 1.8.23