heroku_hatchet 0.0.1 → 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8ab96e76acbc9193b2bda5f8ac7ada60364008f2
4
+ data.tar.gz: 794c94bfde39543b8ac96e69321cca5fa9122680
5
+ SHA512:
6
+ metadata.gz: f0be209eafbe2220d4685d373c34b96922e1b427312713e42deba1006954c95031adf3c4f91f72bf1b5cb776503128b05a6c4ad3bef0ef179b80e793507ea4eb
7
+ data.tar.gz: 9844f35fe14d22d00bc2448b209fe8f4754e8df48959b18a6efcaf4ad632d9d21b1b4db7e2b77c0bd4c30265c709521d7b99dc37cd147099e88a8ca1f849fa1d
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  .DS_Store
2
2
  test/fixtures/repos/*
3
+ *.gem
3
4
 
5
+
6
+ Gemfile.lock
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## 0.0.2
2
+
3
+ - Added ability to run inline commands with no block (such as `app.run('ruby -v')`)
4
+
5
+ ## 0.0.1
6
+
7
+ - Initial Release
data/README.md CHANGED
@@ -78,6 +78,16 @@ you can configure the timeout by passing in a second parameter
78
78
  cmd.run("rake test", 180.seconds)
79
79
 
80
80
 
81
+ ## Running One off Commands
82
+
83
+ If you only want to run one command you can call `app.run` without
84
+ passing a block
85
+
86
+ Hatchet::AnvilApp.new("/codetriage").deploy do |app|
87
+ assert_match "1.9.3", app.run("ruby -v")
88
+ end
89
+
90
+
81
91
  ## Testing A Different Buildpack
82
92
 
83
93
  You can specify buildpack to deploy with like so:
data/Rakefile CHANGED
@@ -3,3 +3,5 @@ require 'bundler/gem_tasks'
3
3
 
4
4
  require 'hatchet/tasks'
5
5
 
6
+ task :default => [:test]
7
+
data/bin/hatchet CHANGED
@@ -19,11 +19,12 @@ class HatchetCLI < Thor
19
19
  warn_dot_ignore!
20
20
  puts "Installing repos for hatchet"
21
21
  dirs.each do |directory, git_repo|
22
+ directory = File.expand_path(directory)
22
23
  if Dir[directory].present?
23
- puts "== Detected #{git_repo} in #{directory}, pulling\n"
24
+ puts "== pulling '#{git_repo}' into '#{directory}'\n"
24
25
  pull(directory, git_repo)
25
26
  else
26
- puts "== Did not find #{git_repo} in #{directory}, cloning\n"
27
+ puts "== cloning '#{git_repo}' into '#{directory}'\n"
27
28
  clone(directory, git_repo)
28
29
  end
29
30
  end
@@ -39,9 +40,12 @@ class HatchetCLI < Thor
39
40
  private
40
41
 
41
42
  def warn_dot_ignore!
43
+ return false unless File.exist?('.gitignore')
44
+
42
45
  gitignore = File.open('.gitignore').read
43
- return if gitignore.include?(config.repo_directory_path)
44
- puts "WARNING: add #{File.join(config.repo_directory_path, '*')} to your .gitignore file \n\n"
46
+ repo_path = config.repo_directory_path.gsub(/^\.\//, '') # remove ./ from front of dir
47
+ return if gitignore.include?(repo_path)
48
+ puts "WARNING: add #{File.join(repo_path, '*')} to your .gitignore file \n\n"
45
49
  end
46
50
 
47
51
  def config
data/hatchet.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "hatchet": {"directory": "test/fixtures"},
3
- "rails3": ["sharpstone/codetriage"],
3
+ "rails3": ["sharpstone/rails3_mri_193"],
4
4
  "rails2": ["sharpstone/rails2blog"]
5
5
  }
@@ -72,7 +72,7 @@ module Hatchet
72
72
  set_internal_config!(config)
73
73
  config.each do |(directory, git_repos)|
74
74
  git_repos.each do |git_repo|
75
- git_repo = git_repo.include?("github.com") ? git_repo : "git@github.com:#{git_repo}.git"
75
+ git_repo = git_repo.include?("github.com") ? git_repo : "git://github.com/#{git_repo}.git"
76
76
  repo_name = name_from_git_repo(git_repo)
77
77
  repo_path = File.join(repo_directory_path, directory, repo_name)
78
78
  if repos.key? repo_name
@@ -5,7 +5,7 @@ module Hatchet
5
5
  class ProcessSpawn
6
6
  attr_reader :command, :app, :timeout
7
7
 
8
- TIMEOUT = 20 # seconds to bring up a heroku command like `heroku run bash`
8
+ TIMEOUT = 60 # seconds to bring up a heroku command like `heroku run bash`
9
9
 
10
10
  def initialize(command, app, timeout = nil)
11
11
  @command = command
@@ -14,7 +14,7 @@ module Hatchet
14
14
  end
15
15
 
16
16
  def ready?
17
- `heroku ps -a #{app.name}`.match(/^run.*up.*`#{command}`/).present?
17
+ @ready ||= `heroku ps -a #{app.name}`.match(/^run.*up.*#{command}/).present?
18
18
  end
19
19
 
20
20
  def not_ready?
@@ -34,16 +34,19 @@ module Hatchet
34
34
  def run(&block)
35
35
  raise "need app" unless app.present?
36
36
  raise "need command" unless command.present?
37
- output, input, pid = PTY.spawn("heroku run #{command} -a #{app.name}")
37
+ heroku_command = "heroku run #{command} -a #{app.name}"
38
+ return `#{heroku_command}` if block.blank? # one off command, no block given
39
+
40
+ output, input, pid = PTY.spawn(heroku_command)
38
41
  stream = StreamExec.new(input, output)
39
42
  stream.timeout("waiting for spawn", timeout) do
40
43
  wait_for_spawn!
41
44
  end
42
- raise "Could not run: #{command}" unless self.ready?
45
+ raise "Could not run: '#{command}', command took longer than #{timeout} seconds" unless self.ready?
43
46
  yield stream
44
47
  ensure
45
48
  stream.close if stream.present?
46
49
  Process.kill('TERM', pid) if pid.present?
47
50
  end
48
51
  end
49
- end
52
+ end
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,4 @@
1
+ {
2
+ "hatchet": {"directory": "../.."},
3
+ "rails3": ["sharpstone/rails3_mri_193"]
4
+ }
@@ -2,20 +2,20 @@ require 'test_helper'
2
2
 
3
3
  class AnvilTest < Test::Unit::TestCase
4
4
  def test_deploy
5
- Dir.chdir('test/fixtures/builpacks/null-buildpack') do
6
- Hatchet::AnvilApp.new("codetriage",debug: true).deploy do |app|
7
- assert true
8
- app.run("bash") do |cmd|
9
- # cmd.run("cd public/assets")
5
+ ruby_buildpack_path = File.expand_path 'test/fixtures/buildpacks/heroku-buildpack-ruby'
10
6
 
11
- assert cmd.run("cat Gemfile").include?("gem 'pg'")
7
+ Hatchet::AnvilApp.new("rails3_mri_193", buildpack: ruby_buildpack_path).deploy do |app, heroku, output|
8
+ assert true
12
9
 
13
- # deploying with null buildpack, no assets should be compiled
14
- refute cmd.run("ls public/assets").include?("application.css")
15
- end
10
+ assert_match '1.9.3', app.run("ruby -v")
11
+ app.run("bash") do |cmd|
12
+
13
+ assert cmd.run("cat Gemfile").include?("gem 'pg'")
14
+
15
+ assert cmd.run("ls public/assets").include?("application.css")
16
16
  end
17
+
17
18
  end
18
19
  end
19
20
  end
20
21
 
21
-
@@ -7,17 +7,17 @@ class ConfigTest < Test::Unit::TestCase
7
7
  end
8
8
 
9
9
  def test_config_path_for_name
10
- assert_equal 'test/fixtures/repos/rails3/codetriage', @config.path_for_name('codetriage')
10
+ assert_equal 'test/fixtures/repos/rails3/rails3_mri_193', @config.path_for_name('rails3_mri_193')
11
11
  end
12
12
 
13
13
  def test_config_dirs
14
- expected_dirs = { "test/fixtures/repos/rails3/codetriage" => "git@github.com:sharpstone/codetriage.git",
15
- "test/fixtures/repos/rails2/rails2blog" => "git@github.com:sharpstone/rails2blog.git" }
14
+ expected_dirs = { "test/fixtures/repos/rails3/rails3_mri_193" => "git://github.com/sharpstone/rails3_mri_193.git",
15
+ "test/fixtures/repos/rails2/rails2blog" => "git://github.com/sharpstone/rails2blog.git" }
16
16
  assert_equal expected_dirs, @config.dirs
17
17
  end
18
18
 
19
19
  def test_config_repos
20
- expected_repos = { "codetriage" => "test/fixtures/repos/rails3/codetriage",
20
+ expected_repos = { "rails3_mri_193" => "test/fixtures/repos/rails3/rails3_mri_193",
21
21
  "rails2blog" => "test/fixtures/repos/rails2/rails2blog" }
22
22
  assert_equal expected_repos, @config.repos
23
23
  end
@@ -30,6 +30,7 @@ class ConfigTest < Test::Unit::TestCase
30
30
 
31
31
  def test_github_shortcuts
32
32
  @config.send :init_config!, {"foo" => ["schneems/sextant"]}
33
- assert_equal("git@github.com:schneems/sextant.git", @config.dirs["./repos/foo/sextant"])
33
+ assert_equal("git://github.com/schneems/sextant.git", @config.dirs["./repos/foo/sextant"])
34
34
  end
35
35
  end
36
+
@@ -2,9 +2,10 @@ require 'test_helper'
2
2
 
3
3
  class TriageTest < Test::Unit::TestCase
4
4
  def test_foo
5
- Hatchet::GitApp.new("codetriage").deploy do |app|
5
+ Hatchet::GitApp.new("rails3_mri_193").deploy do |app|
6
6
  assert true
7
- assert app.deployed?
7
+ assert_match '1.9.3', app.run("ruby -v")
8
+
8
9
  app.run("bash") do |cmd|
9
10
  # cmd.run("cd public/assets")
10
11
  assert cmd.run("ls public/assets").include?("application.css")
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_hatchet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Richard Schneeman
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-08 00:00:00.000000000 Z
11
+ date: 2013-05-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: heroku-api
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: anvil-cli
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: excon
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: thor
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  description: Hatchet is a an integration testing library for developing Heroku buildpacks.
@@ -116,6 +103,7 @@ extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
118
105
  - .gitignore
106
+ - CHANGELOG.md
119
107
  - Gemfile
120
108
  - LICENSE.txt
121
109
  - README.md
@@ -132,11 +120,11 @@ files:
132
120
  - lib/hatchet/stream_exec.rb
133
121
  - lib/hatchet/tasks.rb
134
122
  - lib/hatchet/version.rb
135
- - test/fixtures/builpacks/null-buildpack/bin/compile
136
- - test/fixtures/builpacks/null-buildpack/bin/detect
137
- - test/fixtures/builpacks/null-buildpack/bin/release
138
- - test/fixtures/builpacks/null-buildpack/hatchet.json
139
- - test/fixtures/builpacks/null-buildpack/readme.md
123
+ - test/fixtures/buildpacks/null-buildpack/bin/compile
124
+ - test/fixtures/buildpacks/null-buildpack/bin/detect
125
+ - test/fixtures/buildpacks/null-buildpack/bin/release
126
+ - test/fixtures/buildpacks/null-buildpack/hatchet.json
127
+ - test/fixtures/buildpacks/null-buildpack/readme.md
140
128
  - test/hatchet/anvil_test.rb
141
129
  - test/hatchet/config_test.rb
142
130
  - test/hatchet/git_test.rb
@@ -144,36 +132,34 @@ files:
144
132
  homepage: https://github.com/heroku/hatchet
145
133
  licenses:
146
134
  - MIT
135
+ metadata: {}
147
136
  post_install_message:
148
137
  rdoc_options: []
149
138
  require_paths:
150
139
  - lib
151
140
  required_ruby_version: !ruby/object:Gem::Requirement
152
- none: false
153
141
  requirements:
154
- - - ! '>='
142
+ - - '>='
155
143
  - !ruby/object:Gem::Version
156
144
  version: '0'
157
145
  required_rubygems_version: !ruby/object:Gem::Requirement
158
- none: false
159
146
  requirements:
160
- - - ! '>='
147
+ - - '>='
161
148
  - !ruby/object:Gem::Version
162
149
  version: '0'
163
150
  requirements: []
164
151
  rubyforge_project:
165
- rubygems_version: 1.8.24
152
+ rubygems_version: 2.0.2
166
153
  signing_key:
167
- specification_version: 3
154
+ specification_version: 4
168
155
  summary: Hatchet is a an integration testing library for developing Heroku buildpacks.
169
156
  test_files:
170
- - test/fixtures/builpacks/null-buildpack/bin/compile
171
- - test/fixtures/builpacks/null-buildpack/bin/detect
172
- - test/fixtures/builpacks/null-buildpack/bin/release
173
- - test/fixtures/builpacks/null-buildpack/hatchet.json
174
- - test/fixtures/builpacks/null-buildpack/readme.md
157
+ - test/fixtures/buildpacks/null-buildpack/bin/compile
158
+ - test/fixtures/buildpacks/null-buildpack/bin/detect
159
+ - test/fixtures/buildpacks/null-buildpack/bin/release
160
+ - test/fixtures/buildpacks/null-buildpack/hatchet.json
161
+ - test/fixtures/buildpacks/null-buildpack/readme.md
175
162
  - test/hatchet/anvil_test.rb
176
163
  - test/hatchet/config_test.rb
177
164
  - test/hatchet/git_test.rb
178
165
  - test/test_helper.rb
179
- has_rdoc:
@@ -1,5 +0,0 @@
1
- {
2
- "hatchet": {"directory": "../.."},
3
- "rails3": ["sharpstone/codetriage"],
4
- "rails2": ["sharpstone/rails2blog"]
5
- }