ormdev 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/ormdev +5 -0
- data/lib/ormdev/command/create.rb +53 -0
- data/lib/ormdev/command/package.rb +0 -0
- data/lib/ormdev/command/push.rb +0 -0
- data/lib/ormdev/command.rb +20 -0
- data/lib/ormdev/source/core/create_helper.rb +131 -0
- data/lib/ormdev/source/util/log_util.rb +15 -0
- data/lib/ormdev/source/util/sh_util.rb +80 -0
- data/lib/ormdev/version.rb +1 -1
- data/lib/ormdev.rb +1 -0
- data/ormdev.gemspec +21 -7
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaa6f40f14ace8560f3e083effef9da172c6f0bd137bbf150816b27200d31d7b
|
4
|
+
data.tar.gz: f60a3f50414e664d2b0042034e3ee850c7d34ce2dccdc2d973326123de7aa769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbd23e30f20ac7ebf18e4259fe884c7fc8fb712fa3bf81fe0ff159a7f48384c07b7df75d0c63696c498e22653edcaccd63fad247698d468aeaef0935a4c2041f
|
7
|
+
data.tar.gz: 285967cd22e1908eb553fe46e4a7f5982ea1f0e36ae9e9c64b1747859a21612d69c8433e1dc436316323ec56448b3405d4aedde2b2938854b471f819334e03de
|
data/Gemfile.lock
CHANGED
data/bin/ormdev
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative '../source/core/create_helper'
|
2
|
+
|
3
|
+
module Ormdev
|
4
|
+
class Command
|
5
|
+
class Create < Command
|
6
|
+
self.summary = '创建Orm插件模板工程。'
|
7
|
+
|
8
|
+
self.description = <<-DESC
|
9
|
+
新建 iOS => Application => Single View Application 工程,工程名为`NAME`
|
10
|
+
DESC
|
11
|
+
|
12
|
+
self.arguments = [
|
13
|
+
CLAide::Argument.new('NAME', true)
|
14
|
+
]
|
15
|
+
|
16
|
+
def self.options
|
17
|
+
[
|
18
|
+
['--template-url=URL', 'Orm插件模板git地址'],
|
19
|
+
['--fast', '快速创建Orm插件模板工程(带测试用例)'],
|
20
|
+
['--prefix=XXX', 'Orm插件模板工程前缀(fast有效)'],
|
21
|
+
['--skip', '跳过打开Orm插件模板工程(fast有效)'],
|
22
|
+
].concat(super)
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@name = argv.shift_argument
|
27
|
+
@template_url = argv.option('template-url')
|
28
|
+
@prefix = argv.option('prefix', '')
|
29
|
+
@fast = argv.flag?('fast', false)
|
30
|
+
@skip = argv.flag?('skip', false)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate!
|
35
|
+
super
|
36
|
+
help! 'A name for the Pod is required.' unless @name
|
37
|
+
help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
|
38
|
+
help! 'The Pod name cannot contain plusses.' if @name =~ /\+/
|
39
|
+
help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
|
40
|
+
end
|
41
|
+
|
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}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'claide'
|
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
|
20
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
module ORM
|
4
|
+
class CreateHelper
|
5
|
+
|
6
|
+
ORM_PLUGIN_TEMPLATE_URL = "https://gitee.com/mvn/pod-template.git".freeze
|
7
|
+
|
8
|
+
attr_reader :project_name
|
9
|
+
attr_reader :class_prefix
|
10
|
+
attr_reader :template_url
|
11
|
+
|
12
|
+
def initialize(name, prefix = '', template_url = ORM_TEMPLATE_TAG_VERSION)
|
13
|
+
@project_name = name
|
14
|
+
@class_prefix = prefix
|
15
|
+
@template_url = template_url
|
16
|
+
end
|
17
|
+
|
18
|
+
def setup(fast = false, skip= false)
|
19
|
+
if fast then
|
20
|
+
p '1111111======='
|
21
|
+
p Ormdev::SHUtil.run('ls -la')
|
22
|
+
else
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Clones the template from the remote in the working directory using
|
28
|
+
# the name of the Pod.
|
29
|
+
#
|
30
|
+
# @return [void]
|
31
|
+
#
|
32
|
+
def clone_template
|
33
|
+
Pod::UI.section("Cloning `#{template_repo_url}` into `#{@project_name}`.") do
|
34
|
+
svn! ['checkout', template_repo_url, @project_name]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Runs the template configuration utilities.
|
39
|
+
#
|
40
|
+
# @return [void]
|
41
|
+
#
|
42
|
+
def setup
|
43
|
+
string_replacements = {
|
44
|
+
# "PROJECT_OWNER" => @configurator.user_name,
|
45
|
+
"TODAYS_DATE" => Time.now.strftime("%m/%d/%Y"),
|
46
|
+
"TODAYS_YEAR" => Time.now.year.to_s,
|
47
|
+
"PROJECT" => @project_name,
|
48
|
+
"OrmPro" => @class_prefix
|
49
|
+
}
|
50
|
+
Dir.glob(project_folder + "/**/**/**/**").each do |name|
|
51
|
+
next if Dir.exists? name
|
52
|
+
text = File.read(name)
|
53
|
+
|
54
|
+
for find, replace in string_replacements
|
55
|
+
text = text.gsub(find, replace)
|
56
|
+
end
|
57
|
+
|
58
|
+
File.open(name, "w") { |file| file.puts text }
|
59
|
+
end
|
60
|
+
|
61
|
+
# shared schemes have project specific names
|
62
|
+
scheme_path = project_folder + "/PROJECT.xcodeproj/xcshareddata/xcschemes/"
|
63
|
+
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")
|
65
|
+
|
66
|
+
# 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")
|
82
|
+
reinitialize_svn_repo
|
83
|
+
"#{@project_name}.xcodeproj"
|
84
|
+
end
|
85
|
+
|
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}`."
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
#----------------------------------------#
|
97
|
+
|
98
|
+
# !@group Private helpers
|
99
|
+
|
100
|
+
extend Pod::Executable
|
101
|
+
executable :svn
|
102
|
+
|
103
|
+
def project_folder
|
104
|
+
@project_name
|
105
|
+
end
|
106
|
+
|
107
|
+
def reinitialize_svn_repo
|
108
|
+
`rm -rf .svn`
|
109
|
+
end
|
110
|
+
|
111
|
+
def safe_rename_dir(old, dir_name)
|
112
|
+
if Dir.exist? old
|
113
|
+
File.rename(old, dir_name)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def safe_rename_file(old, file_name)
|
118
|
+
if File.exist? old
|
119
|
+
File.rename(old, file_name)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Checks if a template URL is given else returns the TEMPLATE_REPO URL
|
124
|
+
#
|
125
|
+
# @return String
|
126
|
+
#
|
127
|
+
def template_repo_url
|
128
|
+
@template_url || ORM_TEMPLATE_TAG_URL
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'fastlane'
|
2
|
+
|
3
|
+
require_relative '../util/log_util'
|
4
|
+
|
5
|
+
module Ormdev
|
6
|
+
class SHUtil
|
7
|
+
|
8
|
+
# 工具方法
|
9
|
+
def self.run_command(command, message = '', abort = true)
|
10
|
+
result = system(command) if command.is_a?(String)
|
11
|
+
ORM::LogUtil.print_command message
|
12
|
+
unless result then
|
13
|
+
ORM::LogUtil.print_error "操作内容:#{message}\n操作命令:#{command}"
|
14
|
+
abort(message) if abort
|
15
|
+
end
|
16
|
+
result
|
17
|
+
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
|
+
end
|
80
|
+
end
|
data/lib/ormdev/version.rb
CHANGED
data/lib/ormdev.rb
CHANGED
data/ormdev.gemspec
CHANGED
@@ -2,17 +2,31 @@
|
|
2
2
|
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "ormdev/version"
|
5
|
+
require 'date'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "ormdev"
|
8
9
|
spec.version = Ormdev::VERSION
|
10
|
+
spec.date = Date.today
|
9
11
|
spec.authors = ["ormdev"]
|
10
12
|
spec.email = ["ormdev@163.com"]
|
11
13
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{
|
14
|
-
spec.homepage = "https://gitee.com/mvn/ormdev
|
14
|
+
spec.summary = %q{Hybrid App(混合模式移动应用)核心打包工具.技术支持:devorm@163.com.}
|
15
|
+
spec.description = %q{Hybrid App,混合模式移动应用,兼具“Native App良好用户交互体验的优势”和“Web App跨平台开发的优势”。 }
|
16
|
+
spec.homepage = "https://gitee.com/mvn/ormdev"
|
15
17
|
spec.license = "MIT"
|
18
|
+
spec.post_install_message = %q(
|
19
|
+
_____ __ __ ________
|
20
|
+
/ ___ \ / / / / / _ _ /
|
21
|
+
/ / / // /_/ / / // // /
|
22
|
+
/ / / // ____/ / // // /
|
23
|
+
/ /__/ // / / // // /
|
24
|
+
\_____//_/ /_//_//_/
|
25
|
+
|
26
|
+
|
27
|
+
---- 欢迎使用originalm ----
|
28
|
+
---- 技术支持:devorm@163.com ----
|
29
|
+
)
|
16
30
|
|
17
31
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
32
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
@@ -20,8 +34,8 @@ Gem::Specification.new do |spec|
|
|
20
34
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
35
|
|
22
36
|
# spec.metadata["homepage_uri"] = spec.homepage
|
23
|
-
# spec.metadata["source_code_uri"] = "
|
24
|
-
# spec.metadata["changelog_uri"] = "
|
37
|
+
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
38
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
25
39
|
# else
|
26
40
|
# raise "RubyGems 2.0 or newer is required to protect against " \
|
27
41
|
# "public gem pushes."
|
@@ -32,8 +46,8 @@ Gem::Specification.new do |spec|
|
|
32
46
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
47
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
48
|
end
|
35
|
-
spec.bindir = "
|
36
|
-
spec.executables = spec.files.grep(%r{^
|
49
|
+
spec.bindir = "bin"
|
50
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
37
51
|
spec.require_paths = ["lib"]
|
38
52
|
|
39
53
|
spec.add_development_dependency "bundler", "~> 1.17"
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ormdev
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,10 +52,13 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description: 'Hybrid App,混合模式移动应用,兼具“Native App良好用户交互体验的优势”和“Web App跨平台开发的优势”。 '
|
56
56
|
email:
|
57
57
|
- ormdev@163.com
|
58
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- console
|
60
|
+
- ormdev
|
61
|
+
- setup
|
59
62
|
extensions: []
|
60
63
|
extra_rdoc_files: []
|
61
64
|
files:
|
@@ -69,15 +72,26 @@ files:
|
|
69
72
|
- README.md
|
70
73
|
- Rakefile
|
71
74
|
- bin/console
|
75
|
+
- bin/ormdev
|
72
76
|
- bin/setup
|
73
77
|
- lib/ormdev.rb
|
78
|
+
- lib/ormdev/command.rb
|
79
|
+
- lib/ormdev/command/create.rb
|
80
|
+
- lib/ormdev/command/package.rb
|
81
|
+
- lib/ormdev/command/push.rb
|
82
|
+
- lib/ormdev/source/core/create_helper.rb
|
83
|
+
- lib/ormdev/source/util/log_util.rb
|
84
|
+
- lib/ormdev/source/util/sh_util.rb
|
74
85
|
- lib/ormdev/version.rb
|
75
86
|
- ormdev.gemspec
|
76
|
-
homepage: https://gitee.com/mvn/ormdev
|
87
|
+
homepage: https://gitee.com/mvn/ormdev
|
77
88
|
licenses:
|
78
89
|
- MIT
|
79
90
|
metadata: {}
|
80
|
-
post_install_message:
|
91
|
+
post_install_message: "\n _____ __ __ ________\n / ___ \\
|
92
|
+
/ / / / / _ _ /\n / / / // /_/ / / // // /\n / / / // ____/
|
93
|
+
/ // // /\n / /__/ // / / // // /\n \\_____//_/ /_//_//_/\n\n\n
|
94
|
+
\ ---- 欢迎使用originalm ----\n ---- 技术支持:devorm@163.com ----\n "
|
81
95
|
rdoc_options: []
|
82
96
|
require_paths:
|
83
97
|
- lib
|
@@ -96,5 +110,5 @@ rubyforge_project:
|
|
96
110
|
rubygems_version: 2.7.8
|
97
111
|
signing_key:
|
98
112
|
specification_version: 4
|
99
|
-
summary:
|
113
|
+
summary: Hybrid App(混合模式移动应用)核心打包工具.技术支持:devorm@163.com.
|
100
114
|
test_files: []
|