weexbuilder 0.0.1
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 +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +13 -0
- data/LICENSE +21 -0
- data/bin/weexbuilder +5 -0
- data/lib/platform.rb +19 -0
- data/lib/platform_ios.rb +38 -0
- data/lib/project.rb +61 -0
- data/lib/runner.rb +60 -0
- data/weexbuilder.gemspec +26 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 98deaad15194bd841da29382c8558ce440e30a29
|
4
|
+
data.tar.gz: d29fd5c4da1369ad75da2c16c1c39ac6a6640fb0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 499b296337bffeb320bcb7107f8703fdf20deedabe406f54018cc5b162bb6ecb8d0df92b921073f2aaaa9dc79d09f9ab41a03bc222f75150d8db29a5192cc17c
|
7
|
+
data.tar.gz: 59226c1e5f97c386a972e3358e3d75b50884bf00f9076ec4d352606b6869613f5dca75d0fcc8b86262e78d9f6f1cfaeaf0df7fc567b18628fc180b2b2930fea9
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 huzhitui
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/bin/weexbuilder
ADDED
data/lib/platform.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby -W
|
2
|
+
|
3
|
+
require_relative 'platform_ios'
|
4
|
+
|
5
|
+
module WeexBuilder
|
6
|
+
module Platform
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def add(platform, name)
|
10
|
+
Dir.mkdir("Platforms") unless Dir.exist?('Platforms')
|
11
|
+
return puts "The platform already exist." if WeexBuilder::Project.platform_exist?(platform)
|
12
|
+
|
13
|
+
Dir.mkdir("Platforms/#{platform}")
|
14
|
+
if /iOS/ =~ platform
|
15
|
+
WeexBuilder::IOSProject.create(name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/platform_ios.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby -W
|
2
|
+
|
3
|
+
module WeexBuilder
|
4
|
+
module IOSProject
|
5
|
+
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def create(project_name)
|
9
|
+
# Clone the ios template project
|
10
|
+
template_url = "http://git.yanzijia.cn/huzhitui/__WEEX_TEMPLATE__iOS.git"
|
11
|
+
project_dir = File.join(Dir.pwd, 'Platforms/iOS', "#{project_name}")
|
12
|
+
return unless system "git clone #{template_url} #{project_dir}"
|
13
|
+
|
14
|
+
# Change the dir name
|
15
|
+
Dir.glob("#{project_dir}/__WEEX_TEMPLATE__*").each do |name|
|
16
|
+
cmd = "mv #{name} #{project_dir}/#{project_name}"
|
17
|
+
if /.xcodeproj$/ =~ name
|
18
|
+
cmd << ".xcodeproj"
|
19
|
+
end
|
20
|
+
system cmd
|
21
|
+
end
|
22
|
+
|
23
|
+
# Update the project info.
|
24
|
+
pbxproj = File.join(project_dir, "#{project_name}.xcodeproj", 'project.pbxproj')
|
25
|
+
File.open(pbxproj, 'r') do |output|
|
26
|
+
buffer = output.read.gsub(/__WEEX_TEMPLATE__/, "#{project_name}")
|
27
|
+
File.open(pbxproj, 'w') { |input| input.write(buffer) }
|
28
|
+
end
|
29
|
+
|
30
|
+
# Open the project
|
31
|
+
puts 'The Xcode Project has been Created Successfully.'
|
32
|
+
|
33
|
+
# system 'pod install'
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
data/lib/project.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/env ruby -W
|
2
|
+
require 'json'
|
3
|
+
require_relative 'platform'
|
4
|
+
|
5
|
+
module WeexBuilder
|
6
|
+
module Project
|
7
|
+
|
8
|
+
PACKAGE_JSON_PATH = File.join(Dir.pwd, 'package.json')
|
9
|
+
|
10
|
+
module_function
|
11
|
+
|
12
|
+
def create(name)
|
13
|
+
# puts PACKAGE_JSON_PATH
|
14
|
+
|
15
|
+
if Dir.exist?(File.join(Dir.pwd, "#{name}")) || exist?
|
16
|
+
return puts "A Weex Project Already Exist."
|
17
|
+
end
|
18
|
+
|
19
|
+
template_url = 'http://git.yanzijia.cn/guoyehui/weex-template.git'
|
20
|
+
return unless system "git clone #{template_url} #{name}"
|
21
|
+
packagejson_path = File.join(Dir.pwd, "#{name}", 'package.json')
|
22
|
+
File.open(packagejson_path, 'r') do |output|
|
23
|
+
buffer = output.read.gsub(/__WEEXTEMPLATE__/, "#{name}")
|
24
|
+
File.open(packagejson_path, 'w') { |input| input.write(buffer) }
|
25
|
+
end
|
26
|
+
puts "The Project #{name} Was Created Succeed."
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_platform(platform)
|
30
|
+
return puts 'A Weex Project does Not Found.' unless exist?
|
31
|
+
|
32
|
+
if /ios/i =~ platform
|
33
|
+
platform = "iOS"
|
34
|
+
else
|
35
|
+
platform = "Android"
|
36
|
+
end
|
37
|
+
|
38
|
+
WeexBuilder::Platform.add(platform, project_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
def remove_platform(platform)
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def project_name
|
47
|
+
return unless exist?
|
48
|
+
json = File.read(PACKAGE_JSON_PATH)
|
49
|
+
JSON.parse(json)["name"]
|
50
|
+
end
|
51
|
+
|
52
|
+
def exist?
|
53
|
+
File.exist?(PACKAGE_JSON_PATH)
|
54
|
+
end
|
55
|
+
|
56
|
+
def platform_exist?(platform)
|
57
|
+
Dir.glob("Platforms/#{platform}").length > 0
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
data/lib/runner.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby -W
|
2
|
+
|
3
|
+
# weexb create demo
|
4
|
+
|
5
|
+
require_relative 'project'
|
6
|
+
|
7
|
+
module WeexBuilder
|
8
|
+
class Runner
|
9
|
+
def initialize(args)
|
10
|
+
@args = args
|
11
|
+
end
|
12
|
+
|
13
|
+
# create
|
14
|
+
# platform add ios/android
|
15
|
+
def exec
|
16
|
+
return usage if @args.length == 0
|
17
|
+
|
18
|
+
case @args.first
|
19
|
+
when 'create'
|
20
|
+
return action_usage(@args.first) unless @args.length == 2
|
21
|
+
WeexBuilder::Project.create(@args[1])
|
22
|
+
when 'platform'
|
23
|
+
return action_usage(@args.first) unless @args.length == 3
|
24
|
+
return action_usage(@args.first) unless @args[1] == 'add' && /^(iOS|android)$/i =~ @args[2]
|
25
|
+
|
26
|
+
WeexBuilder::Project.add_platform(@args[2])
|
27
|
+
else
|
28
|
+
usage
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def action_usage(name)
|
35
|
+
case name
|
36
|
+
when 'create'
|
37
|
+
puts 'Please Use: weexbuilder create YOUR_PROJECTNAME'
|
38
|
+
when 'platform'
|
39
|
+
puts 'Please Use: weexbuilder platform add iOS/android'
|
40
|
+
else
|
41
|
+
usage
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def usage
|
46
|
+
puts <<-"..."
|
47
|
+
Usage:
|
48
|
+
|
49
|
+
$ weexbuilder COMMAND [ACTION]
|
50
|
+
|
51
|
+
Commands:
|
52
|
+
|
53
|
+
+ create Create a new weex Project
|
54
|
+
+ platform
|
55
|
+
|
56
|
+
...
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
data/weexbuilder.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "gem2/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "weexbuilder"
|
8
|
+
spec.version = '0.0.1'
|
9
|
+
spec.authors = ["huluobo"]
|
10
|
+
spec.email = ["hujewelz@163.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{gem test}
|
13
|
+
spec.description = %q{A gem test test test.}
|
14
|
+
spec.homepage = "http://git.yanzijia.cn/huzhitui/weexBuilder.git"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "bin"
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'json', '~> 2.1'
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: weexbuilder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- huluobo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
description: A gem test test test.
|
42
|
+
email:
|
43
|
+
- hujewelz@163.com
|
44
|
+
executables:
|
45
|
+
- weexbuilder
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE
|
52
|
+
- bin/weexbuilder
|
53
|
+
- lib/platform.rb
|
54
|
+
- lib/platform_ios.rb
|
55
|
+
- lib/project.rb
|
56
|
+
- lib/runner.rb
|
57
|
+
- weexbuilder.gemspec
|
58
|
+
homepage: http://git.yanzijia.cn/huzhitui/weexBuilder.git
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.5.2
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: gem test
|
82
|
+
test_files: []
|