railsdocks 1.0.1 → 1.1.0
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 +4 -4
- data/lib/railsdocks/cli.rb +109 -1
- data/lib/railsdocks/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee057c9a4fb29cb3002d6dd8eaac99bab25b44cd4650eb42a5940c9da1e7b239
|
|
4
|
+
data.tar.gz: ad097635e565df2cd32f882db1a0881382e762e3590f1add79347b3140eb294d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8298495d87240c7e310c123ad76d1c6daa3cf2596b1d8307728f33b66bf84e6fac2af39cf42fb0456d256a5f5586eaff2750cc33651aeda39d5c1c2a136d580d
|
|
7
|
+
data.tar.gz: 83d0a1b2a5b3cca7d362bb2e712564626ac6ad730aa8eae86eca0201c45e3d730f97dcff330f82445d80c1f3c598364f17059c8eb0a7212089fc7bdffba3ec8c
|
data/lib/railsdocks/cli.rb
CHANGED
|
@@ -183,6 +183,7 @@ module RailsDocks
|
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
if inside_git_repository?
|
|
186
|
+
configure_production_credentials_key
|
|
186
187
|
add_git_remote(git_url)
|
|
187
188
|
else
|
|
188
189
|
puts
|
|
@@ -339,7 +340,8 @@ module RailsDocks
|
|
|
339
340
|
1
|
|
340
341
|
rescue KeyError
|
|
341
342
|
warn(
|
|
342
|
-
"Destroy failed: RailsDocks returned "
|
|
343
|
+
"Destroy failed: RailsDocks returned " \
|
|
344
|
+
"an unexpected response."
|
|
343
345
|
)
|
|
344
346
|
1
|
|
345
347
|
end
|
|
@@ -673,6 +675,109 @@ module RailsDocks
|
|
|
673
675
|
match[:slug]
|
|
674
676
|
end
|
|
675
677
|
|
|
678
|
+
def self.configure_production_credentials_key
|
|
679
|
+
key_path =
|
|
680
|
+
File.join(
|
|
681
|
+
"config",
|
|
682
|
+
"credentials",
|
|
683
|
+
"production.key"
|
|
684
|
+
)
|
|
685
|
+
|
|
686
|
+
unless File.file?(key_path)
|
|
687
|
+
warn
|
|
688
|
+
warn(
|
|
689
|
+
"Production credentials key not found at " \
|
|
690
|
+
"#{key_path}."
|
|
691
|
+
)
|
|
692
|
+
warn(
|
|
693
|
+
"RailsDocks could not add it to the deployment."
|
|
694
|
+
)
|
|
695
|
+
return
|
|
696
|
+
end
|
|
697
|
+
|
|
698
|
+
configure_dockerignore_for_production_key
|
|
699
|
+
add_production_key_to_git(key_path)
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
def self.configure_dockerignore_for_production_key
|
|
703
|
+
dockerignore_path =
|
|
704
|
+
".dockerignore"
|
|
705
|
+
|
|
706
|
+
return unless File.file?(
|
|
707
|
+
dockerignore_path
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
exception =
|
|
711
|
+
"!/config/credentials/production.key"
|
|
712
|
+
|
|
713
|
+
lines =
|
|
714
|
+
File.readlines(
|
|
715
|
+
dockerignore_path,
|
|
716
|
+
chomp: true
|
|
717
|
+
)
|
|
718
|
+
|
|
719
|
+
return if lines.include?(
|
|
720
|
+
exception
|
|
721
|
+
)
|
|
722
|
+
|
|
723
|
+
File.open(
|
|
724
|
+
dockerignore_path,
|
|
725
|
+
"a"
|
|
726
|
+
) do |file|
|
|
727
|
+
file.puts unless File.zero?(
|
|
728
|
+
dockerignore_path
|
|
729
|
+
)
|
|
730
|
+
|
|
731
|
+
file.puts exception
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
_output,
|
|
735
|
+
error,
|
|
736
|
+
status =
|
|
737
|
+
Open3.capture3(
|
|
738
|
+
"git",
|
|
739
|
+
"add",
|
|
740
|
+
dockerignore_path
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
unless status.success?
|
|
744
|
+
warn(
|
|
745
|
+
"Could not stage .dockerignore: " \
|
|
746
|
+
"#{error.strip}"
|
|
747
|
+
)
|
|
748
|
+
return
|
|
749
|
+
end
|
|
750
|
+
|
|
751
|
+
puts(
|
|
752
|
+
"Production credentials key allowed " \
|
|
753
|
+
"through .dockerignore."
|
|
754
|
+
)
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
def self.add_production_key_to_git(key_path)
|
|
758
|
+
_output,
|
|
759
|
+
error,
|
|
760
|
+
status =
|
|
761
|
+
Open3.capture3(
|
|
762
|
+
"git",
|
|
763
|
+
"add",
|
|
764
|
+
"-f",
|
|
765
|
+
key_path
|
|
766
|
+
)
|
|
767
|
+
|
|
768
|
+
unless status.success?
|
|
769
|
+
warn(
|
|
770
|
+
"Could not add production credentials key: " \
|
|
771
|
+
"#{error.strip}"
|
|
772
|
+
)
|
|
773
|
+
return
|
|
774
|
+
end
|
|
775
|
+
|
|
776
|
+
puts(
|
|
777
|
+
"Production credentials key added for deployment."
|
|
778
|
+
)
|
|
779
|
+
end
|
|
780
|
+
|
|
676
781
|
def self.add_git_remote(git_url)
|
|
677
782
|
_output,
|
|
678
783
|
_error,
|
|
@@ -772,6 +877,9 @@ module RailsDocks
|
|
|
772
877
|
private_class_method \
|
|
773
878
|
:inside_git_repository?,
|
|
774
879
|
:current_app_slug,
|
|
880
|
+
:configure_production_credentials_key,
|
|
881
|
+
:configure_dockerignore_for_production_key,
|
|
882
|
+
:add_production_key_to_git,
|
|
775
883
|
:add_git_remote,
|
|
776
884
|
:help
|
|
777
885
|
end
|
data/lib/railsdocks/version.rb
CHANGED