homebrew_automation 0.1.0 → 0.1.2

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: 240ff77ce84a9af442b04b396ddba4f32014d95d02ebf7fda5ff5904e71aa8bf
4
- data.tar.gz: 898384c47dbfee5484b26d4faa5ee2352398c8b8fa2f26b500adcff9e1c1182d
3
+ metadata.gz: 49d776c65c9e87632521fa074eae30c674f541dc8fd5f4ffbe5b1ec522196e62
4
+ data.tar.gz: 42501be3a1f1503901489d1207ab572a1264785a8aebcbba9824ee59513fb09c
5
5
  SHA512:
6
- metadata.gz: ffc1fbb67e9b31b5aeca7b0b11c2f5c6ef6c694e4e4af9bcb1ffbc4a27e20f2be1bbcb1416f4735176543d0ab929519c01e15c51a096fa0400195e796bee97af
7
- data.tar.gz: f6c5a599c570f9183201101fb9197fbf063bffb845bdf343ddf00e91687c41d565f482d2290c46002f0ddb7c2ff24feb6b74a1df6a77e73a8731ae3141665199
6
+ metadata.gz: e3f99f2156856a7489a874953873569c88d42c360334829d33233a7231e7057c1309ad2cf8ad1715e34154444bbb9650ef69acf7472dc8338ba604eee0beab96
7
+ data.tar.gz: a7d2d286cdc1561dfbd80b6cac9e9e246422b162e3f306eb338a2fb82f070fc64100e79deb505bb4430157eed1c0f0cdeeacd8c88ee684e2069d4e2f6d122d00
@@ -11,18 +11,21 @@ module HomebrewAutomation
11
11
  # @param os_name [String] As known by Homebrew, e.g. +el_capitan+
12
12
  # @param filename [String] ???
13
13
  # @param content [String] ???
14
+ # @param keep_tmp [Boolean] pass +--keep-tmp+ to +brew+
14
15
  def initialize(
15
16
  tap_url,
16
17
  formula_name,
17
18
  os_name,
18
19
  filename: nil,
19
- content: nil)
20
+ content: nil,
21
+ keep_tmp: false)
20
22
  @tap_url = tap_url
21
23
  @formula_name = formula_name
22
24
  @os_name = os_name
23
25
  @filename = filename
24
26
  @minus_minus = nil # https://github.com/Homebrew/brew/pull/4612
25
27
  @content = content
28
+ @keep_tmp = keep_tmp
26
29
  end
27
30
 
28
31
  # Takes ages to run, just like if done manually
@@ -30,9 +33,10 @@ module HomebrewAutomation
30
33
  # @raise [StandardError]
31
34
  # @return [nil]
32
35
  def build
33
- die unless system 'brew', 'tap', local_tap_name, @tap_url
34
- die unless system 'brew', 'install', '--verbose', '--build-bottle', @formula_name
35
- die unless system 'brew', 'bottle', '--verbose', '--json', @formula_name
36
+ die unless system 'brew', 'tap', tmp_tap_name, @tap_url
37
+ maybe_keep_tmp = @keep_tmp ? '--keep-tmp' : ''
38
+ die unless system 'brew', 'install', '--verbose', maybe_keep_tmp, '--build-bottle', fully_qualified_formula_name
39
+ die unless system 'brew', 'bottle', '--verbose', '--json', '--no-rebuild', fully_qualified_formula_name
36
40
  end
37
41
 
38
42
  # Read and analyse metadata JSON file
@@ -82,8 +86,12 @@ module HomebrewAutomation
82
86
  private
83
87
 
84
88
  # A name for the temporary tap; doesn't really matter what this is.
85
- def local_tap_name
86
- 'easoncxz/local-tap'
89
+ def tmp_tap_name
90
+ 'easoncxz/tmp-tap'
91
+ end
92
+
93
+ def fully_qualified_formula_name
94
+ tmp_tap_name + '/' + @formula_name
87
95
  end
88
96
 
89
97
  def die
@@ -9,6 +9,11 @@ module HomebrewAutomation
9
9
 
10
10
  class MyCliApp < Thor
11
11
 
12
+ desc 'version', 'version of homebrew_automation'
13
+ def version
14
+ puts HomebrewAutomation::VERSION
15
+ end
16
+
12
17
  desc 'formula (...)', 'Modify Formula DSL source (read stdin, write stdout)'
13
18
  subcommand "formula", FormulaCommands
14
19
 
@@ -21,13 +21,15 @@ class HomebrewAutomation::CLI::WorkflowCommands < Thor
21
21
  class_option :bintray_repo
22
22
  class_option :bintray_package
23
23
  class_option :bintray_version
24
+ class_option :keep_tap_repo, :type => :boolean
24
25
 
25
26
  desc 'build-and-upload', 'Build binary tarball from source tarball, then upload to Bintray'
26
27
  long_desc <<-HERE_HERE
27
28
  Since we're uploading to Bintray, we need a Bintray API KEY at `bintray_token`.
28
29
  HERE_HERE
30
+ option :keep_brew_tmp, :type => :boolean
29
31
  def build_and_upload
30
- workflow.build_and_upload_bottle(sdist, tap, formula_name, bintray_version)
32
+ workflow.build_and_upload_bottle(sdist, tap, formula_name, bintray_version, keep_homebrew_tmp: option[:keep_brew_tmp])
31
33
  end
32
34
 
33
35
  desc 'gather-and-publish', 'Make the Tap aware of new Bottles'
@@ -50,11 +52,16 @@ class HomebrewAutomation::CLI::WorkflowCommands < Thor
50
52
  options[:source_tag])
51
53
  end
52
54
 
55
+ def keep_tap_repo?
56
+ options[:keep_tap_repo]
57
+ end
58
+
53
59
  def tap
54
60
  HomebrewAutomation::Tap.new(
55
61
  options[:tap_user],
56
62
  options[:tap_repo],
57
- options[:tap_token])
63
+ options[:tap_token],
64
+ keep_submodule: keep_tap_repo?)
58
65
  end
59
66
 
60
67
  # DOC: default values here
@@ -2,6 +2,6 @@
2
2
  module HomebrewAutomation
3
3
 
4
4
  # Yep.
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.2'
6
6
 
7
7
  end
@@ -19,7 +19,7 @@ module HomebrewAutomation
19
19
  # @param formula_name [String] the name of the formula in the Tap
20
20
  # @param bversion [Bintray::Version]
21
21
  # @return [Bottle]
22
- def build_and_upload_bottle(sdist, tap, formula_name, bversion)
22
+ def build_and_upload_bottle(sdist, tap, formula_name, bversion, keep_homebrew_tmp: false)
23
23
  os_name = MacOS.identify_version
24
24
  tap.with_git_clone do
25
25
  tap.on_formula(formula_name) do |formula|
@@ -28,7 +28,7 @@ module HomebrewAutomation
28
28
  tap.git_commit_am "Throwaway commit; just for building bottles"
29
29
 
30
30
  local_tap_url = File.realpath('.')
31
- bottle = Bottle.new(local_tap_url, formula_name, os_name)
31
+ bottle = Bottle.new(local_tap_url, formula_name, os_name, keep_tmp: keep_homebrew_tmp)
32
32
  bottle.build
33
33
 
34
34
  # Bintray auto-creates Versions on file-upload.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homebrew_automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - easoncxz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-14 00:00:00.000000000 Z
11
+ date: 2019-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec