Class: Archiver

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-flutter/native/archive/archive.rb

Defined Under Namespace

Classes: Dependency, Plugins

Instance Method Summary collapse

Constructor Details

#initialize(module_name, version, sources, flutter_wrapper, pub_upgrade, flutter_version, build_run, working_dir, repo, build_modes) ⇒ Archiver

Returns a new instance of Archiver.



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/cocoapods-flutter/native/archive/archive.rb', line 37

def initialize(module_name, version, sources, flutter_wrapper, pub_upgrade, flutter_version, build_run, working_dir, repo, build_modes)
  @module_name = module_name
  @version = version
  @sources = sources
  @flutter_wrapper = flutter_wrapper
  @pub_upgrade = pub_upgrade
  @flutter_version = flutter_version
  @build_run = build_run
  @working_dir = working_dir
  @product_dir = "#{@working_dir}/.product/"
  @pod_repo = repo
  @build_modes = build_modes
end

Instance Method Details

#archiveObject



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
# File 'lib/cocoapods-flutter/native/archive/archive.rb', line 51

def archive
  # open('http://127.0.0.1:8080/frameworks/download/Flutter/1.22.6/release/file.zip') do |u|
  #   File.open('/Users/dreamtracer/Desktop/flutter.zip', "w+") do |file|
  #     file.write u.read.force_encoding("UTF-8")
  #   end
  # end

  #使用fvm切换flutter 版本
  flutter_sdk_version_switch @flutter_version

  @pub_upgrade ? pub_upgrade : pub_get
  if local_podfile_exists?
    use_local_podfile
  else
    setup_pod_sources
  end

  if @build_run
    excute_build_run
  end

  build_framework
  @plugins = fetch_plugins

  if @build_modes.include?('debug')
    # Debug瘦身
    #thin_arm64 "#{@product_dir}Debug/App.framework/App"
    debug
  end

  if @build_modes.include?('release')
    release
  end

  Pod::UserInterface.message "All is ready to use!, now you can use 'flutter_pod '#{@module_name}', '#{@version}', :mode=>'debug/release' to use the pod"
end