Class: Pod::Command::Bin::Repo::Push

Inherits:
Pod::Command::Bin::Repo show all
Defined in:
lib/cocoapods-bb-bin/command/bin/repo/push.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Bin

#validate!

Methods included from CBin::SpecFilesHelper

#binary_spec, #binary_spec_files, #binary_template_spec, #binary_template_spec_file, #binary_template_spec_files, #clear_binary_spec_file_if_needed, #code_spec, #code_spec_files, #create_binary_spec_file, #find_spec_file, #spec_files

Methods included from CBin::SourcesHelper

#binary_source, #code_source, #sources_manager, #sources_option, #sources_optionV2, #valid_sources, #valid_sourcesV2

Constructor Details

#initialize(argv) ⇒ Push

Returns a new instance of Push.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/cocoapods-bb-bin/command/bin/repo/push.rb', line 34

def initialize(argv)
  @repo = argv.shift_argument
  @podspec = argv.shift_argument
  @binary = argv.flag?('binary')
  @dylib = argv.flag?('dylib', false)
  @loose_options = argv.flag?('loose-options')
  @code_dependencies = argv.flag?('code-dependencies', true)
  @sources = argv.option('sources') || []
  @reserve_created_spec = argv.flag?('reserve-created-spec')
  @template_podspec = argv.option('template-podspec')
  @allow_prerelease = argv.flag?('allow-prerelease')
  @use_static_frameworks = argv.flag?('use-static-frameworks', true)
  @bb_env = argv.flag?('bb-env', false)
  super
  @additional_args = argv.remainder!
end

Class Method Details

.optionsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cocoapods-bb-bin/command/bin/repo/push.rb', line 20

def self.options
  [
    ['--binary', '发布组件的二进制库版本'],
    ['--dylib', '是否生成动态库,默认生成静态库'],
    ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
    ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
    ['--code-dependencies', '使用源码依赖进行 lint'],
    ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
    ['--allow-prerelease', '允许使用 prerelease 的版本 lint'],
    ['--use-static-frameworks', 'Lint uses static frameworks during installation,support modulemap'],
    ['--bb-env', 'bb Company environment(Internal use),support oc、swift project']
  ].concat(Pod::Command::Repo::Push.options).concat(super).uniq
end

Instance Method Details

#runObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/cocoapods-bb-bin/command/bin/repo/push.rb', line 51

def run
  # @bb_env = false
  if @bb_env
    Podfile.execute_with_bin_plugin do
      Podfile.execute_with_use_binaries(!@code_dependencies) do
        build_bb_push
      end
    end
  else
    Podfile.execute_with_bin_plugin do
      Podfile.execute_with_allow_prerelease(@allow_prerelease) do
        Podfile.execute_with_use_binaries(!@code_dependencies) do
          argvs = [
            repo,
            "--sources=#{sources_option(@code_dependencies, @sources)}",
            *@additional_args
          ]
  
          argvs << spec_file if spec_file
  
          if @loose_options
            argvs += ['--allow-warnings', '--use-json']
            if code_spec&.all_dependencies&.any?
              argvs << '--use-libraries'
            end
          end
  
          push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
          push.validate!
          push.run
        end
      end
    end
  end
ensure
  clear_binary_spec_file_if_needed unless @reserve_created_spec
end