vigetlabs-provisional 2.1.8 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,10 +33,11 @@ Provisional is only tested on Mac OS X. It should also work on Linux. It is not
33
33
  The SCM option can be one of the following ("`project_name`" refers to the value of the --name option):
34
34
 
35
35
  * `git`: creates a git repository in the `project_name` directory.
36
- * `github`: creates a git repository in the `project_name` directory, creates `project_name` on GitHub using the specified credentials, adds it as the "origin" remote, and pushes. (See section below about required configuration.)
36
+ * `github`: creates a git repository in the `project_name` directory, creates `project_name` on GitHub, adds it as the "origin" remote, and pushes. (See section below about required configuration.)
37
37
  * `unfuddle`: creates a git repository in the `project_name` directory, creates a repository called `project_name` under an existing Unfuddle project using the specified credentials, and adds it as the "origin" remote. _You must push manually_ because Unfuddle typically has a lag of a few minutes between when a repository is created and when it can be accessed. (See section below about required configuration.)
38
38
  * `unfuddle_svn`: creates a Subversion repository called `project_name` under an existing Unfuddle project using the specified credentials, and checks it out into the `project_name` directory.
39
39
  * `beanstalk`: creates a Subversion repository called `project_name` on Beanstalk using the specified credentials, and checks it out into the `project_name` directory.
40
+ * `heroku`: creates a git repository in the `project_name` directory, creates an application called `project_name` on Heroku, adds it as the "heroku" remote, and pushes. (See section below about required configuration.)
40
41
 
41
42
  The domain, username, password, and id options are used by certain SCMs to provide information needed to use an API. The documentation on these SCMs (below) will indicate how they are to be used.
42
43
 
@@ -74,6 +75,10 @@ As of this writing (May 2009) [Beanstalk](http://beanstalkapp.com/)'s API is in
74
75
 
75
76
  To use Beanstalk you will need to specify the --domain, ---username and --password options. --domain is used to specify your beanstalkapp.com subdomain. Using a YAML file containing these options is recommended and should be helpful.
76
77
 
78
+ ## Heroku
79
+
80
+ To use [Heroku](http://heroku.com/), you will need to install the Heroku gem with `gem install heroku` and run its command-line tool to enter your Heroku username and password. Since there is already this established convention for Heroku credentials, to prevent redundant configuration, Provisional does not use its own configuration options for Heroku access.
81
+
77
82
  ## Acknowledgements
78
83
 
79
84
  Provisional acknowledges the support of Viewers Like You, and also the following significant contributors:
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 1
4
- :patch: 8
4
+ :patch: 9
@@ -0,0 +1,28 @@
1
+ require 'provisional/scm/git'
2
+ require 'net/http'
3
+ require 'net/https'
4
+ require 'heroku'
5
+
6
+ module Provisional
7
+ module SCM
8
+ class Heroku < Provisional::SCM::Git
9
+ def checkin
10
+ begin
11
+ credentials = File.open(File.join(ENV['HOME'],'.heroku','credentials'),'r').readlines.map{|l| l.chomp}
12
+ rescue
13
+ raise RuntimeError, "Please log into Heroku using the command line tool before using Provisional."
14
+ end
15
+ raise RuntimeError, "Heroku credentials not in expected format" unless credentials.length == 2
16
+ begin
17
+ repo = super
18
+ heroku = ::Heroku::Client.new(credentials[0], credentials[1])
19
+ heroku.create(@options['name'])
20
+ repo.add_remote('heroku', "git@heroku.com:#{@options['name']}.git")
21
+ repo.push(repo.remote('heroku'))
22
+ rescue
23
+ raise RuntimeError, "Repository created locally, but not pushed to Heroku due to exception: #{$!}"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
data/provisional.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{provisional}
5
- s.version = "2.1.8"
5
+ s.version = "2.1.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Mark Cornick"]
9
- s.date = %q{2009-07-22}
9
+ s.date = %q{2009-07-25}
10
10
  s.default_executable = %q{provisional}
11
11
  s.description = %q{Provisional creates a new Rails project, using a standard Rails 2.3 application template, and checks it into a new SCM repository.}
12
12
  s.email = %q{mark@viget.com}
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "lib/provisional/scm/exceptions.reek",
29
29
  "lib/provisional/scm/git.rb",
30
30
  "lib/provisional/scm/github.rb",
31
+ "lib/provisional/scm/heroku.rb",
31
32
  "lib/provisional/scm/svn.rb",
32
33
  "lib/provisional/scm/unfuddle.rb",
33
34
  "lib/provisional/scm/unfuddle_svn.rb",
@@ -38,6 +39,7 @@ Gem::Specification.new do |s|
38
39
  "test/unit/beanstalk_test.rb",
39
40
  "test/unit/git_test.rb",
40
41
  "test/unit/github_test.rb",
42
+ "test/unit/heroku_test.rb",
41
43
  "test/unit/project_test.rb",
42
44
  "test/unit/rails_application_test.rb",
43
45
  "test/unit/svn_test.rb",
@@ -45,17 +47,19 @@ Gem::Specification.new do |s|
45
47
  "test/unit/unfuddle_svn_test.rb",
46
48
  "test/unit/unfuddle_test.rb"
47
49
  ]
50
+ s.has_rdoc = true
48
51
  s.homepage = %q{http://github.com/vigetlabs/provisional}
49
52
  s.rdoc_options = ["--charset=UTF-8"]
50
53
  s.require_paths = ["lib"]
51
54
  s.rubyforge_project = %q{viget}
52
- s.rubygems_version = %q{1.3.4}
55
+ s.rubygems_version = %q{1.3.2}
53
56
  s.summary = %q{Automation for new Rails Projects}
54
57
  s.test_files = [
55
58
  "test/test_helper.rb",
56
59
  "test/unit/beanstalk_test.rb",
57
60
  "test/unit/git_test.rb",
58
61
  "test/unit/github_test.rb",
62
+ "test/unit/heroku_test.rb",
59
63
  "test/unit/project_test.rb",
60
64
  "test/unit/rails_application_test.rb",
61
65
  "test/unit/svn_test.rb",
@@ -0,0 +1,44 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require File.dirname(__FILE__) + '/../../lib/provisional/scm/heroku'
3
+
4
+ class HerokuTest < Test::Unit::TestCase
5
+ def setup
6
+ @scm = new_scm(Provisional::SCM::Heroku)
7
+ end
8
+
9
+ def test_checkin
10
+ stub_git_checkin do |stub|
11
+ stub.expects(:add_remote)
12
+ stub.expects(:push)
13
+ stub.expects(:remote).with('heroku')
14
+ end
15
+
16
+ stub_heroku do |stub|
17
+ stub.expects(:create).returns(true)
18
+ end
19
+
20
+ @scm.checkin
21
+ end
22
+
23
+ def test_checkin_should_fail_if_any_step_raises_any_exception
24
+ stub_git_checkin
25
+
26
+ stub_heroku do |stub|
27
+ stub.expects(:create).raises(RuntimeError)
28
+ end
29
+
30
+ assert_raise RuntimeError do
31
+ @scm.checkin
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def stub_heroku
38
+ credentials = stub(:readlines => %w(username password))
39
+ File.expects(:open).with(File.join(ENV['HOME'],'.heroku','credentials'),'r').returns(credentials)
40
+ heroku = stub
41
+ ::Heroku::Client.expects(:new).with('username', 'password').returns(heroku)
42
+ yield heroku
43
+ end
44
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vigetlabs-provisional
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Cornick
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-22 00:00:00 -07:00
12
+ date: 2009-07-25 00:00:00 -07:00
13
13
  default_executable: provisional
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -74,6 +74,7 @@ files:
74
74
  - lib/provisional/scm/exceptions.reek
75
75
  - lib/provisional/scm/git.rb
76
76
  - lib/provisional/scm/github.rb
77
+ - lib/provisional/scm/heroku.rb
77
78
  - lib/provisional/scm/svn.rb
78
79
  - lib/provisional/scm/unfuddle.rb
79
80
  - lib/provisional/scm/unfuddle_svn.rb
@@ -84,13 +85,14 @@ files:
84
85
  - test/unit/beanstalk_test.rb
85
86
  - test/unit/git_test.rb
86
87
  - test/unit/github_test.rb
88
+ - test/unit/heroku_test.rb
87
89
  - test/unit/project_test.rb
88
90
  - test/unit/rails_application_test.rb
89
91
  - test/unit/svn_test.rb
90
92
  - test/unit/unfuddle_common_test.rb
91
93
  - test/unit/unfuddle_svn_test.rb
92
94
  - test/unit/unfuddle_test.rb
93
- has_rdoc: false
95
+ has_rdoc: true
94
96
  homepage: http://github.com/vigetlabs/provisional
95
97
  post_install_message:
96
98
  rdoc_options:
@@ -121,6 +123,7 @@ test_files:
121
123
  - test/unit/beanstalk_test.rb
122
124
  - test/unit/git_test.rb
123
125
  - test/unit/github_test.rb
126
+ - test/unit/heroku_test.rb
124
127
  - test/unit/project_test.rb
125
128
  - test/unit/rails_application_test.rb
126
129
  - test/unit/svn_test.rb