github_heroku_deployer 0.0.3 → 0.0.4

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.
@@ -1,6 +1,7 @@
1
1
  module GithubHerokuDeployer
2
2
  class Configuration
3
3
  OPTIONS = {
4
+ github_private_key: ENV["GITHUB_PRIVATE_KEY"],
4
5
  github_repo: ENV["GITHUB_REPO"],
5
6
  heroku_api_key: ENV["HEROKU_API_KEY"],
6
7
  heroku_app_name: ENV["HEROKU_APP_NAME"],
@@ -8,10 +8,11 @@ module GithubHerokuDeployer
8
8
  @ssh_enabled = options[:ssh_enabled]
9
9
  @heroku_repo = options[:heroku_repo]
10
10
  @github_repo = options[:github_repo]
11
+ @private_key = options[:github_private_key]
11
12
  end
12
13
 
13
14
  def push_app_to_heroku(remote="heroku", branch="master")
14
- wrapper = GitSSHWrapper.new(private_key_path: "~/.ssh/id_rsa")
15
+ wrapper = ssh_wrapper
15
16
  repo.add_remote("heroku", @heroku_repo) unless repo.remote("heroku").url
16
17
  `cd #{repo.dir}; env #{wrapper.git_ssh} git push -f #{remote} #{branch}`
17
18
  ensure
@@ -54,7 +55,7 @@ module GithubHerokuDeployer
54
55
  def pull
55
56
  wrapper = ssh_wrapper
56
57
  dir = Dir.pwd # need to cd back to here
57
- `cd #{folder}; env #{wrapper.git_ssh} git pull; cd #{dir}`
58
+ `cd #{dir}/#{folder}; env #{wrapper.git_ssh} git pull; cd #{dir}`
58
59
  ensure
59
60
  wrapper.unlink
60
61
  end
@@ -64,17 +65,13 @@ module GithubHerokuDeployer
64
65
  end
65
66
 
66
67
  def ssh_wrapper
67
- # GitSSHWrapper.new(private_key_path: "~/.ssh/id_rsa")
68
68
  GitSSHWrapper.new(private_key_path: private_key_path)
69
69
  end
70
70
 
71
- def private_key
72
- @private_key ||= ENV["GITHUB_PRIVATE_KEY"]
73
- end
74
-
75
71
  def private_key_path
76
- file = Tempfile.new("github_rsa")
77
- file.write(private_key)
72
+ file = Tempfile.new("id_rsa")
73
+ file.write(@private_key)
74
+ file.rewind
78
75
  file.path
79
76
  end
80
77
  end
@@ -1,3 +1,3 @@
1
1
  module GithubHerokuDeployer
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_heroku_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -160,18 +160,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  - - ! '>='
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
- segments:
164
- - 0
165
- hash: -4513785634519590180
166
163
  required_rubygems_version: !ruby/object:Gem::Requirement
167
164
  none: false
168
165
  requirements:
169
166
  - - ! '>='
170
167
  - !ruby/object:Gem::Version
171
168
  version: '0'
172
- segments:
173
- - 0
174
- hash: -4513785634519590180
175
169
  requirements: []
176
170
  rubyforge_project:
177
171
  rubygems_version: 1.8.24