ormdev 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaa6f40f14ace8560f3e083effef9da172c6f0bd137bbf150816b27200d31d7b
4
- data.tar.gz: f60a3f50414e664d2b0042034e3ee850c7d34ce2dccdc2d973326123de7aa769
3
+ metadata.gz: 0fbabc8c3500cdb0dd3fe8d510f172754c82353c6404113a58de311c62e08809
4
+ data.tar.gz: f1582483ec8ca6c2631f69affe15998e0ded1daf709cf4c56f6ed52941226b37
5
5
  SHA512:
6
- metadata.gz: fbd23e30f20ac7ebf18e4259fe884c7fc8fb712fa3bf81fe0ff159a7f48384c07b7df75d0c63696c498e22653edcaccd63fad247698d468aeaef0935a4c2041f
7
- data.tar.gz: 285967cd22e1908eb553fe46e4a7f5982ea1f0e36ae9e9c64b1747859a21612d69c8433e1dc436316323ec56448b3405d4aedde2b2938854b471f819334e03de
6
+ metadata.gz: 6bb861ab0ac000d8047d2b0892f505cfe3ec3487623e0152ca5aeab38a93e641d38dcf45c7757062b681cbc3f9946e036ec7525867de7a8a07caba10578faeb4
7
+ data.tar.gz: afb19db51b5ab04b4b65c73a4854b2762d6b6a714c81145e4e163cc8a3e4704b5f5a6235f6f5e43b4a9118861f93e7353ee1b967ba3c5ebc9896c7dfceab9376
data/Gemfile.lock CHANGED
@@ -1,35 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ormdev (0.0.2)
4
+ ormdev (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.3)
9
+ minitest (5.11.3)
10
10
  rake (10.4.2)
11
- rspec (3.7.0)
12
- rspec-core (~> 3.7.0)
13
- rspec-expectations (~> 3.7.0)
14
- rspec-mocks (~> 3.7.0)
15
- rspec-core (3.7.1)
16
- rspec-support (~> 3.7.0)
17
- rspec-expectations (3.7.0)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.7.0)
20
- rspec-mocks (3.7.0)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.7.0)
23
- rspec-support (3.7.1)
24
11
 
25
12
  PLATFORMS
26
13
  ruby
27
14
 
28
15
  DEPENDENCIES
29
16
  bundler (~> 1.17)
17
+ minitest (~> 5.0)
30
18
  ormdev!
31
19
  rake (~> 10.0)
32
- rspec (~> 3.0)
33
20
 
34
21
  BUNDLED WITH
35
22
  1.17.1
data/README.md CHANGED
@@ -26,7 +26,7 @@ TODO: Write usage instructions here
26
26
 
27
27
  ## Development
28
28
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
30
 
31
31
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
32
 
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
2
+ require "rake/testtask"
3
3
 
4
- RSpec::Core::RakeTask.new(:spec)
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
5
9
 
6
- task :default => :spec
10
+ task :default => :test
data/bin/ormdev CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'ormdev'
4
4
 
5
- ORM::Command.run(ARGV)
5
+ OrmDev::Command.run(ARGV)
@@ -1,6 +1,6 @@
1
1
  require_relative '../source/core/create_helper'
2
2
 
3
- module Ormdev
3
+ module OrmDev
4
4
  class Command
5
5
  class Create < Command
6
6
  self.summary = '创建Orm插件模板工程。'
@@ -40,13 +40,9 @@ module Ormdev
40
40
  end
41
41
 
42
42
  def run
43
- create = Ormdev::CreateHelper.new(@name, @prefix, @template_url)
44
- create.setup(@fast, @skip)
45
-
46
- create.clone_template
47
- project_name = create.setup
48
- create.print_info
49
- Ormdev::Log.info "【create】Success!!! Please run command:\n cd #{@name} \n orm init #{project_name}"
43
+ create = OrmDev::CreateHelper.new(@name, @fast, @prefix, @template_url)
44
+ create.setup(@skip)
45
+ OrmDev::LogUtil.info "【create】Success!!! "
50
46
  end
51
47
  end
52
48
  end
@@ -0,0 +1,50 @@
1
+ require 'cocoapods'
2
+
3
+ require_relative '../source/util/sh_util'
4
+
5
+ module OrmDev
6
+ class Command
7
+ class Lint < Command
8
+ self.summary = '验证本地插件pod仓库。'
9
+ self.description = <<-DESC
10
+ 插件管理.
11
+ 验证本地插件。
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('PATH', false)
16
+ ]
17
+
18
+ def self.options
19
+ [
20
+ ].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @podspec_file = argv.shift_argument
25
+ @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' }
26
+ super
27
+ end
28
+
29
+ def validate!
30
+ super
31
+ if @podspec_file
32
+ help! "podspec file at #{@podspec_file} does not exist" unless File.exist? @podspec_file
33
+ @podspec_path = @podspec_file
34
+ else
35
+ raise Pod::Informative, 'No podspec file found, please specify one' unless @podspec_files.length > 0
36
+ raise Pod::Informative, 'Multiple podspec file found, please specify one' unless @podspec_files.length == 1
37
+ @podspec_path = @podspec_files.first
38
+ end
39
+ end
40
+
41
+ def run
42
+ super
43
+ OrmDev::LogUtil.info '[插件管理] 验证Pod'.green
44
+ @spec = Pod::Specification.from_file(@podspec_path)
45
+ pod_lint_command = 'pod lib lint --sources=orm,master --allow-warnings --verbose --use-libraries'
46
+ OrmDev::SHUtil.run_command(pod_lint_command,'更验证Pod',false)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,51 @@
1
+ require 'cocoapods'
2
+
3
+ require_relative '../source/core/run_helper'
4
+
5
+ module OrmDev
6
+ class Command
7
+ class Publish < Command
8
+ self.summary = '发布插件'
9
+ self.description = <<-DESC
10
+ 发布插件.
11
+ 指定'插件名.podspec'的路径`PATH`。
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('PATH', false)
16
+ ]
17
+
18
+ def self.options
19
+ [
20
+ ].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @podspec_file = argv.shift_argument
25
+ @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' }
26
+ super
27
+ end
28
+
29
+ def validate!
30
+ super
31
+ # raise Pod::Informative, "No `Cimfile' found in the project directory." unless @cipfile_path.exist?
32
+ if @podspec_file
33
+ help! "podspec file at #{@podspec_file} does not exist" unless File.exist? @podspec_file
34
+ @podspec_path = @podspec_file
35
+ else
36
+ raise Pod::Informative, 'No podspec file found, please specify one' unless @podspec_files.length > 0
37
+ raise Pod::Informative, 'Multiple podspec file found, please specify one' unless @podspec_files.length == 1
38
+ @podspec_path = @podspec_files.first
39
+ end
40
+ end
41
+
42
+ def run
43
+ super
44
+ OrmDev::LogUtil.info '[插件发布] '.green
45
+ installer = OrmDev::RunHelper.new(@podspec_path)
46
+ installer.setup()
47
+ OrmDev::LogUtil.info "Success!!! Please run command:\n orm ipa \#{platform}"
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ require 'cocoapods'
2
+
3
+ require_relative '../source/core/run_helper'
4
+
5
+ module OrmDev
6
+ class Command
7
+ class Run < Command
8
+ self.summary = '运行插件发布整个流程[检查运行环境、framwork、zip]'
9
+ self.description = <<-DESC
10
+ 运行插件发布整个流程.
11
+ 指定'插件名.podspec'的路径`PATH`。
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('PATH', false)
16
+ ]
17
+
18
+ def self.options
19
+ [
20
+ ].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @podspec_file = argv.shift_argument
25
+ @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' }
26
+ super
27
+ end
28
+
29
+ def validate!
30
+ super
31
+ # raise Pod::Informative, "No `Cimfile' found in the project directory." unless @cipfile_path.exist?
32
+ if @podspec_file
33
+ help! "podspec file at #{@podspec_file} does not exist" unless File.exist? @podspec_file
34
+ @podspec_path = @podspec_file
35
+ else
36
+ raise Pod::Informative, 'No podspec file found, please specify one' unless @podspec_files.length > 0
37
+ raise Pod::Informative, 'Multiple podspec file found, please specify one' unless @podspec_files.length == 1
38
+ @podspec_path = @podspec_files.first
39
+ end
40
+ end
41
+
42
+ def run
43
+ super
44
+ OrmDev::LogUtil.info '[插件发布] '.green
45
+ installer = OrmDev::RunHelper.new(@podspec_path)
46
+ installer.setup()
47
+ OrmDev::LogUtil.info "Success!!! Please run command:\n orm ipa \#{platform}"
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,37 @@
1
+ require 'cocoapods'
2
+
3
+ require_relative '../source/util/sh_util'
4
+
5
+ module OrmDev
6
+ class Command
7
+ class Setup < Command
8
+ self.summary = '初始化pod仓库。'
9
+ self.description = <<-DESC
10
+ 初始化pod仓库。
11
+ DESC
12
+
13
+ self.arguments = [
14
+ ]
15
+
16
+ def self.options
17
+ [
18
+ ].concat(super)
19
+ end
20
+
21
+ def initialize(argv)
22
+ super
23
+ end
24
+
25
+ def validate!
26
+ super
27
+ end
28
+
29
+ def run
30
+ super
31
+ OrmDev::LogUtil.info '[插件开发] 初始化pod仓库'.green
32
+ OrmDev::SHUtil.run_command('pod repo add orm https://gitee.com/mvn/ios.git','更验证Pod',false)
33
+ OrmDev::SHUtil.run_command('pod repo update orm','更验证Pod',false)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,20 +1,22 @@
1
1
  require 'claide'
2
2
 
3
- module Ormdev
4
- # class Command < CLAide::Command
5
- #
6
- # require 'ormdev/command/create'
7
- # require 'ormdev/command/package'
8
- # require 'ormdev/command/push'
9
- #
10
- # self.abstract_command = true
11
- # self.command = 'orm'
12
- # self.version = ORM::VERSION
13
- # self.description = 'OriginalM —— 混合模式移动应用(Hybrid App)持续集成(Continuous Integration)工具包,用于构建、编译、测试、分发、部署的工具。'
14
- #
15
- # def run
16
- # ORM::Log.info '* 开始执行orm … *'
17
- # end
18
- #
19
- # end
3
+ module OrmDev
4
+ class Command < CLAide::Command
5
+
6
+ require 'ormdev/command/setup'
7
+ require 'ormdev/command/create'
8
+ require 'ormdev/command/lint'
9
+ require 'ormdev/command/run'
10
+ require 'ormdev/command/publish'
11
+
12
+ self.abstract_command = true
13
+ self.command = 'ormdev'
14
+ self.version = OrmDev::VERSION
15
+ self.description = 'OriginalM —— 混合模式移动应用(Hybrid App)持续集成(Continuous Integration)工具包,用于构建、编译、测试、分发、部署的工具。'
16
+
17
+ def run
18
+ OrmDev::LogUtil.info '* 开始执行orm … *'
19
+ end
20
+
21
+ end
20
22
  end
@@ -1,29 +1,49 @@
1
1
  require 'cocoapods'
2
2
 
3
- module ORM
3
+ require_relative '../util/sh_util'
4
+
5
+ module OrmDev
4
6
  class CreateHelper
5
7
 
6
- ORM_PLUGIN_TEMPLATE_URL = "https://gitee.com/mvn/pod-template.git".freeze
8
+ ORMDEV_PLUGIN_TEMPLATE_URL = 'https://gitee.com/mvn/pod-plugin-template.git'.freeze
9
+ ORMDEV_PLUGIN_FAST_TEMPLATE_URL = 'https://gitee.com/mvn/pod-plugin-fast-template.git'.freeze
7
10
 
11
+ attr_reader :fast_build
8
12
  attr_reader :project_name
9
13
  attr_reader :class_prefix
10
14
  attr_reader :template_url
11
15
 
12
- def initialize(name, prefix = '', template_url = ORM_TEMPLATE_TAG_VERSION)
16
+ def initialize(name, fast = false, prefix = '', template_url = nil)
13
17
  @project_name = name
14
18
  @class_prefix = prefix
15
- @template_url = template_url
19
+ @fast_build = fast
20
+ if @fast_build then
21
+ @template_url = template_url || ORMDEV_PLUGIN_FAST_TEMPLATE_URL
22
+ else
23
+ @template_url = template_url || ORMDEV_PLUGIN_TEMPLATE_URL
24
+ end
16
25
  end
17
26
 
18
- def setup(fast = false, skip= false)
19
- if fast then
20
- p '1111111======='
21
- p Ormdev::SHUtil.run('ls -la')
27
+ def setup(skip= false)
28
+ if @fast_build then
29
+ clone_template
30
+ configure_template(skip)
31
+ print_info
22
32
  else
23
-
33
+ create_command = "pod lib create #{@project_name} --template-url=#{@template_url}"
34
+ OrmDev::SHUtil.run_command(create_command,'创建ORM插件工程')
24
35
  end
25
36
  end
26
37
 
38
+ private
39
+
40
+ #----------------------------------------#
41
+
42
+ # !@group Private helpers
43
+
44
+ extend Pod::Executable
45
+ executable :git
46
+
27
47
  # Clones the template from the remote in the working directory using
28
48
  # the name of the Pod.
29
49
  #
@@ -31,7 +51,7 @@ module ORM
31
51
  #
32
52
  def clone_template
33
53
  Pod::UI.section("Cloning `#{template_repo_url}` into `#{@project_name}`.") do
34
- svn! ['checkout', template_repo_url, @project_name]
54
+ git! ['clone', template_repo_url, @project_name]
35
55
  end
36
56
  end
37
57
 
@@ -39,13 +59,12 @@ module ORM
39
59
  #
40
60
  # @return [void]
41
61
  #
42
- def setup
62
+ def configure_template(skip_open = false)
43
63
  string_replacements = {
44
64
  # "PROJECT_OWNER" => @configurator.user_name,
45
65
  "TODAYS_DATE" => Time.now.strftime("%m/%d/%Y"),
46
66
  "TODAYS_YEAR" => Time.now.year.to_s,
47
- "PROJECT" => @project_name,
48
- "OrmPro" => @class_prefix
67
+ "CIPPROJECT" => @project_name
49
68
  }
50
69
  Dir.glob(project_folder + "/**/**/**/**").each do |name|
51
70
  next if Dir.exists? name
@@ -59,36 +78,45 @@ module ORM
59
78
  end
60
79
 
61
80
  # shared schemes have project specific names
62
- scheme_path = project_folder + "/PROJECT.xcodeproj/xcshareddata/xcschemes/"
81
+ scheme_path = project_folder + "/Example/CIPPROJECT.xcodeproj/xcshareddata/xcschemes/"
82
+
63
83
  raise Pod::Informative, 'No Xcode project shared schemes found, please specify one' unless Dir.exists? scheme_path
64
- File.rename(scheme_path + "PROJECT.xcscheme", scheme_path + @project_name + ".xcscheme")
84
+ File.rename(scheme_path + "CIPPROJECT-Example.xcscheme", scheme_path + @project_name + "-Example.xcscheme")
65
85
 
66
86
  # rename xcproject
67
- File.rename(project_folder + "/PROJECT.xcodeproj", File.join(project_folder, "#{@project_name}.xcodeproj"))
68
-
69
- # change app file prefixes
70
- ["OrmProAppDelegate.h", "OrmProAppDelegate.m"].each do |file|
71
- before = project_folder + "/PROJECT/" + file
72
- next unless File.exists? before
73
-
74
- after = project_folder + "/PROJECT/" + file.gsub("OrmPro", @class_prefix)
75
- File.rename before, after
76
- end
77
- safe_rename_file("#{project_folder}/PROJECTTests/PROJECTTests.m", "#{project_folder}/PROJECTTests/#{@project_name}Tests.m")
78
- safe_rename_file("#{project_folder}/PROJECTUITests/PROJECTUITests.m", "#{project_folder}/PROJECTUITests/#{@project_name}UITests.m")
79
- safe_rename_dir("#{project_folder}/PROJECT", "#{project_folder}/#{@project_name}")
80
- safe_rename_dir("#{project_folder}/PROJECTTests", "#{project_folder}/#{@project_name}Tests")
81
- safe_rename_dir("#{project_folder}/PROJECTUITests", "#{project_folder}/#{@project_name}UITests")
87
+ File.rename(project_folder + "/Example/CIPPROJECT.xcodeproj", File.join(project_folder, "Example/#{@project_name}.xcodeproj"))
88
+
89
+ # # change app file prefixes
90
+ # ["OrmProAppDelegate.h", "OrmProAppDelegate.m"].each do |file|
91
+ # before = project_folder + "/PROJECT/" + file
92
+ # next unless File.exists? before
93
+ #
94
+ # after = project_folder + "/PROJECT/" + file.gsub("OrmPro", @class_prefix)
95
+ # File.rename before, after
96
+ # end
97
+
98
+ # rename project related files
99
+ safe_rename_file("#{project_folder}/Example/CIPPROJECT.xcworkspace", "#{project_folder}/Example/#{@project_name}.xcworkspace")
100
+ safe_rename_file("#{project_folder}/Example/CIPPROJECT/CIPPROJECT-Info.plist", "#{project_folder}/Example/CIPPROJECT/#{@project_name}-Info.plist")
101
+ safe_rename_file("#{project_folder}/Example/CIPPROJECT/CIPPROJECT-Prefix.pch", "#{project_folder}/Example/CIPPROJECT/#{@project_name}-Prefix.pch")
102
+ safe_rename_file("#{project_folder}/Example/CIPPROJECT", "#{project_folder}/Example/#{@project_name}")
103
+ safe_rename_file("#{project_folder}/CIPPROJECT/Classes/CIPPROJECT.h", "#{project_folder}/CIPPROJECT/Classes/#{@project_name}.h")
104
+ safe_rename_file("#{project_folder}/CIPPROJECT/Classes/CIPPROJECT.m", "#{project_folder}/CIPPROJECT/Classes/#{@project_name}.m")
105
+ safe_rename_file("#{project_folder}/CIPPROJECT/Classes/CIPPROJECTAPI.h", "#{project_folder}/CIPPROJECT/Classes/#{@project_name}API.h")
106
+ safe_rename_file("#{project_folder}/CIPPROJECT/Classes/CIPPROJECTConst.h", "#{project_folder}/CIPPROJECT/Classes/#{@project_name}Const.h")
107
+ safe_rename_file("#{project_folder}/CIPPROJECT/Classes/CIPPROJECTConst.m", "#{project_folder}/CIPPROJECT/Classes/#{@project_name}Const.m")
108
+ safe_rename_file("#{project_folder}/CIPPROJECT/Classes/CIPPROJECTMacros.h", "#{project_folder}/CIPPROJECT/Classes/#{@project_name}Macros.h")
109
+ safe_rename_file("#{project_folder}/CIPPROJECT", "#{project_folder}/#{@project_name}")
110
+ safe_rename_file("#{project_folder}/CIPPROJECT.podspec", "#{project_folder}/#{@project_name}.podspec")
82
111
  reinitialize_svn_repo
83
- "#{@project_name}.xcodeproj"
84
- end
85
112
 
86
- # Runs the template configuration utilities.
87
- #
88
- # @return [void]
89
- #
90
- def print_info
91
- Pod::UI.puts "\nTo learn more about the template see `#{template_repo_url}`."
113
+ OrmDev::LogUtil.info "\nRunning " + "pod install".magenta + " on your new library."
114
+ Dir.chdir("#{project_folder}/Example") do
115
+ system "pod install"
116
+ OrmDev::LogUtil.info " open '#{project_folder}/Example/#{@project_name}.xcworkspace'".magenta
117
+ system "open '#{@project_name}.xcworkspace'" unless skip_open
118
+ end
119
+ project_folder
92
120
  end
93
121
 
94
122
  private
@@ -97,9 +125,6 @@ module ORM
97
125
 
98
126
  # !@group Private helpers
99
127
 
100
- extend Pod::Executable
101
- executable :svn
102
-
103
128
  def project_folder
104
129
  @project_name
105
130
  end
@@ -120,12 +145,24 @@ module ORM
120
145
  end
121
146
  end
122
147
 
148
+
149
+
150
+
151
+
152
+ # Runs the template configuration utilities.
153
+ #
154
+ # @return [void]
155
+ #
156
+ def print_info
157
+ Pod::UI.puts "\nTo learn more about the template see `#{template_repo_url}`."
158
+ end
159
+
123
160
  # Checks if a template URL is given else returns the TEMPLATE_REPO URL
124
161
  #
125
162
  # @return String
126
163
  #
127
164
  def template_repo_url
128
- @template_url || ORM_TEMPLATE_TAG_URL
165
+ @template_url || ORM_PLUGIN_TEMPLATE_URL
129
166
  end
130
167
  end
131
168
  end
@@ -0,0 +1,95 @@
1
+ require 'cocoapods'
2
+
3
+ require_relative '../util/sh_util'
4
+
5
+ module OrmDev
6
+ class RunHelper
7
+ attr_reader :spec
8
+
9
+ def initialize(path)
10
+ @spec = Pod::Specification.from_file(path)
11
+ end
12
+
13
+ def setup()
14
+ task_start_time = Time.now
15
+ time_info_logs = ["开始运行:#{task_start_time}"]
16
+ start_time = task_start_time
17
+
18
+ if step == 0 || step == 0 then
19
+ check_environment
20
+ current_time = Time.new
21
+ time_info_logs << "检查运行环境:#{current_time - start_time}秒"
22
+ start_time = current_time
23
+ end
24
+
25
+ if step == 0 || step == 3 then
26
+ pod_package_framwork
27
+ current_time = Time.new
28
+ time_info_logs << "打包静态库:#{current_time - start_time}秒"
29
+ start_time = current_time
30
+ end
31
+
32
+ if step == 0 || step == 5 then
33
+ upload_zip_framwork
34
+ current_time = Time.new
35
+ time_info_logs << "上传静态framework:#{current_time - start_time}秒"
36
+ end
37
+
38
+ time_info_logs << "#{@spec.name}总耗时:#{Time.new - task_start_time}秒"
39
+ puts time_info_logs
40
+ end
41
+
42
+ private
43
+ # 检测运行环境
44
+ def check_environment
45
+ OrmDev::SHUtil.run_command('bundle install','检测配置运行环境',false)
46
+ end
47
+
48
+ # 静态化
49
+ def pod_package_framwork
50
+ pod_package_command = "#{@spec.name}_SOURCE=1 pod package #{@spec.name}.podspec --exclude-deps --no-mangle --force --spec-sources=git@gitee.com:mvn/ios.git,https://github.com/CocoaPods/Specs.git"
51
+ OrmDev::SHUtil.run_command(pod_package_command,'静态化插件')
52
+ destination_path = "#{@spec.name}/lib"
53
+ source_path = "#{@spec.name}-#{@spec.version}"
54
+ FileUtils.rm_rf(destination_path) if Dir.exist?(destination_path)
55
+ FileUtils.cp_r("#{source_path}/ios", destination_path)
56
+ FileUtils.rm_rf(source_path)
57
+ # 去除.a armv7s i386的架构
58
+ Dir.chdir(destination_path) do
59
+ lopo_remove_command = "lipo #{@spec.name}.framework/#{@spec.name} -remove armv7s -remove i386 -output #{@spec.name}.framework/#{@spec.name}"
60
+ lopo_info_command = "lipo -info #{@spec.name}.framework/#{@spec.name}"
61
+ OrmDev::SHUtil.run_command(lopo_remove_command,'移除framework armv7s i386的架构', false)
62
+ OrmDev::SHUtil.run_command(lopo_info_command,'framework支持架构')
63
+ end
64
+ end
65
+
66
+ # 压缩上传
67
+ def upload_zip_framwork
68
+ zip_path = "#{@spec.name}.zip"
69
+ FileUtils.rm_rf(zip_path) if File::exist?(zip_path)
70
+ Zip::File.open(zip_path, Zip::File::CREATE) do |zipfile|
71
+ [
72
+ "#{@spec.name}.podspec",
73
+ 'LICENSE',
74
+ 'README.md',
75
+ 'Dependencies',
76
+ "#{@spec.name}/lib",
77
+ ].each do |filename|
78
+ add_file_to_zip(filename, zipfile)
79
+ end
80
+ end
81
+ zip_path
82
+ OrmDev::LogUtil.print_success "运行成功,#{zip_path}"
83
+ end
84
+
85
+ def add_file_to_zip(file_path, zip)
86
+ if File.directory?(file_path)
87
+ Dir.foreach(file_path) do |sub_file_name|
88
+ add_file_to_zip("#{file_path}/#{sub_file_name}", zip) unless sub_file_name == '.' or sub_file_name == '..'
89
+ end
90
+ else
91
+ zip.add(file_path, file_path)
92
+ end
93
+ end
94
+ end
95
+ end
@@ -1,15 +1,42 @@
1
+ require 'date'
1
2
  require 'logger'
2
3
 
3
- module Ormdev
4
- class Log
5
- ORM_CLT_INFO_LOG_FLAG = '[ORM]'
4
+ module OrmDev
5
+ class LogUtil
6
+
7
+ ORMDEV_CLT_INFO_LOG_FLAG = '[OrmDev]'
6
8
 
7
9
  def self.debug(msg = '')
8
10
  puts msg
9
11
  end
10
12
 
11
13
  def self.info(msg = '')
12
- puts "#{ORM_CLT_INFO_LOG_FLAG}#{msg}"
14
+ puts "#{ORMDEV_CLT_INFO_LOG_FLAG}#{msg}"
15
+ end
16
+
17
+ def self.print_command(content)
18
+ puts content.green.bold
19
+ end
20
+
21
+ def self.print_success(content)
22
+ puts '****************************************'.green
23
+ puts "* #{Time.new} *".green
24
+ puts '* *'.green
25
+ puts '* OK ~ *'.green.bold
26
+ puts '* *'.green
27
+ puts content
28
+ puts '****************************************'.green
29
+ end
30
+
31
+ def self.print_error(content)
32
+ puts '****************************************'.red
33
+ puts "* #{Time.new} *".red
34
+ puts '* *'.red
35
+ puts '* Error ~ *'.red.bold
36
+ puts '* *'.red
37
+ puts content
38
+ puts '****************************************'.red
13
39
  end
40
+
14
41
  end
15
42
  end
@@ -1,80 +1,16 @@
1
- require 'fastlane'
1
+ require_relative 'log_util'
2
2
 
3
- require_relative '../util/log_util'
4
-
5
- module Ormdev
3
+ module OrmDev
6
4
  class SHUtil
7
-
8
5
  # 工具方法
9
6
  def self.run_command(command, message = '', abort = true)
10
7
  result = system(command) if command.is_a?(String)
11
- ORM::LogUtil.print_command message
8
+ OrmDev::LogUtil.print_command message
12
9
  unless result then
13
- ORM::LogUtil.print_error "操作内容:#{message}\n操作命令:#{command}"
10
+ OrmDev::LogUtil.print_error "操作内容:#{message}\n操作命令:#{command}"
14
11
  abort(message) if abort
15
12
  end
16
13
  result
17
14
  end
18
-
19
- # Execute a shell command
20
- # This method will output the string and execute it
21
- # Just an alias for sh_no_action
22
- # When running this in tests, it will return the actual command instead of executing it
23
- # @param log [Boolean] should fastlane print out the executed command
24
- # @param error_callback [Block] a callback invoked with the command output if there is a non-zero exit status
25
- def self.sh(command, log: true, error_callback: nil)
26
- sh_control_output(command, print_command: log, print_command_output: log, error_callback: error_callback)
27
- end
28
-
29
- def self.sh_no_action(command, log: true, error_callback: nil)
30
- sh_control_output(command, print_command: log, print_command_output: log, error_callback: error_callback)
31
- end
32
-
33
- # @param command [String] The command to be executed
34
- # @param print_command [Boolean] Should we print the command that's being executed
35
- # @param print_command_output [Boolean] Should we print the command output during execution
36
- # @param error_callback [Block] A block that's called if the command exits with a non-zero status
37
- def self.sh_control_output(command, print_command: true, print_command_output: true, error_callback: nil)
38
- print_command = print_command_output = true if $troubleshoot
39
- # Set the encoding first, the user might have set it wrong
40
- previous_encoding = [Encoding.default_external, Encoding.default_internal]
41
- Encoding.default_external = Encoding::UTF_8
42
- Encoding.default_internal = Encoding::UTF_8
43
-
44
- command = command.join(' ') if command.kind_of?(Array) # since it's an array of one element when running from the Fastfile
45
- FastlaneCore::UI.command(command) if print_command
46
-
47
- result = ''
48
-
49
- exit_status = nil
50
- IO.popen(command, err: [:child, :out]) do |io|
51
- io.sync = true
52
- io.each do |line|
53
- FastlaneCore::UI.command_output(line.strip) if print_command_output
54
- result << line
55
- end
56
- io.close
57
- exit_status = $?.exitstatus
58
- end
59
-
60
- if exit_status != 0
61
- message = if print_command
62
- "Exit status of command '#{command}' was #{exit_status} instead of 0."
63
- else
64
- "Shell command exited with exit status #{exit_status} instead of 0."
65
- end
66
- message += "\n#{result}" if print_command_output
67
-
68
- error_callback.call(result) if error_callback
69
- FastlaneCore::UI.shell_error!(message)
70
- end
71
-
72
- result
73
- rescue => ex
74
- raise ex
75
- ensure
76
- Encoding.default_external = previous_encoding.first
77
- Encoding.default_internal = previous_encoding.last
78
- end
79
15
  end
80
- end
16
+ end
@@ -1,3 +1,3 @@
1
- module Ormdev
2
- VERSION = "0.0.2"
1
+ module OrmDev
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/ormdev.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "ormdev/version"
2
2
 
3
- module Ormdev
3
+ module OrmDev
4
4
  class Error < StandardError; end
5
5
  # Your code goes here...
6
6
  autoload :Command, 'ormdev/command'
data/ormdev.gemspec CHANGED
@@ -5,16 +5,16 @@ require "ormdev/version"
5
5
  require 'date'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = "ormdev"
9
- spec.version = Ormdev::VERSION
8
+ spec.name = 'ormdev'
9
+ spec.version = OrmDev::VERSION
10
10
  spec.date = Date.today
11
- spec.authors = ["ormdev"]
12
- spec.email = ["ormdev@163.com"]
11
+ spec.authors = ['devorm']
12
+ spec.email = ['devorm@163.com']
13
13
 
14
- spec.summary = %q{Hybrid App(混合模式移动应用)核心打包工具.技术支持:devorm@163.com.}
14
+ spec.summary = %q{Hybrid App(混合模式移动应用)核心打包工具.技术支持:devorm@163.com..}
15
15
  spec.description = %q{Hybrid App,混合模式移动应用,兼具“Native App良好用户交互体验的优势”和“Web App跨平台开发的优势”。 }
16
- spec.homepage = "https://gitee.com/mvn/ormdev"
17
- spec.license = "MIT"
16
+ spec.homepage = 'https://gitee.com/mvn/ormdev'
17
+ spec.license = 'MIT'
18
18
  spec.post_install_message = %q(
19
19
  _____ __ __ ________
20
20
  / ___ \ / / / / / _ _ /
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  # to allow pushing to a single host or delete this section to allow pushing to any host.
33
33
  # if spec.respond_to?(:metadata)
34
34
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
35
-
35
+ #
36
36
  # spec.metadata["homepage_uri"] = spec.homepage
37
37
  # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
38
38
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
@@ -46,11 +46,13 @@ Gem::Specification.new do |spec|
46
46
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
47
47
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
48
48
  end
49
- spec.bindir = "bin"
50
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
51
- spec.require_paths = ["lib"]
49
+ # spec.bindir = "exe"
50
+ spec.bindir = 'bin'
51
+ # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
52
+ spec.executables = ['ormdev']
53
+ spec.require_paths = ['lib']
52
54
 
53
55
  spec.add_development_dependency "bundler", "~> 1.17"
54
56
  spec.add_development_dependency "rake", "~> 10.0"
55
- spec.add_development_dependency "rspec", "~> 3.0"
57
+ spec.add_development_dependency "minitest", "~> 5.0"
56
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ormdev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
- - ormdev
7
+ - devorm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-29 00:00:00.000000000 Z
11
+ date: 2018-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,26 +39,24 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '5.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '5.0'
55
55
  description: 'Hybrid App,混合模式移动应用,兼具“Native App良好用户交互体验的优势”和“Web App跨平台开发的优势”。 '
56
56
  email:
57
- - ormdev@163.com
57
+ - devorm@163.com
58
58
  executables:
59
- - console
60
59
  - ormdev
61
- - setup
62
60
  extensions: []
63
61
  extra_rdoc_files: []
64
62
  files:
@@ -77,9 +75,12 @@ files:
77
75
  - lib/ormdev.rb
78
76
  - lib/ormdev/command.rb
79
77
  - lib/ormdev/command/create.rb
80
- - lib/ormdev/command/package.rb
81
- - lib/ormdev/command/push.rb
78
+ - lib/ormdev/command/lint.rb
79
+ - lib/ormdev/command/publish.rb
80
+ - lib/ormdev/command/run.rb
81
+ - lib/ormdev/command/setup.rb
82
82
  - lib/ormdev/source/core/create_helper.rb
83
+ - lib/ormdev/source/core/run_helper.rb
83
84
  - lib/ormdev/source/util/log_util.rb
84
85
  - lib/ormdev/source/util/sh_util.rb
85
86
  - lib/ormdev/version.rb
@@ -110,5 +111,5 @@ rubyforge_project:
110
111
  rubygems_version: 2.7.8
111
112
  signing_key:
112
113
  specification_version: 4
113
- summary: Hybrid App(混合模式移动应用)核心打包工具.技术支持:devorm@163.com.
114
+ summary: Hybrid App(混合模式移动应用)核心打包工具.技术支持:devorm@163.com..
114
115
  test_files: []
File without changes
File without changes