sparkle-pack-rails-helpers 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f871d80395025c32734aa094f44ee17c51e947ea
4
+ data.tar.gz: 52ee028547042386138b5b728fd62074e7de273a
5
+ SHA512:
6
+ metadata.gz: eb66db594f530e2aa2d46b3cf2a5c750fa792b21266d91dc02bb410b1a259d87626c251897397ecb324c1ddf27d0e0efd509762aeba7056b111028678a495dd8
7
+ data.tar.gz: 4fa2e9d26269e191844c097c031462ee4ef1ff426af75c6da3565a033dffed75a0ab6a9b0f3cbe8e268b9394e9908b06a2c8b140c20264c3f07c9c918d783fcc
@@ -0,0 +1 @@
1
+ SparkleFormation::SparklePack.register!
@@ -0,0 +1,83 @@
1
+ #
2
+ # Produces Rails-style DATABASE_URL string
3
+ #
4
+ # Usage:
5
+ #
6
+ # registry!(:rails_database_url,
7
+ # adapter: 'mysql2',
8
+ # host: ref!(:db_address),
9
+ # port: 3306,
10
+ # database: ref!(:db_name),
11
+ # username: 'foo',
12
+ # password: 'bar')
13
+ #
14
+ # This is Fn-safe, that is produces the following:
15
+ #
16
+ # { "Fn::Join": [
17
+ # "",
18
+ # [
19
+ # "mysql2", "://", "foo", ":", "bar",
20
+ # {
21
+ # "Ref": "DbAddress"
22
+ # },
23
+ # ":", "3306", "/",
24
+ # {
25
+ # "Ref": "DbName"
26
+ # }
27
+ # ]
28
+ # ]}
29
+ #
30
+ #
31
+ SfnRegistry.register(:rails_database_url) do |args={}|
32
+ if !args[:host]
33
+ raise!("Parameter :host is required. You passed #{args.inspect}")
34
+ end
35
+
36
+ if !args[:port]
37
+ raise!("Parameter :port is required. You passed #{args.inspect}")
38
+ end
39
+
40
+ if !args[:database]
41
+ raise!("Parameter :database is required. You passed #{args.inspect}")
42
+ end
43
+
44
+ if !args[:adapter]
45
+ raise!("Parameter :adapter is required. You passed #{args.inspect}")
46
+ end
47
+
48
+ if !args[:username]
49
+ raise!("Parameter :username is required. You passed #{args.inspect}")
50
+ end
51
+
52
+ if !args[:password]
53
+ raise!("Parameter :password is required. You passed #{args.inspect}")
54
+ end
55
+
56
+ host = args.delete(:host)
57
+ port = args.delete(:port)
58
+ database = args.delete(:database)
59
+ adapter = args.delete(:adapter)
60
+ username = args.delete(:username)
61
+ password = args.delete(:password)
62
+
63
+ result = [adapter, '://']
64
+
65
+ if username && password
66
+ result += [username, ':', password, '@']
67
+ end
68
+
69
+ result += [ host, ':', port, '/', database]
70
+
71
+ first = true
72
+ args.each do |k,v|
73
+ if first
74
+ result << '?'
75
+ first = false
76
+ else
77
+ result << '&'
78
+ end
79
+ result += [k, '=', v]
80
+ end
81
+
82
+ join!(*result)
83
+ end
@@ -0,0 +1,11 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'sparkle-pack-rails-helpers'
3
+ s.version = '0.1.0'
4
+ s.licenses = ['MIT']
5
+ s.summary = 'SparklePack to use while deploying Rails app'
6
+ s.description = 'Generate DATABASE_URL and such'
7
+ s.authors = ['Timur Batyrshin']
8
+ s.email = 'erthad@gmail.com'
9
+ s.homepage = 'https://github.com/timurb/sparkle-pack-rails-helpers'
10
+ s.files = Dir[ 'lib/sparkleformation/registry/*' ] + %w(sparkle-pack-rails-helpers.gemspec lib/sparkle-pack-rails-helpers.rb)
11
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sparkle-pack-rails-helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Timur Batyrshin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Generate DATABASE_URL and such
14
+ email: erthad@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/sparkleformation/registry/rails_database_url.rb
20
+ - sparkle-pack-rails-helpers.gemspec
21
+ - lib/sparkle-pack-rails-helpers.rb
22
+ homepage: https://github.com/timurb/sparkle-pack-rails-helpers
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.0.14.1
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: SparklePack to use while deploying Rails app
46
+ test_files: []