gonative-cli 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d2663848bf1f2a69d93a5c24fced1c78012e8f406607bc7066f7193ac0f5af91
4
+ data.tar.gz: 6e443dcbfbfcc891dbf52d38d149c701494ae05f9a8c83fe0b93c87275e66e9e
5
+ SHA512:
6
+ metadata.gz: 4cf523cb8f7071f1a92c742e0df7bc0b7bd786e478f38c99a6f8def717e96b50a67cbd6d3d7bc9e538ac450f2b381c61ffdd847543224fe1698a2013742ea182
7
+ data.tar.gz: 77dfb8932b1e9ff5cd63963d16279162e67601650af3cf140a28be597185b9e357e264940b0530a7e4ebe142780625db4fd618bfb0ead4582711b217787923cb
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .idea
13
+ /.DS_Store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at hhunaid@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in gonative-cli.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gonative-cli (0.1.0)
5
+ dry-cli (~> 0.7)
6
+ xcodeproj (~> 1.20)
7
+ zeitwerk (~> 2.4)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ CFPropertyList (3.0.3)
13
+ ast (2.4.2)
14
+ atomos (0.1.3)
15
+ byebug (11.1.3)
16
+ claide (1.0.3)
17
+ coderay (1.1.3)
18
+ colored2 (3.1.2)
19
+ diff-lcs (1.4.4)
20
+ dry-cli (0.7.0)
21
+ method_source (1.0.0)
22
+ nanaimo (0.3.0)
23
+ parallel (1.20.1)
24
+ parser (3.0.2.0)
25
+ ast (~> 2.4.1)
26
+ pry (0.13.1)
27
+ coderay (~> 1.1)
28
+ method_source (~> 1.0)
29
+ pry-byebug (3.9.0)
30
+ byebug (~> 11.0)
31
+ pry (~> 0.13.0)
32
+ rainbow (3.0.0)
33
+ rake (13.0.6)
34
+ regexp_parser (2.1.1)
35
+ rexml (3.2.5)
36
+ rspec (3.10.0)
37
+ rspec-core (~> 3.10.0)
38
+ rspec-expectations (~> 3.10.0)
39
+ rspec-mocks (~> 3.10.0)
40
+ rspec-core (3.10.1)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-expectations (3.10.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-mocks (3.10.2)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-support (3.10.2)
49
+ rubocop (1.18.4)
50
+ parallel (~> 1.10)
51
+ parser (>= 3.0.0.0)
52
+ rainbow (>= 2.2.2, < 4.0)
53
+ regexp_parser (>= 1.8, < 3.0)
54
+ rexml
55
+ rubocop-ast (>= 1.8.0, < 2.0)
56
+ ruby-progressbar (~> 1.7)
57
+ unicode-display_width (>= 1.4.0, < 3.0)
58
+ rubocop-ast (1.8.0)
59
+ parser (>= 3.0.1.1)
60
+ rubocop-performance (1.11.4)
61
+ rubocop (>= 1.7.0, < 2.0)
62
+ rubocop-ast (>= 0.4.0)
63
+ ruby-progressbar (1.11.0)
64
+ unicode-display_width (2.0.0)
65
+ xcodeproj (1.20.0)
66
+ CFPropertyList (>= 2.3.3, < 4.0)
67
+ atomos (~> 0.1.3)
68
+ claide (>= 1.0.2, < 2.0)
69
+ colored2 (~> 3.1)
70
+ nanaimo (~> 0.3.0)
71
+ rexml (~> 3.2.4)
72
+ zeitwerk (2.4.2)
73
+
74
+ PLATFORMS
75
+ x86_64-darwin-19
76
+
77
+ DEPENDENCIES
78
+ gonative-cli!
79
+ pry-byebug (~> 3.9)
80
+ rake (~> 13.0)
81
+ rspec (~> 3.10)
82
+ rubocop (~> 1.7)
83
+ rubocop-performance (~> 1.11)
84
+
85
+ BUNDLED WITH
86
+ 2.2.11
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Hunaid Hassan
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Gonative::Cli
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gonative/cli`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gonative-cli'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gonative-cli
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
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.
30
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gonative-cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/gonative-cli/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Gonative::Cli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gonative-cli/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "gonative"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/gonative ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'gonative'
6
+
7
+ Dry::CLI.new(GoNative::Commands).call
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/gonative/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gonative-cli"
7
+ spec.version = GoNative::VERSION
8
+ spec.authors = ["Hunaid Hassan"]
9
+ spec.email = ["hhunaid@gmail.com"]
10
+
11
+ spec.summary = "CLI to create gonative plugins."
12
+ spec.description = "Create and manage gonative plugin projects using cli."
13
+ spec.homepage = "https://www.github.com/gonativeio/gonative-cli"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://www.github.com/gonativeio/gonative-cli"
19
+ spec.metadata['changelog_uri'] = "#{spec.metadata['source_code_uri']}/blob/master/CHANGELOG.md"
20
+ spec.metadata['github_repo'] = 'ssh://github.com/gonativeio/gonative-cli'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
+ end
27
+ spec.executables << 'gonative'
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_dependency 'dry-cli', '~> 0.7'
31
+ spec.add_dependency 'zeitwerk', '~> 2.4'
32
+ spec.add_dependency 'xcodeproj', '~> 1.20'
33
+
34
+ spec.add_development_dependency 'rspec', '~> 3.10'
35
+ spec.add_development_dependency 'pry-byebug', '~> 3.9'
36
+ spec.add_development_dependency 'rake', '~> 13.0'
37
+ spec.add_development_dependency 'rubocop', '~> 1.7'
38
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11'
39
+ end
data/lib/gonative.rb ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/cli'
4
+ require 'zeitwerk'
5
+
6
+ Zeitwerk::Loader.for_gem.tap do |loader|
7
+ loader.inflector.inflect 'gonative' => 'GoNative'
8
+ loader.inflector.inflect 'dsl' => 'DSL'
9
+ loader.inflector.inflect 'ios' => 'IOS'
10
+ loader.setup
11
+ end
12
+
13
+ module GoNative
14
+ Error = Class.new(StandardError)
15
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ extend Dry::CLI::Registry
6
+
7
+ register 'version', Version, aliases: %w[--version -v]
8
+ register 'plugin ios', Plugin::IOS
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ class Base < Dry::CLI::Command
6
+ def self.inherited(base)
7
+ super
8
+ base.prepend DSL::ErrorCatchable
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ module Plugin
6
+ class IOS < Base
7
+ desc 'Create a new app'
8
+
9
+ argument :name, required: true, desc: 'Name of the plugin'
10
+
11
+ def call(name:, **)
12
+ Plugins::IOS::Create.call(name)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ class Version < Base
6
+ desc 'Print version'
7
+
8
+ def call(*)
9
+ puts GoNative::VERSION
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ module GoNative
5
+ module DSL
6
+ module ErrorCatchable
7
+ def call(...)
8
+ super(...)
9
+ rescue Error => e
10
+ warn e.message
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module DSL
5
+ module Serviceable
6
+ def call(...)
7
+ new(...).call
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Plugins
5
+ TEMPLATE_FILES_EXTENSION = '.tpl'.freeze
6
+ end
7
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+ require 'xcodeproj'
3
+ require 'pry'
4
+
5
+ module GoNative
6
+ module Plugins
7
+ module IOS
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', 'ios'))
14
+
15
+ attr_reader :plugin_name
16
+
17
+ def initialize(plugin_name)
18
+ @plugin_name = plugin_name
19
+ end
20
+
21
+ def call
22
+ assert_not_exists!
23
+ set_working_dir!
24
+ cp_template_files!
25
+ inflate_templates!
26
+ create_framework_proj!
27
+ end
28
+
29
+ def assert_not_exists!
30
+ return unless File.directory?(plugin_name)
31
+
32
+ raise Error, "Directory #{plugin_name} already exists"
33
+ end
34
+
35
+ def set_working_dir!
36
+ FileUtils.mkdir(plugin_name)
37
+ FileUtils.cd(plugin_name)
38
+ end
39
+
40
+ def cp_template_files!
41
+ FileUtils.cp_r("#{TEMPLATE_DIRECTORY_PATH}/.", '.')
42
+ end
43
+
44
+ def inflate_templates!
45
+ Dir.glob('*/').each do |dir|
46
+ FileUtils.cd(dir)
47
+ inflate_templates!
48
+ FileUtils.cd('..')
49
+ dir_name = dir.delete_suffix('/')
50
+ normalized_name = normalized_name(dir_name)
51
+ FileUtils.mv(dir_name, normalized_name) if dir_name != normalized_name
52
+ end
53
+ inflate_files
54
+ end
55
+
56
+ def create_framework_proj!
57
+ proj = Xcodeproj::Project.new(FileUtils.pwd)
58
+ target = proj.new_target(:framework, "#{plugin_name}Framework", :ios, '10.0')
59
+ main_group = proj.new_group(plugin_name, plugin_name)
60
+ classes_group = main_group.new_group('Classes', 'Classes')
61
+ references = Dir.glob("#{plugin_name}/Classes/**").map{ |file| classes_group.new_file(file.split('/').last) }
62
+ main_group.new_file('Info.plist')
63
+ target.add_file_references(references)
64
+ target.build_configurations.each do |config|
65
+ config.build_settings['INFOPLIST_FILE'] = "$(SRCROOT)/#{plugin_name}/Info.plist"
66
+ end
67
+ proj.save("#{plugin_name}.xcodeproj")
68
+ end
69
+
70
+ def run_pod_install!
71
+ system 'pod install'
72
+ end
73
+
74
+ def inflate_files
75
+ Dir.glob("*#{TEMPLATE_FILES_EXTENSION}").each do |file|
76
+ File.write(normalized_name(file), contents(file))
77
+ FileUtils.rm(file)
78
+ end
79
+ end
80
+
81
+ def normalized_name(file)
82
+ file.gsub('PLUGIN_NAME', plugin_name).delete_suffix(TEMPLATE_FILES_EXTENSION)
83
+ end
84
+
85
+ def contents(file)
86
+ Utils::TemplateInflator.new(File.read(file)).call(PLUGIN_NAME: plugin_name)
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Utils
5
+ class TemplateInflator
6
+ def initialize(content)
7
+ @content = content.dup
8
+ end
9
+
10
+ def call(values)
11
+ values.each { |name, value| content.gsub!("{{#{name}}}", value.to_s) }
12
+
13
+ content
14
+ end
15
+
16
+ private
17
+
18
+ attr_reader :content
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,39 @@
1
+ # OS X
2
+ .DS_Store
3
+
4
+ # Xcode
5
+ build/
6
+ *.pbxuser
7
+ !default.pbxuser
8
+ *.mode1v3
9
+ !default.mode1v3
10
+ *.mode2v3
11
+ !default.mode2v3
12
+ *.perspectivev3
13
+ !default.perspectivev3
14
+ xcuserdata/
15
+ *.xccheckout
16
+ profile
17
+ *.moved-aside
18
+ DerivedData
19
+ *.hmap
20
+ *.ipa
21
+
22
+ # Bundler
23
+ .bundle
24
+
25
+ # Add this line if you want to avoid checking in source code from Carthage dependencies.
26
+ # Carthage/Checkouts
27
+
28
+ Carthage/Build
29
+
30
+ # We recommend against adding the Pods directory to your .gitignore. However
31
+ # you should judge for yourself, the pros and cons are mentioned at:
32
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
33
+ #
34
+ # Note: if you ignore the Pods directory, make sure to uncomment
35
+ # `pod install` in .travis.yml
36
+ #
37
+ # Pods/
38
+ Pods/
39
+ xcshareddata
@@ -0,0 +1,19 @@
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.
@@ -0,0 +1,28 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = '{{PLUGIN_NAME}}'
3
+ s.version = '0.1.0'
4
+ s.summary = 'Facebook plugin for GoNative.'
5
+
6
+ s.description = <<-DESC
7
+ TODO: Add long description of the pod here.
8
+ DESC
9
+
10
+ s.homepage = 'https://github.com/gonativeio/{{PLUGIN_NAME}}'
11
+ s.license = { :type => 'MIT', :file => 'LICENSE' }
12
+ s.author = { 'hhunaid' => 'hhunaid@gmail.com' }
13
+ s.source = { :git => 'https://github.com/gonativeio/{{PLUGIN_NAME}}.git', :tag => s.version.to_s }
14
+
15
+ s.ios.deployment_target = '10.0'
16
+ s.swift_versions = '5.0'
17
+
18
+ s.subspec 'Source' do |cs|
19
+ cs.source_files = '{{PLUGIN_NAME}}/Classes/**/*'
20
+ end
21
+
22
+ s.subspec 'Binary' do |cs|
23
+ cs.ios.vendored_frameworks = 'XCFramework/{{PLUGIN_NAME}}.xcframework'
24
+ end
25
+
26
+ s.default_subspec = 'Source'
27
+ s.dependency 'GoNativeCore'
28
+ end
@@ -0,0 +1,17 @@
1
+ //
2
+ // GN{{PLUGIN_NAME}}.h
3
+ // {{PLUGIN_NAME}}
4
+ //
5
+ // Created by Hunaid Hassan on 20.07.21.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <GoNativeCore/GNEventEmitter.h>
10
+
11
+ NS_ASSUME_NONNULL_BEGIN
12
+
13
+ @interface GN{{PLUGIN_NAME}} : GNEventEmitter
14
+
15
+ @end
16
+
17
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,14 @@
1
+ //
2
+ // GN{{PLUGIN_NAME}}.m
3
+ // {{PLUGIN_NAME}}
4
+ //
5
+ // Created by Hunaid Hassan on 20.07.21.
6
+ //
7
+
8
+ #import "GN{{PLUGIN_NAME}}.h"
9
+
10
+ @implementation GN{{PLUGIN_NAME}}
11
+
12
+ GN_EXPORT_MODULE()
13
+
14
+ @end
@@ -0,0 +1,22 @@
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
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>$(CURRENT_PROJECT_VERSION)</string>
21
+ </dict>
22
+ </plist>
@@ -0,0 +1,10 @@
1
+ platform :ios, '10.0'
2
+
3
+ source 'https://cdn.cocoapods.org/'
4
+ source 'https://github.com/gonativeio/gonative-specs'
5
+
6
+
7
+ target '{{PLUGIN_NAME}}Framework' do
8
+ use_frameworks!
9
+ pod '{{PLUGIN_NAME}}', path: '.'
10
+ end
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ WORKING_DIR=$(pwd)
5
+
6
+ FRAMEWORK_FOLDER_NAME="XCFramework"
7
+
8
+ FRAMEWORK_NAME="{{PLUGIN_NAME}}"
9
+
10
+ FRAMEWORK_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/${FRAMEWORK_NAME}.xcframework"
11
+
12
+ BUILD_SCHEME="{{PLUGIN_NAME}}Framework"
13
+
14
+ SIMULATOR_ARCHIVE_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/simulator.xcarchive"
15
+
16
+ IOS_DEVICE_ARCHIVE_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/iOS.xcarchive"
17
+
18
+ rm -rf "${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}"
19
+ echo "Deleted ${FRAMEWORK_FOLDER_NAME}"
20
+ mkdir "${FRAMEWORK_FOLDER_NAME}"
21
+ echo "Created ${FRAMEWORK_FOLDER_NAME}"
22
+ echo "Archiving ${FRAMEWORK_NAME}"
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
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
27
+
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
+
30
+ rm -rf "${SIMULATOR_ARCHIVE_PATH}"
31
+ rm -rf "${IOS_DEVICE_ARCHIVE_PATH}"
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gonative-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Hunaid Hassan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-08-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-cli
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: zeitwerk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: xcodeproj
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.20'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.20'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.9'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.7'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.11'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.11'
125
+ description: Create and manage gonative plugin projects using cli.
126
+ email:
127
+ - hhunaid@gmail.com
128
+ executables:
129
+ - gonative
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".rubocop.yml"
136
+ - CODE_OF_CONDUCT.md
137
+ - Gemfile
138
+ - Gemfile.lock
139
+ - LICENSE.txt
140
+ - README.md
141
+ - Rakefile
142
+ - bin/console
143
+ - bin/gonative
144
+ - bin/setup
145
+ - gonative-cli.gemspec
146
+ - lib/gonative.rb
147
+ - lib/gonative/commands.rb
148
+ - lib/gonative/commands/base.rb
149
+ - lib/gonative/commands/plugin/ios.rb
150
+ - lib/gonative/commands/version.rb
151
+ - lib/gonative/dsl/error_catchable.rb
152
+ - lib/gonative/dsl/serviceable.rb
153
+ - lib/gonative/plugins.rb
154
+ - lib/gonative/plugins/ios/create.rb
155
+ - lib/gonative/utils/template_inflator.rb
156
+ - lib/gonative/version.rb
157
+ - templates/plugins/ios/.gitignore
158
+ - templates/plugins/ios/LICENSE
159
+ - templates/plugins/ios/PLUGIN_NAME.podspec.tpl
160
+ - templates/plugins/ios/PLUGIN_NAME/Classes/GNPLUGIN_NAME.h.tpl
161
+ - templates/plugins/ios/PLUGIN_NAME/Classes/GNPLUGIN_NAME.m.tpl
162
+ - templates/plugins/ios/PLUGIN_NAME/Info.plist
163
+ - templates/plugins/ios/Podfile.tpl
164
+ - templates/plugins/ios/create-framework.sh.tpl
165
+ homepage: https://www.github.com/gonativeio/gonative-cli
166
+ licenses:
167
+ - MIT
168
+ metadata:
169
+ homepage_uri: https://www.github.com/gonativeio/gonative-cli
170
+ source_code_uri: https://www.github.com/gonativeio/gonative-cli
171
+ changelog_uri: https://www.github.com/gonativeio/gonative-cli/blob/master/CHANGELOG.md
172
+ github_repo: ssh://github.com/gonativeio/gonative-cli
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 2.6.0
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubygems_version: 3.2.3
189
+ signing_key:
190
+ specification_version: 4
191
+ summary: CLI to create gonative plugins.
192
+ test_files: []