ggake 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8acf208f18f947732119742f7024dcffe17ae1b4
4
- data.tar.gz: 5273da07661b680cde7813112ebe0c101aa23cda
3
+ metadata.gz: 245474a7744115acb7e5bdd76b43eb4d089c8b33
4
+ data.tar.gz: 5301e6c86b04e2e38cf4141535ee319343d51dfe
5
5
  SHA512:
6
- metadata.gz: 326e0bd7fc67d74ed49ffa77705e2ec74caabd59c421d00975a6906325d99b6f80b294634a4182cb35173eb0769c75600714cdf94120fe3eb2b3c5d8e000a9a1
7
- data.tar.gz: 5d985a7ad39a35bc2d6c7d7dcfeedd886af615f3ea4cf94bbe8649cd27f51e18f8cff4ded910b482fe9e0ee5939fdc5cf44ea23333bea5f8968918f1f2b90455
6
+ metadata.gz: 2903a147203bdf23c7b5e85c8155d993ab3179b11101386735f3d6b2420e2f34d20cc7c09909620bd3f0c21ed262dfd33c1ba162218679e08cce91f915fbbf3f
7
+ data.tar.gz: e7eb5e085ef706b4bec0eb70d644aa7e4dbb493c27288afde41ad0a7ac39534efa5ff0b2153fd7dd24e347e4dc538ee27656827e3f86d40ec2f11ffd3f90d0f3
data/README.md CHANGED
@@ -36,6 +36,14 @@ This gem provides the following utilities:
36
36
 
37
37
  * `cloud_cp`: Simple copy of a directory to an S3, or other cloud
38
38
  storage, bucket.
39
+
40
+ * `foreman`: Runs Heroku's foreman tool in a clean environment.
41
+
42
+ * `heroku`: Runs the Heroku command in a clean environment.
43
+
44
+ * `heroku_config_get`: Returns the value of an environment variable set for a particular Heroku app.
45
+
46
+ * `dbdeploy`: Runs [DBDeploy][dbd] to migrate your database
39
47
 
40
48
  More detailed usage below.
41
49
 
@@ -62,6 +70,26 @@ More detailed usage below.
62
70
  secret_key: aws_secret_key
63
71
  },
64
72
  public: true)
73
+
74
+ ### foreman
75
+
76
+ foreman [[name, "value"]] "<foreman command line here>"
77
+
78
+ ### heroku
79
+
80
+ heroku ["cmd" "args"]
81
+
82
+ ### heroku_config_get
83
+
84
+ heroku_config_get "var", "heroku-app-name"
85
+
86
+ ### dbdebploy
87
+
88
+ dbdeploy classpath: "path to DBDeploy jar and DB driver jar", db_url: "DB URL to migrate",
89
+ user: "User name", password: "password", driver: "Java class name for DB driver",
90
+ migrations: "directory containing migration scripts"
91
+
92
+ The `driver` defaults to PostgreSQL. The `migrations` directory defaults to `src/db/migrations`, relative to the `Rakefile`. The `password` will not appear on any command line, or in any build logs.
65
93
 
66
94
  ## Contributing
67
95
 
@@ -70,3 +98,5 @@ More detailed usage below.
70
98
  3. Commit your changes (`git commit -am 'Add some feature'`)
71
99
  4. Push to the branch (`git push origin my-new-feature`)
72
100
  5. Create new Pull Request
101
+
102
+ [dbd]: http://dbdeploy.com/
data/ggake.gemspec CHANGED
@@ -18,10 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "rake"
21
+ spec.add_runtime_dependency "rake"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
25
24
  spec.add_development_dependency "rspec"
26
25
  spec.add_development_dependency "aruba"
27
26
  spec.add_development_dependency "fog"
@@ -0,0 +1,27 @@
1
+ require 'open3'
2
+
3
+ module Rake
4
+ module DSL
5
+
6
+ def dbdeploy(opts)
7
+ opts[:driver] ||= 'org.postgresql.Driver'
8
+ opts[:migrations] ||= 'src/db/migrations'
9
+ opts[:password] = "\n" if !opts[:password] || opts[:password].empty?
10
+
11
+ java_args = ["-cp", opts[:classpath],
12
+ "com.dbdeploy.CommandLineTarget",
13
+ "--driver", opts[:driver],
14
+ "--url", opts[:db_url],
15
+ '--scriptdirectory', opts[:migrations],
16
+ '--userid', opts[:user],
17
+ '--password']
18
+ Open3.popen2("java", *java_args) do |i, o, w|
19
+ i.print opts[:password]
20
+ i.close
21
+
22
+ $stdout.print(o.gets)
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,44 @@
1
+ require 'bundler'
2
+
3
+ module Rake
4
+ module DSL
5
+
6
+ def foreman(env_vars, cmd)
7
+ Bundler.with_clean_env do
8
+ sh "#{env_vars.collect { |var| var.join('=') }.join(' ')} foreman #{cmd}"
9
+ end
10
+ end
11
+
12
+ def heroku(*cmd_args)
13
+ Bundler.with_clean_env do
14
+ sh "heroku #{ cmd_args.join(' ') }"
15
+ end
16
+ end
17
+
18
+ def heroku_config_get(var, app)
19
+ Bundler.with_clean_env do
20
+ `heroku config:get #{var} --app #{app}`.chomp
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+
27
+ class HerokuApp
28
+ include Rake::DSL
29
+
30
+ def initialize(name, heroku_name = nil)
31
+ @name, @heroku_name = name, heroku_name
32
+ @heroku_name ||= @name
33
+ end
34
+
35
+ def package(artefact)
36
+ mkdir_p "package/#{@name}"
37
+ cp "heroku/Procfile.#{@name}", "package/#{@name}/Procfile"
38
+ cp artefact, "package/#{@name}"
39
+ end
40
+
41
+ def push
42
+ heroku "push package/#{@name} --app #{@heroku_name}"
43
+ end
44
+ end
data/lib/ggake/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ggake
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/ggake.rb CHANGED
@@ -4,3 +4,5 @@ require "ggake/haml"
4
4
  require "ggake/coffee"
5
5
  require "ggake/transient"
6
6
  require "ggake/cloud_cp"
7
+ require "ggake/heroku"
8
+ require "ggake/dbdeploy"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ggake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giles Alexander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-25 00:00:00.000000000 Z
11
+ date: 2014-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -131,7 +117,9 @@ files:
131
117
  - lib/ggake.rb
132
118
  - lib/ggake/cloud_cp.rb
133
119
  - lib/ggake/coffee.rb
120
+ - lib/ggake/dbdeploy.rb
134
121
  - lib/ggake/haml.rb
122
+ - lib/ggake/heroku.rb
135
123
  - lib/ggake/transient.rb
136
124
  - lib/ggake/version.rb
137
125
  - spec/cloud_cp_spec.rb
@@ -157,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
145
  version: '0'
158
146
  requirements: []
159
147
  rubyforge_project:
160
- rubygems_version: 2.0.3
148
+ rubygems_version: 2.2.1
161
149
  signing_key:
162
150
  specification_version: 4
163
151
  summary: A collection of useful Rake utilities