samus 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/Dockerfile +3 -0
  4. data/Dockerfile.build +2 -0
  5. data/Dockerfile.samus +5 -0
  6. data/LICENSE +0 -0
  7. data/README.md +0 -0
  8. data/Rakefile +8 -11
  9. data/commands/build/archive-git-full.help.md +0 -0
  10. data/commands/build/archive-tgz.help.md +0 -0
  11. data/commands/build/archive-zip.help.md +0 -0
  12. data/commands/build/changelog-parse.help.md +0 -0
  13. data/commands/build/chmod-files.help.md +0 -0
  14. data/commands/build/fs-copy.help.md +0 -0
  15. data/commands/build/fs-mkdir.help.md +0 -0
  16. data/commands/build/fs-rmrf.help.md +0 -0
  17. data/commands/build/fs-sedfiles.help.md +0 -0
  18. data/commands/build/gem-build.help.md +0 -0
  19. data/commands/build/git-archive.help.md +0 -0
  20. data/commands/build/git-clone.help.md +0 -0
  21. data/commands/build/git-commit.help.md +0 -0
  22. data/commands/build/git-merge.help.md +0 -0
  23. data/commands/build/make-task.help.md +0 -0
  24. data/commands/build/npm-pack.help.md +0 -0
  25. data/commands/build/npm-task.help.md +0 -0
  26. data/commands/build/npm-test.help.md +0 -0
  27. data/commands/build/rake-task.help.md +0 -0
  28. data/commands/build/ruby-bundle.help.md +0 -0
  29. data/commands/build/samus-build.help.md +0 -0
  30. data/commands/publish/cf-invalidate.help.md +0 -0
  31. data/commands/publish/gem-push.help.md +0 -0
  32. data/commands/publish/git-push.help.md +0 -0
  33. data/commands/publish/github-release.help.md +0 -0
  34. data/commands/publish/npm-publish.help.md +0 -0
  35. data/commands/publish/s3-put.help.md +0 -0
  36. data/commands/publish/samus-publish.help.md +0 -0
  37. data/entrypoint.sh +0 -0
  38. data/lib/samus.rb +6 -0
  39. data/lib/samus/action.rb +0 -0
  40. data/lib/samus/build_action.rb +0 -0
  41. data/lib/samus/builder.rb +0 -0
  42. data/lib/samus/command.rb +0 -0
  43. data/lib/samus/credentials.rb +0 -0
  44. data/lib/samus/publish_action.rb +0 -0
  45. data/lib/samus/publisher.rb +0 -0
  46. data/lib/samus/rake/samus_task.rb +111 -0
  47. data/lib/samus/version.rb +1 -1
  48. data/samus.gemspec +0 -0
  49. data/samus.json +0 -0
  50. metadata +4 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f02a949de04a9a4ce8c6d63f3e80c1b44636e341f1de08b5f036ff5e996967b
4
- data.tar.gz: c700b3fe01b015074707f261f70c4627549f57de1a424c391ea58dc4d4dbcd85
3
+ metadata.gz: d4ae50bb62ac1a723440bdeb5b2481190be1c4c937decebdd7bf6d372c3b5373
4
+ data.tar.gz: 3c1995481a759d75315aff3498cf92ef2d26e600e0addc833e6ce4b2ee4c1db9
5
5
  SHA512:
6
- metadata.gz: 543d72731d76b7585660fb77a7c4d32ddcdfc5e2c99627964f7ee1a5ba518f2dcb95f12e5835c210916dca02e15834e4467b3e1f67a4d6adc2429498bda926dd
7
- data.tar.gz: 60f25e20948cd58ead46211f88e3fa74abdf3262481b46a777862e8bf489a3b57e1cd17146a5656f02aec529796b7e925f19be8778333fec4b4234d910ab4bf8
6
+ metadata.gz: c33f66b251e307696f80b26fba7a4decc6c9a9a96c9927dbe7cb51a0e341527f78991d8a8b8bddc0a8716e5095246526366a87ab3cee2cd3084e8d98efb9165c
7
+ data.tar.gz: 05b0bd0f94ebb9809521b4eeaac23b7d9d7890667373cabbae7e5779949c8a5c806f103577e2855a4e8976cb0a49bb9d3c433861ca447af72a7013127714dfdb
@@ -1,3 +1,20 @@
1
+ # 3.0.3 - April 1st, 2019
2
+
3
+ - Add `Samus::Rake::ReleaseTask` and `Samus::Rake::DockerReleaseTask` to
4
+ generate helpful Rake tasks to generate releases. Example:
5
+
6
+ ```ruby
7
+ require 'samus'
8
+
9
+ Samus::Rake::ReleaseTask.new do |t|
10
+ t.git_pull_after_release = true # default is true
11
+ t.zipfile = "customzip.tar.gz" # default release-vX.Y.Z.tar.gz
12
+ t.buildfile = "samus.json" # default is samus.json
13
+ end
14
+ ```
15
+
16
+ - Add `lsegal/samus:build` Dockerfile to simplify creation of build docker images.
17
+
1
18
  # 3.0.2 - April 1st, 2019
2
19
 
3
20
  - Add `chmod-files` command to fix file permissions on globs.
@@ -62,3 +79,7 @@
62
79
  # 1.3.0 - July 23, 2014
63
80
 
64
81
  - Fix issue where repository would not reset when using `samus-build` command.
82
+
83
+ ```
84
+
85
+ ```
data/Dockerfile CHANGED
@@ -9,6 +9,9 @@ RUN echo "Host *" > ~/.ssh/config
9
9
  RUN echo " StrictHostKeyChecking no" >> ~/.ssh/config
10
10
  RUN chmod 400 ~/.ssh/config
11
11
 
12
+ RUN git config --global user.email "bot@not.human"
13
+ RUN git config --global user.name "Samus Release Bot"
14
+
12
15
  COPY . /samus
13
16
  ENV PATH=$PATH:/samus/bin
14
17
 
@@ -0,0 +1,2 @@
1
+ FROM lsegal/samus:latest
2
+ ENTRYPOINT samus publish release-v${VERSION}.tar.gz
@@ -0,0 +1,5 @@
1
+ FROM lsegal/samus:build
2
+ ARG VERSION
3
+ ENV VERSION=${VERSION}
4
+ COPY . /build
5
+ RUN samus build ${VERSION}
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -1,17 +1,14 @@
1
- task default: :build
1
+ require_relative './lib/samus'
2
2
 
3
- def docker_cmd
4
- "docker run --rm -v #{Dir.home}:/root:ro -v #{Dir.pwd}:/build lsegal/samus"
5
- end
3
+ task default: 'samus:build'
6
4
 
7
- task :image do
8
- sh "docker build -t lsegal/samus ."
9
- end
5
+ Samus::Rake::DockerReleaseTask.new
10
6
 
11
- task build: :image do
12
- sh "#{docker_cmd} build #{ENV['VERSION']}"
7
+ task :images do
8
+ sh "docker build -t lsegal/samus:latest -f Dockerfile ."
9
+ sh "docker build -t lsegal/samus:build -f Dockerfile.build ."
13
10
  end
14
11
 
15
- task :publish do
16
- sh "#{docker_cmd} publish release-v#{ENV['VERSION']}.tar.gz"
12
+ namespace :samus do
13
+ task build: :images
17
14
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,6 +4,12 @@ require_relative './samus/builder'
4
4
  module Samus
5
5
  CONFIG_PATH = File.expand_path(ENV['SAMUS_CONFIG_PATH'] || '~/.samus')
6
6
 
7
+ module Rake
8
+ # Autoloads
9
+ autoload :ReleaseTask, File.expand_path('samus/rake/samus_task', __dir__)
10
+ autoload :DockerReleaseTask, File.expand_path('samus/rake/samus_task', __dir__)
11
+ end
12
+
7
13
  module_function
8
14
 
9
15
  def config_paths; @@config_paths end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,111 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+
4
+ require_relative '../../samus'
5
+
6
+ module Samus
7
+ module Rake
8
+ module Helpers
9
+ private
10
+
11
+ def release_version
12
+ return @version if defined?(@version)
13
+ raise "Missing VERSION=X.Y.Z" unless ENV['VERSION']
14
+ @version = ENV['VERSION'].sub(/^v/, '')
15
+ end
16
+
17
+ def release_image
18
+ return @image if defined?(@image)
19
+ @image = "samus/release/#{File.basename(Dir.pwd)}:v#{release_version}"
20
+ end
21
+ end
22
+
23
+ class DockerReleaseTask < ::Rake::TaskLib
24
+ include Helpers
25
+
26
+ DEFAULT_DOCKERFILE = "Dockerfile.samus"
27
+
28
+ attr_accessor :dockerfile
29
+
30
+ attr_accessor :delete_image_after_publish
31
+
32
+ attr_accessor :git_pull_before_build
33
+
34
+ attr_accessor :git_pull_after_publish
35
+
36
+ def initialize(namespace = :samus)
37
+ @namespace = namespace
38
+ @dockerfile = DEFAULT_DOCKERFILE
39
+ @delete_image_after_publish = true
40
+ @git_pull_before_build = true
41
+ @git_pull_after_publish = true
42
+ yield self if block_given?
43
+ define
44
+ end
45
+
46
+ private
47
+
48
+ def define
49
+ namespace(@namespace) do
50
+ desc '[VERSION=X.Y.Z] Builds a Samus release using Docker'
51
+ task :build do
52
+ img = release_image
53
+ ver = release_version
54
+ sh "git pull" if git_pull_before_build
55
+ sh "docker build . -t #{img} -f #{dockerfile} --build-arg VERSION=#{ver}"
56
+ end
57
+
58
+ desc '[VERSION=X.Y.Z] Publishes a built release using Docker'
59
+ task :publish do
60
+ img = release_image
61
+ mount = "#{Samus::CONFIG_PATH}:/root/.samus:ro"
62
+ sh "docker run -v #{mount} --rm #{img}"
63
+ sh "docker rmi -f #{img}" if delete_image_after_publish
64
+ sh "git pull" if git_pull_after_publish
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ class ReleaseTask < ::Rake::TaskLib
71
+ include Helpers
72
+
73
+ attr_accessor :git_pull_before_build
74
+ attr_accessor :git_pull_after_publish
75
+ attr_accessor :buildfile
76
+ attr_writer :zipfile
77
+
78
+ def initialize(namespace = :samus)
79
+ @namespace = namespace
80
+ @buildfile = ""
81
+ @zipfile = nil
82
+ @git_pull_before_build = true
83
+ @git_pull_after_publish = true
84
+ yield self if block_given?
85
+ define
86
+ end
87
+
88
+ private
89
+
90
+ def zipfile
91
+ @zipfile || "release-v#{release_version}.tar.gz"
92
+ end
93
+
94
+ def define
95
+ namespace(@namespace) do
96
+ desc '[VERSION=X.Y.Z] Builds a Samus release'
97
+ task :build do
98
+ sh "git pull" if git_pull_before_build
99
+ sh "samus build -o #{zipfile} #{release_version} #{buildfile}"
100
+ end
101
+
102
+ desc '[VERSION=X.Y.Z] Publishes a built release'
103
+ task :publish do
104
+ sh "samus publish #{zipfile}"
105
+ sh "git pull" if git_pull_after_publish
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
@@ -1,3 +1,3 @@
1
1
  module Samus
2
- VERSION = '3.0.2'.freeze
2
+ VERSION = '3.0.3'.freeze
3
3
  end
File without changes
data/samus.json CHANGED
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Segal
@@ -19,6 +19,8 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - CHANGELOG.md
21
21
  - Dockerfile
22
+ - Dockerfile.build
23
+ - Dockerfile.samus
22
24
  - LICENSE
23
25
  - README.md
24
26
  - Rakefile
@@ -89,6 +91,7 @@ files:
89
91
  - lib/samus/credentials.rb
90
92
  - lib/samus/publish_action.rb
91
93
  - lib/samus/publisher.rb
94
+ - lib/samus/rake/samus_task.rb
92
95
  - lib/samus/version.rb
93
96
  - samus.gemspec
94
97
  - samus.json