gonative-cli 0.5.6 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/gonative/commands/android/create.rb +17 -0
  4. data/lib/gonative/commands/ios/create.rb +1 -1
  5. data/lib/gonative/commands/ios/publish.rb +2 -1
  6. data/lib/gonative/commands.rb +1 -0
  7. data/lib/gonative/plugins/android/create.rb +54 -0
  8. data/lib/gonative/plugins/ios/build_framework.rb +83 -0
  9. data/lib/gonative/plugins/ios/create.rb +1 -55
  10. data/lib/gonative/plugins/ios/verify.rb +0 -15
  11. data/lib/gonative/utils/content_evaluator.rb +16 -0
  12. data/lib/gonative/utils/sanitize_plugin_name.rb +17 -0
  13. data/lib/gonative/utils/template_inflator.rb +38 -8
  14. data/lib/gonative/{plugins.rb → utils.rb} +1 -1
  15. data/lib/gonative/version.rb +1 -1
  16. data/templates/{plugins/ios/common → build/ios}/Podfile.tpl +3 -2
  17. data/templates/{plugins/ios/common → build/ios}/create-framework.sh.tpl +4 -4
  18. data/templates/plugins/android/build.gradle +33 -0
  19. data/templates/plugins/android/consumer-rules.pro +0 -0
  20. data/templates/plugins/android/plugin-metadata.json.tpl +7 -0
  21. data/templates/plugins/android/proguard-rules.pro +21 -0
  22. data/templates/plugins/android/src/main/AndroidManifest.xml.tpl +5 -0
  23. data/templates/plugins/android/src/main/java/io/gonative/android/plugins/JAVA_PACKAGE/PLUGIN_NAME.java.tpl +26 -0
  24. data/templates/plugins/ios/common/LICENSE +1 -19
  25. data/templates/plugins/ios/common/PLUGIN_NAME.podspec.tpl +9 -8
  26. data/templates/plugins/ios/common/plist/Info.plist +7 -0
  27. data/templates/plugins/ios/language-specific/objc/PLUGIN_NAME/Classes/GNPLUGIN_NAME.h.tpl +3 -3
  28. data/templates/plugins/ios/language-specific/objc/PLUGIN_NAME/Classes/GNPLUGIN_NAME.m.tpl +4 -4
  29. data/templates/plugins/ios/language-specific/swift/PLUGIN_NAME/Classes/GNSwiftModule.m.tpl +3 -3
  30. data/templates/plugins/ios/language-specific/swift/PLUGIN_NAME/Classes/GNSwiftModule.swift.tpl +4 -4
  31. metadata +17 -6
  32. data/templates/plugins/ios/common/js/info.plist.json.tpl +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b5265e83ea1fb696fde7c7268dbae499678c2d5b6a20f65af77f461faed3d56
4
- data.tar.gz: 2b4ac25eac3e13767571f6b7206362449eb1943f9cfecd28d33779c291e254ae
3
+ metadata.gz: a5432553e2213fc0208a429d39cb973f3ed7ebd88e76096599882fea9d2195cf
4
+ data.tar.gz: 36543de609799b0308fb891ce7c3ab5921f8fdb98b97d181a660839cc62c40b9
5
5
  SHA512:
6
- metadata.gz: fe8fc2019620d93576c49edfab157e296947da7658beec2baf2dc2fb7550a1c75aa9d68559948b4085500d5fcadfc2baeaa82d0885e669a61b27dd570fd8ae53
7
- data.tar.gz: a75d080664f67c918e1691492ec8248c0808332bac1d14df6755dced4790f566dc38a280575843c324b5b7f0fbbe91eba3141f9036d830026a5c1cb43794d0df
6
+ metadata.gz: df9a65e776646d617a45724e65ae28619b6153b1b65bebdf35c66894c146b82464f5c3d137322bb61b0f78aec08c6d801370758d5bd49ff686b93faad182df51
7
+ data.tar.gz: f2a4bdc82d6a75fc16a86bbe911d6306531b405307efbe1a2d655cfa900bcda1de3dd7ca05161edb7f1feeea76b6a0d346f0dc380ad33f53042308f0cf8b2ba3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gonative-cli (0.5.5)
4
+ gonative-cli (0.7.0)
5
5
  activesupport (~> 6.0)
6
6
  cocoapods (~> 1.10)
7
7
  colorize (~> 0.8.0)
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ module Android
6
+ class Create < Base
7
+ desc 'Create a new android plugin'
8
+
9
+ argument :name, required: true, desc: 'Name of the plugin'
10
+
11
+ def call(name:, **)
12
+ Plugins::Android::Create.call(name)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -7,7 +7,7 @@ module GoNative
7
7
  desc 'Create a new plugin'
8
8
 
9
9
  argument :name, required: true, desc: 'Name of the plugin'
10
- option :language, default: "objc", values: Plugins::IOS::Create::LANGUAGES, desc: "Plugin's language"
10
+ option :language, default: "objc", options: Plugins::IOS::Create::LANGUAGES, desc: "Plugin's language"
11
11
 
12
12
  def call(name:, language:, **)
13
13
  Plugins::IOS::Create.call(name, language)
@@ -8,7 +8,8 @@ module GoNative
8
8
  option :skip_build, type: :boolean, default: false
9
9
 
10
10
  def call(skip_build:, **)
11
- Plugins::IOS::Verify.call unless skip_build
11
+ Plugins::IOS::Verify.call
12
+ Plugins::IOS::BuildFramework.call unless skip_build
12
13
  Plugins::IOS::Release.call
13
14
  end
14
15
  end
@@ -7,5 +7,6 @@ module GoNative
7
7
  register 'version', Version, aliases: %w[--version -v]
8
8
  register 'ios create', IOS::Create
9
9
  register 'ios publish', IOS::Publish
10
+ register 'android create', Android::Create
10
11
  end
11
12
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/string/inflections'
4
+
5
+ module GoNative
6
+ module Plugins
7
+ module Android
8
+ class Create
9
+ autoload :FileUtils, 'fileutils'
10
+
11
+ extend DSL::Serviceable
12
+
13
+ TEMPLATE_DIRECTORY_PATH = File.expand_path(File.join(__dir__, '../../../..', 'templates', 'plugins', 'android'))
14
+
15
+ attr_reader :plugin_name
16
+
17
+ def initialize(plugin_name)
18
+ @plugin_name = Utils::SanitizePluginName.call(plugin_name, 'android')
19
+ end
20
+
21
+ def call
22
+ assert_not_exists!
23
+ set_working_dir!
24
+ cp_template_files!
25
+ Utils::TemplateInflator.new(plugin_name: capitalized_plugin_name, java_package: java_package).call
26
+ end
27
+
28
+ def assert_not_exists!
29
+ return unless File.directory?(plugin_name)
30
+
31
+ raise Error, "Directory #{plugin_name} already exists"
32
+ end
33
+
34
+ def set_working_dir!
35
+ FileUtils.mkdir(plugin_name)
36
+ FileUtils.cd(plugin_name)
37
+ end
38
+
39
+ def cp_template_files!
40
+ FileUtils.cp_r("#{TEMPLATE_DIRECTORY_PATH}/.", '.')
41
+ system('ditto', TEMPLATE_DIRECTORY_PATH, '.')
42
+ end
43
+
44
+ def capitalized_plugin_name
45
+ [plugin_name, 'plugin'].join('_').camelize
46
+ end
47
+
48
+ def java_package
49
+ plugin_name
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cocoapods'
4
+ require 'xcodeproj'
5
+ require 'active_support/core_ext/string/inflections'
6
+
7
+ module GoNative
8
+ module Plugins
9
+ module IOS
10
+ class BuildFramework
11
+ autoload :FileUtils, 'fileutils'
12
+
13
+ extend DSL::Serviceable
14
+
15
+ BUILD_TEMPLATE_DIRECTORY_PATH = File.expand_path(File.join(__dir__, '../../../..', 'templates', 'build', 'ios'))
16
+
17
+ attr_reader :plugin_name
18
+
19
+ def initialize
20
+ @plugin_name = Utils::SanitizePluginName.call(FileUtils.pwd.split('/').last, 'ios').capitalize + 'Plugin'
21
+ end
22
+
23
+ def call
24
+ setup_dirs
25
+ create_framework_proj
26
+ move_template_files
27
+ run_pod_install
28
+ chmod_frameworks_script!
29
+ build_framework!
30
+ move_framework_file
31
+ ensure
32
+ FileUtils.cd('..')
33
+ FileUtils.rm_rf('build')
34
+ end
35
+
36
+ def setup_dirs
37
+ build_dir = File.join(FileUtils.pwd, 'build')
38
+ FileUtils.mkdir(build_dir)
39
+ FileUtils.cd(build_dir)
40
+ end
41
+
42
+ def create_framework_proj
43
+ proj = Xcodeproj::Project.new(FileUtils.pwd)
44
+ target = proj.new_target(:framework, "#{plugin_name}", :ios, '10.0')
45
+ main_group = proj.new_group(plugin_name, plugin_name)
46
+ classes_group = main_group.new_group('Classes', 'Classes')
47
+ references = Dir.glob("../#{plugin_name}/Classes/**").map{ |file| classes_group.new_file("../../#{file}") }
48
+ target.add_file_references(references)
49
+ target.build_configurations.each do |config|
50
+ config.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES'
51
+ end
52
+ proj.save("#{plugin_name}.xcodeproj")
53
+ end
54
+
55
+ def move_template_files
56
+ spec = Pod::Specification.from_file("../#{plugin_name}.podspec")
57
+ plugin_dependencies = spec.dependencies.map{|d| ["pod '#{d.name}'", "'#{d.requirement}'"].compact.join(', ') } * "\n\t"
58
+ FileUtils.cp_r("#{BUILD_TEMPLATE_DIRECTORY_PATH}/.", '.')
59
+ Utils::TemplateInflator.new(plugin_name: plugin_name, plugin_dependencies: plugin_dependencies).call
60
+ end
61
+
62
+ def run_pod_install
63
+ system 'pod install'
64
+ end
65
+
66
+ def chmod_frameworks_script!
67
+ FileUtils.chmod 0755, 'create-framework.sh'
68
+ end
69
+
70
+ def build_framework!
71
+ Utils::UI.info 'Building framework'
72
+ return if system('sh create-framework.sh >/dev/null 2>/dev/null')
73
+
74
+ raise Error, "Error building framework. Please run the create-framework file manually to fix any errors"
75
+ end
76
+
77
+ def move_framework_file
78
+ FileUtils.mv("XCFramework", '..')
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -1,14 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'xcodeproj'
4
3
  require 'active_support/core_ext/string/inflections'
5
4
 
6
5
  module GoNative
7
6
  module Plugins
8
7
  module IOS
9
8
  class Create
10
- autoload :FileUtils, 'fileutils'
11
-
12
9
  extend DSL::Serviceable
13
10
 
14
11
  TEMPLATE_DIRECTORY_PATH = File.expand_path(File.join(__dir__, '../../../..', 'templates', 'plugins', 'ios'))
@@ -27,10 +24,8 @@ module GoNative
27
24
  assert_not_exists!
28
25
  set_working_dir!
29
26
  cp_template_files!
30
- inflate_templates!
27
+ Utils::TemplateInflator.new(plugin_name: plugin_name).call
31
28
  chmod_frameworks_script!
32
- create_framework_proj!
33
- run_pod_install!
34
29
  end
35
30
 
36
31
  def assert_not_exists!
@@ -49,55 +44,6 @@ module GoNative
49
44
  system('ditto', File.join(TEMPLATE_DIRECTORY_PATH, 'language-specific', language), '.')
50
45
  end
51
46
 
52
- def inflate_templates!
53
- Dir.glob('*/').each do |dir|
54
- FileUtils.cd(dir)
55
- inflate_templates!
56
- FileUtils.cd('..')
57
- dir_name = dir.delete_suffix('/')
58
- normalized_name = normalized_name(dir_name)
59
- FileUtils.mv(dir_name, normalized_name) if dir_name != normalized_name
60
- end
61
- inflate_files
62
- end
63
-
64
- def chmod_frameworks_script!
65
- FileUtils.chmod 0755, 'create-framework.sh'
66
- end
67
-
68
- def create_framework_proj!
69
- proj = Xcodeproj::Project.new(FileUtils.pwd)
70
- target = proj.new_target(:framework, "#{plugin_name}Framework", :ios, '10.0')
71
- main_group = proj.new_group(plugin_name, plugin_name)
72
- classes_group = main_group.new_group('Classes', 'Classes')
73
- references = Dir.glob("#{plugin_name}/Classes/**").map{ |file| classes_group.new_file(file.split('/').last) }
74
- main_group.new_file('Info.plist')
75
- target.add_file_references(references)
76
- target.build_configurations.each do |config|
77
- config.build_settings['INFOPLIST_FILE'] = "$(SRCROOT)/#{plugin_name}/Info.plist"
78
- end
79
- proj.save("#{plugin_name}.xcodeproj")
80
- end
81
-
82
- def run_pod_install!
83
- system 'pod install'
84
- end
85
-
86
- def inflate_files
87
- Dir.glob("*#{TEMPLATE_FILES_EXTENSION}").each do |file|
88
- File.write(normalized_name(file), contents(file))
89
- FileUtils.rm(file)
90
- end
91
- end
92
-
93
- def normalized_name(file)
94
- file.gsub('PLUGIN_NAME', plugin_name).delete_suffix(TEMPLATE_FILES_EXTENSION)
95
- end
96
-
97
- def contents(file)
98
- Utils::TemplateInflator.new(File.read(file)).call(PLUGIN_NAME: plugin_name, REPO_NAME: repo_name)
99
- end
100
-
101
47
  def repo_name
102
48
  plugin_name.underscore.dasherize.prepend 'ios-'
103
49
  end
@@ -7,15 +7,7 @@ module GoNative
7
7
  extend DSL::Serviceable
8
8
 
9
9
  def call
10
- assert_valid_plugin!
11
10
  assert_staging_clear!
12
- build_framework!
13
- end
14
-
15
- def assert_valid_plugin!
16
- return if File.file?('create-framework.sh')
17
-
18
- raise Error, "File 'create-framework.sh' does not exist. Please make sure this is a valid GoNative plugin directory"
19
11
  end
20
12
 
21
13
  def assert_staging_clear!
@@ -23,13 +15,6 @@ module GoNative
23
15
 
24
16
  raise Error, "There are uncommitted changes in the repository"
25
17
  end
26
-
27
- def build_framework!
28
- Utils::UI.info 'Building framework'
29
- return if system('sh create-framework.sh >/dev/null 2>/dev/null')
30
-
31
- raise Error, "Error building framework. Please run the create-framework file manually to fix any errors"
32
- end
33
18
  end
34
19
  end
35
20
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ostruct'
4
+
5
+ module GoNative
6
+ module Utils
7
+ class ContentEvaluator
8
+ class << self
9
+ def call(content, values)
10
+ o = OpenStruct.new(values)
11
+ o.instance_eval('"' + content.gsub('"', '\\\\"') + '"')
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/string/inflections'
4
+
5
+ module GoNative
6
+ module Utils
7
+ class SanitizePluginName
8
+ class << self
9
+ def call(raw_name, platform)
10
+ name_components = raw_name.underscore.dasherize.split('-') - ['plugin', platform]
11
+
12
+ name_components.join('-')
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -3,19 +3,49 @@
3
3
  module GoNative
4
4
  module Utils
5
5
  class TemplateInflator
6
- def initialize(content)
7
- @content = content.dup
6
+ autoload :FileUtils, 'fileutils'
7
+
8
+ extend DSL::Serviceable
9
+
10
+ def initialize(options)
11
+ @options = options
8
12
  end
9
-
10
- def call(values)
11
- values.each { |name, value| content.gsub!("{{#{name}}}", value.to_s) }
12
-
13
- content
13
+
14
+ def call
15
+ Dir.glob('*/').each do |dir|
16
+ FileUtils.cd(dir)
17
+ call
18
+ FileUtils.cd('..')
19
+ dir_name = dir.delete_suffix('/')
20
+ normalized_name = normalized_name(dir_name)
21
+ FileUtils.mv(dir_name, normalized_name) if dir_name != normalized_name
22
+ end
23
+ inflate_files
24
+ end
25
+
26
+ def inflate_files
27
+ Dir.glob("*#{TEMPLATE_FILES_EXTENSION}").each do |file|
28
+ File.write(normalized_name(file), contents(file))
29
+ FileUtils.rm(file)
30
+ end
31
+ end
32
+
33
+ def contents(file)
34
+ content = File.read(file)
35
+ Utils::ContentEvaluator.call(content, options)
36
+ end
37
+
38
+ def normalized_name(file_name)
39
+ new_name = file_name.dup
40
+ options.each do |key, value|
41
+ new_name.gsub!(key.to_s.upcase, value)
42
+ end
43
+ new_name.delete_suffix(TEMPLATE_FILES_EXTENSION)
14
44
  end
15
45
 
16
46
  private
17
47
 
18
- attr_reader :content
48
+ attr_reader :options
19
49
  end
20
50
  end
21
51
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoNative
4
- module Plugins
4
+ module Utils
5
5
  TEMPLATE_FILES_EXTENSION = '.tpl'.freeze
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoNative
4
- VERSION = "0.5.6"
4
+ VERSION = "0.7.2"
5
5
  end
@@ -3,7 +3,8 @@ platform :ios, '10.0'
3
3
  source 'https://cdn.cocoapods.org/'
4
4
  source 'git@github.com:gonativeio/gonative-specs.git'
5
5
 
6
- target '{{PLUGIN_NAME}}Framework' do
6
+ target '#{plugin_name}' do
7
7
  use_frameworks!
8
- pod '{{PLUGIN_NAME}}', path: '.'
8
+
9
+ #{plugin_dependencies}
9
10
  end
@@ -5,11 +5,11 @@ WORKING_DIR=$(pwd)
5
5
 
6
6
  FRAMEWORK_FOLDER_NAME="XCFramework"
7
7
 
8
- FRAMEWORK_NAME="{{PLUGIN_NAME}}"
8
+ FRAMEWORK_NAME="#{plugin_name}"
9
9
 
10
10
  FRAMEWORK_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/${FRAMEWORK_NAME}.xcframework"
11
11
 
12
- BUILD_SCHEME="{{PLUGIN_NAME}}Framework"
12
+ BUILD_SCHEME="#{plugin_name}"
13
13
 
14
14
  SIMULATOR_ARCHIVE_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/simulator.xcarchive"
15
15
 
@@ -21,9 +21,9 @@ mkdir "${FRAMEWORK_FOLDER_NAME}"
21
21
  echo "Created ${FRAMEWORK_FOLDER_NAME}"
22
22
  echo "Archiving ${FRAMEWORK_NAME}"
23
23
 
24
- xcodebuild -workspace "{{PLUGIN_NAME}}.xcworkspace" archive ONLY_ACTIVE_ARCH=NO ARCHS="x86_64 arm64 i386" -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS Simulator" -archivePath "${SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
24
+ xcodebuild -workspace "#{plugin_name}.xcworkspace" archive ONLY_ACTIVE_ARCH=NO ARCHS="x86_64 arm64 i386" -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS Simulator" -archivePath "${SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
25
25
 
26
- xcodebuild archive -workspace "{{PLUGIN_NAME}}.xcworkspace" -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS" -archivePath "${IOS_DEVICE_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
26
+ xcodebuild archive -workspace "#{plugin_name}.xcworkspace" -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS" -archivePath "${IOS_DEVICE_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
27
27
 
28
28
  xcodebuild -create-xcframework -framework ${SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -framework ${IOS_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -output "${FRAMEWORK_PATH}"
29
29
 
@@ -0,0 +1,33 @@
1
+ plugins {
2
+ id 'com.android.library'
3
+ }
4
+
5
+ android {
6
+ compileSdkVersion 30
7
+
8
+ defaultConfig {
9
+ minSdkVersion 16
10
+ targetSdkVersion 30
11
+ versionCode 1
12
+ versionName "1.0"
13
+
14
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15
+ consumerProguardFiles "consumer-rules.pro"
16
+ }
17
+
18
+ buildTypes {
19
+ release {
20
+ minifyEnabled false
21
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22
+ }
23
+ }
24
+ compileOptions {
25
+ sourceCompatibility JavaVersion.VERSION_1_8
26
+ targetCompatibility JavaVersion.VERSION_1_8
27
+ }
28
+ }
29
+
30
+ dependencies {
31
+ implementation "io.gonative.android:library:+"
32
+ api project(':gonative-core')
33
+ }
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "plugin": {
3
+ "packageName": "io.gonative.android.plugins.#{java_package}",
4
+ "classInstance": "#{plugin_name}",
5
+ "pluginName": "#{java_package + '-plugin'}"
6
+ }
7
+ }
@@ -0,0 +1,21 @@
1
+ # Add project specific ProGuard rules here.
2
+ # You can control the set of applied configuration files using the
3
+ # proguardFiles setting in build.gradle.
4
+ #
5
+ # For more details, see
6
+ # http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+ # If your project uses WebView with JS, uncomment the following
9
+ # and specify the fully qualified class name to the JavaScript interface
10
+ # class:
11
+ #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+ # public *;
13
+ #}
14
+
15
+ # Uncomment this to preserve the line number information for
16
+ # debugging stack traces.
17
+ #-keepattributes SourceFile,LineNumberTable
18
+
19
+ # If you keep the line number information, uncomment this to
20
+ # hide the original source file name.
21
+ #-renamesourcefileattribute SourceFile
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="io.gonative.android.plugins.#{java_package}">
4
+
5
+ </manifest>
@@ -0,0 +1,26 @@
1
+ package io.gonative.android.plugins.#{java_package};
2
+
3
+ import android.app.Activity;
4
+ import android.content.Context;
5
+
6
+ import io.gonative.gonative_core.BridgeModule;
7
+ import io.gonative.gonative_core.GoNativeActivity;
8
+
9
+ public class #{plugin_name} implements BridgeModule {
10
+ private final static String TAG = #{plugin_name}.class.getSimpleName();
11
+
12
+ @Override
13
+ public void onApplicationCreate(Context context) {
14
+
15
+ }
16
+
17
+ @Override
18
+ public <T extends Activity & GoNativeActivity> void onActivityCreate(T activity, boolean isRoot) {
19
+
20
+ }
21
+
22
+ @Override
23
+ public <T extends Activity & GoNativeActivity> boolean shouldOverrideUrlLoading(T activity, Uri uri) {
24
+ return false;
25
+ }
26
+ }
@@ -1,19 +1 @@
1
- Copyright (c) 2021 pureblood <hhunaid@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
1
+ Licensing information available at https://gonative.io/
@@ -1,5 +1,5 @@
1
1
  Pod::Spec.new do |s|
2
- s.name = '{{PLUGIN_NAME}}'
2
+ s.name = '#{plugin_name}'
3
3
  s.version = '0.1.0'
4
4
  s.summary = 'Facebook plugin for GoNative.'
5
5
 
@@ -7,22 +7,23 @@ Pod::Spec.new do |s|
7
7
  TODO: Add long description of the pod here.
8
8
  DESC
9
9
 
10
- s.homepage = 'https://github.com/gonativeio/{{PLUGIN_NAME}}'
11
- s.license = { :type => 'MIT', :file => 'LICENSE' }
10
+ s.homepage = 'https://github.com/gonativeio/#{plugin_name}'
11
+ s.license = { :type => 'Proprietary', :file => 'LICENSE' }
12
12
  s.author = { 'hhunaid' => 'hhunaid@gmail.com' }
13
- s.source = { :git => 'git@github.com:gonativeio/{{REPO_NAME}}.git', :tag => s.version.to_s }
13
+ s.source = { :git => 'git@github.com:gonativeio/#{repo_name}.git', :tag => s.version.to_s }
14
14
 
15
15
  s.ios.deployment_target = '10.0'
16
16
  s.swift_versions = '5.0'
17
+ s.preserve_paths = 'plist/*.{plist}'
17
18
 
18
19
  s.subspec 'Source' do |cs|
19
- cs.source_files = '{{PLUGIN_NAME}}/Classes/**/*.{h,m,swift}'
20
- cs.resource_bundle = { '{{PLUGIN_NAME}}JS' => 'js/*.{js,json}' }
20
+ cs.source_files = '#{plugin_name}/Classes/**/*.{h,m,swift}'
21
+ cs.resource_bundle = { '#{plugin_name}JS' => 'js/*.{js,json}' }
21
22
  end
22
23
 
23
24
  s.subspec 'Binary' do |cs|
24
- cs.ios.vendored_frameworks = 'XCFramework/{{PLUGIN_NAME}}.xcframework'
25
- cs.resource_bundle = { '{{PLUGIN_NAME}}JS' => 'js/*.{js,json}' }
25
+ cs.ios.vendored_frameworks = 'XCFramework/#{plugin_name}.xcframework'
26
+ cs.resource_bundle = { '#{plugin_name}JS' => 'js/*.{js,json}' }
26
27
  end
27
28
 
28
29
  s.default_subspec = 'Source'
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+
6
+ </dict>
7
+ </plist>
@@ -1,6 +1,6 @@
1
1
  //
2
- // GN{{PLUGIN_NAME}}.h
3
- // {{PLUGIN_NAME}}
2
+ // GN#{plugin_name}.h
3
+ // #{plugin_name}
4
4
  //
5
5
  // Created by Hunaid Hassan.
6
6
  //
@@ -10,7 +10,7 @@
10
10
 
11
11
  NS_ASSUME_NONNULL_BEGIN
12
12
 
13
- @interface GN{{PLUGIN_NAME}} : GNEventEmitter
13
+ @interface GN#{plugin_name} : GNEventEmitter
14
14
 
15
15
  @end
16
16
 
@@ -1,13 +1,13 @@
1
1
  //
2
- // GN{{PLUGIN_NAME}}.m
3
- // {{PLUGIN_NAME}}
2
+ // GN#{plugin_name}.m
3
+ // #{plugin_name}
4
4
  //
5
5
  // Created by Hunaid Hassan.
6
6
  //
7
7
 
8
- #import "GN{{PLUGIN_NAME}}.h"
8
+ #import "GN#{plugin_name}.h"
9
9
 
10
- @implementation GN{{PLUGIN_NAME}}
10
+ @implementation GN#{plugin_name}
11
11
 
12
12
  GN_EXPORT_MODULE()
13
13
 
@@ -1,12 +1,12 @@
1
1
  //
2
- // GN{{PLUGIN_NAME}}.m
3
- // {{PLUGIN_NAME}}
2
+ // GN#{plugin_name}.m
3
+ // #{plugin_name}
4
4
  //
5
5
  // Created by Hunaid Hassan.
6
6
  //
7
7
 
8
8
  #import <GoNativeCore/GNEventEmitter.h>
9
9
 
10
- @interface GN_EXTERN_MODULE(GN{{PLUGIN_NAME}}, GNEventEmitter)
10
+ @interface GN_EXTERN_MODULE(GN#{plugin_name}, GNEventEmitter)
11
11
 
12
12
  @end
@@ -1,6 +1,6 @@
1
1
  //
2
- // GN{{PLUGIN_NAME}}.swift
3
- // {{PLUGIN_NAME}}
2
+ // GN#{plugin_name}.swift
3
+ // #{plugin_name}
4
4
  //
5
5
  // Created by Hunaid Hassan on.
6
6
  //
@@ -8,7 +8,7 @@
8
8
  import Foundation
9
9
  import GoNativeCore
10
10
 
11
- @objc(GN{{PLUGIN_NAME}})
12
- public class GN{{PLUGIN_NAME}}: GNEventEmitter {
11
+ @objc(GN#{plugin_name})
12
+ public class GN#{plugin_name}: GNEventEmitter {
13
13
 
14
14
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gonative-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hunaid Hassan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-10 00:00:00.000000000 Z
11
+ date: 2021-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -187,27 +187,38 @@ files:
187
187
  - gonative-cli.gemspec
188
188
  - lib/gonative.rb
189
189
  - lib/gonative/commands.rb
190
+ - lib/gonative/commands/android/create.rb
190
191
  - lib/gonative/commands/base.rb
191
192
  - lib/gonative/commands/ios/create.rb
192
193
  - lib/gonative/commands/ios/publish.rb
193
194
  - lib/gonative/commands/version.rb
194
195
  - lib/gonative/dsl/error_catchable.rb
195
196
  - lib/gonative/dsl/serviceable.rb
196
- - lib/gonative/plugins.rb
197
+ - lib/gonative/plugins/android/create.rb
198
+ - lib/gonative/plugins/ios/build_framework.rb
197
199
  - lib/gonative/plugins/ios/create.rb
198
200
  - lib/gonative/plugins/ios/release.rb
199
201
  - lib/gonative/plugins/ios/verify.rb
202
+ - lib/gonative/utils.rb
203
+ - lib/gonative/utils/content_evaluator.rb
204
+ - lib/gonative/utils/sanitize_plugin_name.rb
200
205
  - lib/gonative/utils/template_inflator.rb
201
206
  - lib/gonative/utils/ui.rb
202
207
  - lib/gonative/version.rb
208
+ - templates/build/ios/Podfile.tpl
209
+ - templates/build/ios/create-framework.sh.tpl
210
+ - templates/plugins/android/build.gradle
211
+ - templates/plugins/android/consumer-rules.pro
212
+ - templates/plugins/android/plugin-metadata.json.tpl
213
+ - templates/plugins/android/proguard-rules.pro
214
+ - templates/plugins/android/src/main/AndroidManifest.xml.tpl
215
+ - templates/plugins/android/src/main/java/io/gonative/android/plugins/JAVA_PACKAGE/PLUGIN_NAME.java.tpl
203
216
  - templates/plugins/ios/common/.gitignore
204
217
  - templates/plugins/ios/common/LICENSE
205
218
  - templates/plugins/ios/common/PLUGIN_NAME.podspec.tpl
206
219
  - templates/plugins/ios/common/PLUGIN_NAME/Info.plist
207
- - templates/plugins/ios/common/Podfile.tpl
208
- - templates/plugins/ios/common/create-framework.sh.tpl
209
- - templates/plugins/ios/common/js/info.plist.json.tpl
210
220
  - templates/plugins/ios/common/js/polyfill.js.tpl
221
+ - templates/plugins/ios/common/plist/Info.plist
211
222
  - templates/plugins/ios/language-specific/objc/PLUGIN_NAME/Classes/GNPLUGIN_NAME.h.tpl
212
223
  - templates/plugins/ios/language-specific/objc/PLUGIN_NAME/Classes/GNPLUGIN_NAME.m.tpl
213
224
  - templates/plugins/ios/language-specific/swift/PLUGIN_NAME/Classes/GNSwiftModule.m.tpl