lib/cocoapods-flutter/command/flutter/archive.rb in cocoapods-flutter-dt-0.0.6 vs lib/cocoapods-flutter/command/flutter/archive.rb in cocoapods-flutter-dt-0.0.7
- old
+ new
@@ -24,10 +24,35 @@
].concat(Pod::Command::Repo::Push.options).concat(super).uniq
end
def initialize(argv)
@module_name = argv.shift_argument
- @version = argv.shift_argument
+ tmp_version = argv.shift_argument
+ #如果满足
+ if tmp_version =~ /([0-9]+\.)+[0-9]+/
+ @version = tmp_version
+ else
+ tmp_str = tmp_version.dup
+ last_v = "0"
+ mid_v = "0"
+ main_v = "0"
+ unless tmp_str.empty?
+ last_v = tmp_str.slice!(tmp_str.length - 1, 1)
+ end
+ unless tmp_str.empty?
+ mid_v = tmp_str.slice!(tmp_str.length - 1, 1)
+ end
+ unless tmp_str.empty?
+ main_v = tmp_str
+ end
+
+ versions = Array.new
+ versions << main_v
+ versions << mid_v
+ versions << last_v
+ @version = versions.join "."
+ end
+
@pod_repo = argv.option('repo', 'master')
@sources = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
@flutter_wrapper = argv.option('wrapper', 'flutter')
@pub_upgrade = argv.flag?('upgrade', true)
@flutter_version = argv.option('flutterversion', '1.12.13')