Commit 2cccad6a authored by Vadim Vlasov's avatar Vadim Vlasov

Initial commit

parents
*.gem
Gemfile.lock
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
fastlane/README.md
fastlane/report.xml
coverage
test-results
--require spec_helper
--color
--format d
--format RspecJunitFormatter
--out test-results/rspec/rspec.xml
---
Style/MultipleComparison:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/ClassCheck:
EnforcedStyle: kind_of?
Style/FrozenStringLiteralComment:
Enabled: false
Style/SafeNavigation:
Enabled: false
Performance/RegexpMatch:
Enabled: false
Performance/StringReplacement:
Enabled: false
Style/NumericPredicate:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Style/VariableNumber:
Enabled: false
Style/MethodMissing:
Enabled: false
MultilineBlockChain:
Enabled: false
Style/NumericLiteralPrefix:
Enabled: false
Style/TernaryParentheses:
Enabled: false
Style/EmptyMethod:
Enabled: false
Style/BracesAroundHashParameters:
Enabled: false
Lint/UselessAssignment:
Exclude:
- "**/spec/**/*"
Require/MissingRequireStatement:
Exclude:
- "**/spec/**/*.rb"
- "**/spec_helper.rb"
- spaceship/lib/spaceship/babosa_fix.rb
- "**/Fastfile"
- "**/*.gemspec"
- rakelib/**/*
- "**/*.rake"
- "**/Rakefile"
- fastlane/**/*
- supply/**/*
Layout/IndentHash:
Enabled: false
Layout/AlignHash:
Enabled: false
Layout/DotPosition:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/SymbolArray:
Enabled: false
Layout/IndentHeredoc:
Enabled: false
Style/MixinGrouping:
Exclude:
- "**/spec/**/*"
Lint/HandleExceptions:
Enabled: false
Lint/UnusedBlockArgument:
Enabled: false
Lint/AmbiguousBlockAssociation:
Enabled: false
Style/GlobalVars:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/SpecialGlobalVars:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Style/WordArray:
MinSize: 19
Style/SignalException:
Enabled: false
Style/RedundantReturn:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/AndOr:
Enabled: true
EnforcedStyle: conditionals
Metrics/ClassLength:
Max: 320
Metrics/LineLength:
Max: 370
Metrics/ParameterLists:
Max: 17
Metrics/PerceivedComplexity:
Max: 18
Style/GuardClause:
Enabled: false
Style/StringLiterals:
Enabled: false
Style/ConditionalAssignment:
Enabled: false
Style/RedundantSelf:
Enabled: false
Lint/UnusedMethodArgument:
Enabled: false
Lint/ParenthesesAsGroupedExpression:
Exclude:
- "**/spec/**/*"
Style/PredicateName:
Enabled: false
Style/PerlBackrefs:
Enabled: false
Layout/SpaceAroundOperators:
Exclude:
- "**/spec/actions_specs/xcodebuild_spec.rb"
AllCops:
TargetRubyVersion: 2.0
Include:
- "*/lib/assets/*Template"
- "*/lib/assets/*TemplateAndroid"
Exclude:
- "**/lib/assets/custom_action_template.rb"
- "./vendor/**/*"
- "**/lib/assets/DefaultFastfileTemplate"
- "**/lib/assets/MatchfileTemplate"
- "**/spec/fixtures/broken_files/broken_file.rb"
Style/FileName:
Exclude:
- "**/Dangerfile"
- "**/Brewfile"
- "**/Gemfile"
- "**/Podfile"
- "**/Rakefile"
- "**/Fastfile"
- "**/Deliverfile"
- "**/Snapfile"
- "**/*.gemspec"
Style/Documentation:
Enabled: false
Style/MutableConstant:
Enabled: false
Style/ZeroLengthPredicate:
Enabled: false
Style/IfInsideElse:
Enabled: false
Style/CollectionMethods:
Enabled: false
CrossPlatform/ForkUsage:
Exclude:
- "**/plugins/template/**/*"
Style/MethodCallWithArgsParentheses:
Enabled: true
IgnoredMethods:
- require
- require_relative
- fastlane_require
- gem
- program
- command
- raise
- attr_accessor
- attr_reader
- desc
- lane
- private_lane
- platform
- to
- describe
- it
- be
- context
- before
- after
# os: osx # enable this if you need macOS support
language: ruby
rvm:
- 2.2.4
source('https://rubygems.org')
gemspec
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
The MIT License (MIT)
Copyright (c) 2020 Vadim Vlasov <v.vlasov@furylion.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# furylion plugin
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-furylion)
## Getting Started
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-furylion`, add it to your project by running:
```bash
fastlane add_plugin furylion
```
## About furylion
FuryLion Fastlane plugin
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
## Example
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
## Run tests for this plugin
To run both the tests, and code style validation, run
```
rake
```
To automatically fix many of the styling issues, use
```
rubocop -a
```
## Issues and Feedback
For any other issues and feedback about this plugin, please submit it to this repository.
## Troubleshooting
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
## Using _fastlane_ Plugins
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
## About _fastlane_
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)
task(default: [:spec, :rubocop])
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/furylion/version'
Gem::Specification.new do |spec|
spec.name = 'fastlane-plugin-furylion'
spec.version = Fastlane::Furylion::VERSION
spec.author = 'Vadim Vlasov'
spec.email = 'v.vlasov@furylion.net'
spec.summary = 'FuryLion Fastlane plugin'
spec.homepage = "https://gitlab.furylion.net/v.vlasov/fastlane-plugin-furylion"
spec.license = "MIT"
spec.files = Dir["lib/**/*"] + %w(README.md LICENSE)
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
# Don't add a dependency to fastlane or fastlane_re
# since this would cause a circular dependency
# spec.add_dependency 'your-dependency', '~> 1.0.0'
spec.add_development_dependency('pry')
spec.add_development_dependency('bundler')
spec.add_development_dependency('rspec')
spec.add_development_dependency('rspec_junit_formatter')
spec.add_development_dependency('rake')
spec.add_development_dependency('rubocop', '0.49.1')
spec.add_development_dependency('rubocop-require_tools')
spec.add_development_dependency('simplecov')
spec.add_development_dependency('fastlane', '>= 2.129.0')
end
require 'fastlane/plugin/furylion/version'
module Fastlane
module Furylion
# Return all .rb files inside the "actions" and "helper" directory
def self.all_classes
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
end
end
end
# By default we want to import all available actions and helpers
# A plugin can contain any number of actions and plugins
Fastlane::Furylion.all_classes.each do |current|
require current
end
module Fastlane
module Actions
class GenerateBuildInfoAction < Action
def self.run(params)
UI.message ""
UI.message Terminal::Table.new(
title: "Generate Build Info".green,
headings: ["Option", "Value"],
rows: params.values,
)
UI.message ""
text = File.read(params[:version_file])
new_content = text.gsub("BuildNumber = \"UNKNOWN\"", "BuildNumber = \"#{params[:build_number]}\"")
new_content = new_content.gsub("Commit = \"UNKNOWN\"", "Commit = \"#{params[:commit_sha]}\"")
new_content = new_content.gsub("Branch = \"UNKNOWN\"", "Branch = \"#{params[:branch]}\"")
commit_time = `git show -s --format=%ct #{params[:commit_sha]}`
new_content = new_content.gsub("BuildDate = -1", "BuildDate = #{commit_time}")
# puts new_content
File.open(params[:version_file], "w") { |file| file.puts new_content }
UI.success "Completed"
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Change Build number"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :version_file,
env_name: "VERSION_FILE",
description: "Path for Version file",
optional: true,
default_value: "Assets/Scripts/Version.cs"),
FastlaneCore::ConfigItem.new(key: :build_number,
env_name: "BUILD_NUMBER",
description: "Build number",
optional: true,
default_value: ENV["CI_PIPELINE_ID"]),
FastlaneCore::ConfigItem.new(key: :commit_sha,
env_name: "COMMIT_SHA",
description: "Commit SHA",
optional: true,
default_value: ENV["CI_COMMIT_SHA"]),
FastlaneCore::ConfigItem.new(key: :branch,
env_name: "BRANCH_NAME",
description: "Branch name",
optional: true,
default_value: ENV["CI_COMMIT_REF_NAME"]),
]
end
def self.authors
["Vadim Vlasov"]
end
def self.is_supported?(platform)
[:ios, :android, :windows, :macos].include?(platform)
end
end
end
end
module Fastlane
module Actions
class MattermostAction < Action
def self.run(params)
changelog = sh("changelogger")
message = "{"
message << "\"icon_url\": \"#{params[:icon]}\"," if params[:icon]
message << "\"username\": \"#{params[:username]}\"," if params[:username]
message << "\"attachments\": [{ \"color\": \"#FF8000\", \"pretext\": \"<!channel>\", \"title\": \"#{params[:message]}\", \"fields\": [{ \"short\": false, \"title\": \"Изменения:\", \"value\": \"#{changelog}\" }] }]"
message << "}"
request = "curl -i -X POST -H 'Content-Type: application/json' -d '" << message << "' " << params[:webhook]
sh request
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Send message to Mattermost"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :icon,
env_name: "MATTERMOST_ICON",
description: "URL для иконки",
optional: true,
default_value: nil),
FastlaneCore::ConfigItem.new(key: :username,
env_name: "MATTERMOST_USER",
description: "Имя пользователя",
optional: true,
default_value: nil),
FastlaneCore::ConfigItem.new(key: :message,
env_name: "MATTERMOST_MESSAGE",
description: "Сообщение",
default_value: nil),
FastlaneCore::ConfigItem.new(key: :webhook,
env_name: "MATTERMOST_WEBHOOK",
description: "Mattermost Webhook (например: http://chat.furylion.net/hooks/XXXXXXXX",
default_value: nil),
FastlaneCore::ConfigItem.new(key: :gitlab_token,
env_name: "CHANGELOG_TOKEN",
description: "GitLab Token для генерации списка изменений",
default_value: nil),
]
end
def self.authors
["Vadim Vlasov"]
end
def self.is_supported?(platform)
true
end
end
end
end
module Fastlane
module Actions
class RemoveProvisioningProfilesAction < Action
def self.run(params)
UI.message "Remove Provisioning Profiles"
sh "rm -f #{params[:path]}"
UI.success "Completed"
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Remove Provisioning Profiles"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :path,
env_name: "REMOVE_PROVISIONING_PROFILES_PATH",
description: "Путь до директории, где хранятся Provisioning Profiles",
optional: true,
default_value: "~/Library/MobileDevice/Provisioning\ Profiles/*"),
]
end
def self.authors
["Vadim Vlasov"]
end
def self.is_supported?(platform)
[:ios].include?(platform)
end
end
end
end
module Fastlane
module Actions
class UnityAction < Action
def self.run(params)
if params[:executable]
build_cmd = params[:executable]
else
text = File.read("#{params[:project_path]}/ProjectSettings/ProjectVersion.txt")
unity_version = text[/[0-9].*$/]
build_cmd = params[:unity_hub] << "/" << unity_version << "/Unity.app/Contents/MacOS/Unity"
end
build_cmd << " -projectPath #{params[:project_path]}"
build_cmd << " -batchmode"
build_cmd << " -quit"
build_cmd << " -nographics"
build_cmd << " -executeMethod #{params[:execute_method]}"
build_cmd << " -buildTarget #{params[:build_target]}"
build_cmd << " -logFile #{params[:log_file]}"
UI.message ""
UI.message Terminal::Table.new(
title: "Unity".green,
headings: ["Option", "Value"],
rows: params.values,
)
UI.message ""
UI.message "Start running"
UI.message ""
sh build_cmd
UI.success "Completed"
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Run Unity in batch mode"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :executable,
env_name: "UNITY_EXECUTABLE_PATH",
description: "Override Unity path",
optional: true,
default_value: nil),
FastlaneCore::ConfigItem.new(key: :unity_hub,
env_name: "UNITY_HUB_PATH",
description: "Path to Unity Hub Editors dir",
optional: true,
default_value: "/Volumes/Data/Unity"),
FastlaneCore::ConfigItem.new(key: :project_path,
env_name: "UNITY_PROJECT_PATH",
description: "Path to Unity project",
default_value: "#{Dir.pwd}"),
FastlaneCore::ConfigItem.new(key: :build_target,
env_name: "UNITY_BUILD_TARGET",
description: "Target to build",
optional: true,
default_value: "iOS"),
FastlaneCore::ConfigItem.new(key: :execute_method,
env_name: "UNITY_EXECUTE_METHOD",
description: "Method to execute",
default_value: nil),
FastlaneCore::ConfigItem.new(key: :log_file,
env_name: "UNITY_LOG_FILE",
description: "Log File",
optional: true,
default_value: "/dev/stdout"),
]
end
def self.authors
["Vadim Vlasov"]
end
def self.is_supported?(platform)
[:ios, :android, :windows, :macos].include?(platform)
end
end
end
end
module Fastlane
module Furylion
VERSION = "0.1.0"
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment