jets 1.0.3 → 1.0.4

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
  SHA256:
3
- metadata.gz: 9c68122c5a2a85bb9081c2c20f383014bfce1109efe241a0db1762958064ad4a
4
- data.tar.gz: 6de016056f47eb36e5156017f3fd218b1a3a57ce3b890617fb7d07997c38b794
3
+ metadata.gz: ddb22c9d9b8de3f074f3365fb40ce6f0a5aa5e745ae51ae7d295c5b21929b3c2
4
+ data.tar.gz: 0d990945082be50bbce002a6c0b0232560f2ea17553b5b642dd96eb17264832e
5
5
  SHA512:
6
- metadata.gz: 1a1386fbe1a7e225f27116dcb23b9e272aeaf84992383b1e08f90d3fc1d2e72c69f487c7f5c223b178362eb772695ac6f6426b1f2d4c4248a9e6dcdc5342ae49
7
- data.tar.gz: b316f857d5277fb166e0e45e8674fedf8803e6b280b8212600f24967abcf01b6110ccd9fb330295c057aed95a722100f29f6288dc8756000cfcb844eb61cd210
6
+ metadata.gz: 8d4340fe4a89c7f482a37e6f22161a49edc2cbd6e9c1d3b02279b2a01bd3e4ee44137f2eee93a868623351655a0fb6c7683808a21816bf196b91e9de26f589ec
7
+ data.tar.gz: ee828e0a8f06ff7122fc273f854719fe9256150a18d9c418620d4d009b54871fa2f1040bdae3c083022cd80470dce1ae5057b41c4f0e12a4eb4f1122c343faab
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [1.0.4]
7
+ - import:rails reconfigure database.yml pull request #56 from tongueroo/database-yml
8
+
6
9
  ## [1.0.3]
7
10
  - Allow control to prewarming of rack endpoint more
8
11
  - add config.prewarm.rack_ratio setting pull request #55 from tongueroo/prewarm-rack-more
data/Gemfile.lock CHANGED
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (1.0.3)
14
+ jets (1.0.4)
15
15
  actionpack (>= 5.2.1)
16
16
  actionview (>= 5.2.1)
17
17
  activerecord (>= 5.2.1)
@@ -114,7 +114,7 @@ GEM
114
114
  crass (~> 1.0.2)
115
115
  nokogiri (>= 1.5.9)
116
116
  memoist (0.16.0)
117
- method_source (0.9.0)
117
+ method_source (0.9.1)
118
118
  mimemagic (0.3.2)
119
119
  mini_portile2 (2.3.0)
120
120
  minitest (5.11.3)
@@ -28,11 +28,25 @@ CODE
28
28
  end
29
29
  end
30
30
 
31
- def copy_database_yaml
32
- src = "#{Jets.root}config/database.yml"
33
- dest = "#{Jets.root}rack/config/database.yml"
34
- puts "Copying #{src} to #{dest}"
35
- FileUtils.cp(src, dest)
31
+ def reconfigure_database_yml
32
+ current_yaml = "#{Jets.root}rack/config/database.yml"
33
+ return unless File.exist?(current_yaml)
34
+
35
+ vars = {}
36
+ data = YAML.load_file(current_yaml)
37
+ # Grab values from current database.yml
38
+ %w[development test production].each do |env|
39
+ vars["database_#{env}"] = data[env]['database']
40
+ end
41
+ vars['adapter'] = data['development']['adapter']
42
+
43
+ path = File.expand_path("templates/config/database.yml", File.dirname(__FILE__))
44
+ content = Jets::Erb.result(path, vars)
45
+ IO.write(current_yaml, content)
46
+ puts "Reconfigured #{current_yaml}"
47
+ rescue Exception
48
+ # If unable to copy the database.yml settings just slightly fail.
49
+ # Do this because really unsure what is in the current database.yml
36
50
  end
37
51
 
38
52
  def finish_message
@@ -48,12 +62,14 @@ CODE
48
62
 
49
63
  The catchall route passes any route not handled by the Jets app as a request onto the Rails app. You can modified the route to selectively route what you want.
50
64
 
65
+ Please double check that rack/config/database.yml is appropriately configured, it likely needs to be updated.
66
+
51
67
  Test the application locally. Test that the Rails app in the rack subfolder works independently. You can start the application up with:
52
68
 
53
69
  cd rack # cd into the imported Rails project
54
70
  bundle exec rackup
55
71
 
56
- The rack server starts up on http://localhost:9292 You might have to make sure that the database is configured.
72
+ The rack server starts up on http://localhost:9292
57
73
 
58
74
  Once tested, stop that server with CTRL-C.
59
75
 
@@ -0,0 +1,26 @@
1
+ default: &default
2
+ adapter: <%= @adapter %>
3
+ encoding: utf8
4
+ pool: <%%= ENV["DB_POOL"] || 5 %>
5
+ database: <%%= ENV['DB_NAME'] || '<%= @database_development %>' %>
6
+ <% if @adapter == 'mysql' -%>
7
+ username: <%%= ENV['DB_USER'] || 'root' %>
8
+ <% else -%>
9
+ username: <%%= ENV['DB_USER'] || ENV['USER'] %>
10
+ <% end -%>
11
+ password: <%%= ENV['DB_PASS'] %>
12
+ host: <%%= ENV["DB_HOST"] %>
13
+ url: <%%= ENV['DATABASE_URL'] %> # takes higher precedence than other settings
14
+
15
+ development:
16
+ <<: *default
17
+ database: <%%= ENV['DB_NAME'] || '<%= @database_development %>' %>
18
+
19
+ test:
20
+ <<: *default
21
+ database: <%= @database_test %>
22
+
23
+ production:
24
+ <<: *default
25
+ database: <%= @database_production %>
26
+ url: <%%= ENV['DATABASE_URL'] %>
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-02 00:00:00.000000000 Z
11
+ date: 2018-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -525,6 +525,7 @@ files:
525
525
  - lib/jets/commands/import/rack.rb
526
526
  - lib/jets/commands/import/rail.rb
527
527
  - lib/jets/commands/import/sequence.rb
528
+ - lib/jets/commands/import/templates/config/database.yml
528
529
  - lib/jets/commands/import/templates/submodules-cheatsheet.md
529
530
  - lib/jets/commands/main.rb
530
531
  - lib/jets/commands/markdown.rb