fastlane-plugin-csv_translation 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbf2f2914ddd1cd56ebd39354d174a20f85e9a44a8b874230883d5ad46eb03c3
4
- data.tar.gz: b5f7b4218341d49d2daf9cefd74ea05a2a29197bc27584e19ff54a611da84f61
3
+ metadata.gz: 98a1462924631c8e6a6c88bdbddf1039ca41c16c533691d4e88630d3e680b896
4
+ data.tar.gz: d35b8aa36e90247fe2e60fe1d830a4fecfa16c5f7c2eaa48ed028350af0d975e
5
5
  SHA512:
6
- metadata.gz: 9bf222fe9c83c702b1755cafd4ea8b023f6e65aa4366e8febd1e7f2442f5056af4a42b8f7be1da1bfb0f712af504429b58ea97b9ff6ad811602c923b334ad4e8
7
- data.tar.gz: 02bd4ee840f8800666bd92117684be256ee92a3e26cd032b3e40112b9874101f325550e10484cd950bbf14ac139842e0ff4afb8ba87ba5d905b6efab7abcc2a6
6
+ metadata.gz: 2d38d6b90b2518f50a3447569d464199b1170037ca836d7de7cd528602027234bf8b1ca240e7b994fac13ea4096f9d00a8aac66538dee93a46fbd7432c9dd142
7
+ data.tar.gz: 1c82092889c2a7ec172cfbb23029d7b75ff430507339af10a52248f521bde514a9ea3d4b2c9ea799b5fd28d50ba33b09496b60c6bab641dd00f393c0e9e88917
data/README.md CHANGED
@@ -10,6 +10,11 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
10
10
  fastlane add_plugin csv_translation
11
11
  ```
12
12
 
13
+ If you are using fastlane using Gemfile in your project, add it to your project by running:
14
+ ```bash
15
+ bundle exec fastlane add_plugin csv_translation
16
+ ```
17
+
13
18
  ## About csv_translation
14
19
 
15
20
  A fastlane plugin to manage translation using a CSV file under git repository. 🚀
@@ -12,7 +12,8 @@ module Fastlane
12
12
  # fetching csv file
13
13
  csv_file_folder = Helper::CsvTranslationHelper.fetch_csv_file(
14
14
  repository_name: params[:repository_name],
15
- branch_name: params[:branch_name]
15
+ branch_name: params[:branch_name],
16
+ feature_branch_name: params[:feature_branch_name]
16
17
  )
17
18
 
18
19
  csv_file_path = "#{csv_file_folder}/#{params[:file_path]}"
@@ -66,6 +67,11 @@ module Fastlane
66
67
  description: "The branch name to your repository, (default master)",
67
68
  is_string: true,
68
69
  default_value: "master"),
70
+ FastlaneCore::ConfigItem.new(key: :feature_branch_name,
71
+ env_name: "FL_CREATE_CSV_TRANSLATION_REQUEST_FEATURE_BRANCH_NAME",
72
+ description: "The feature branch name for new translation request (Useful if no direct commit allowed in master)",
73
+ is_string: true,
74
+ optional: true),
69
75
  FastlaneCore::ConfigItem.new(key: :file_path,
70
76
  env_name: "FL_CREATE_CSV_TRANSLATION_REQUEST_FILE_PATH",
71
77
  description: "The file path to your csv file",
@@ -12,7 +12,8 @@ module Fastlane
12
12
  # fetching csv file
13
13
  csv_file_folder = Helper::CsvTranslationHelper.fetch_csv_file(
14
14
  repository_name: params[:repository_name],
15
- branch_name: params[:branch_name]
15
+ branch_name: params[:branch_name],
16
+ feature_branch_name: params[:feature_branch_name]
16
17
  )
17
18
 
18
19
  csv_file_path = "#{csv_file_folder}/#{params[:file_path]}"
@@ -36,9 +37,9 @@ module Fastlane
36
37
  git_status = Actions::sh("git status --porcelain")
37
38
  is_git_status_clean = git_status.empty?
38
39
 
39
- # raise exception if translation request not found.
40
+ # log message if translation request not found.
40
41
  if is_git_status_clean
41
- UI.user_error!("Please check \"#{csv_row_identifier}\", not found the translation request. 🛑")
42
+ UI.important("Please check \"#{csv_row_identifier}\", not found the translation request. ⁉️")
42
43
  end
43
44
 
44
45
  git_message = "Deleted translation request: identifier: #{csv_row_identifier}"
@@ -81,6 +82,11 @@ module Fastlane
81
82
  description: "The branch name to your repository, (default master)",
82
83
  is_string: true,
83
84
  default_value: "master"),
85
+ FastlaneCore::ConfigItem.new(key: :feature_branch_name,
86
+ env_name: "FL_DELETE_CSV_TRANSLATION_REQUEST_FEATURE_BRANCH_NAME",
87
+ description: "The feature branch name for new translation request (Useful if no direct commit allowed in master)",
88
+ is_string: true,
89
+ optional: true),
84
90
  FastlaneCore::ConfigItem.new(key: :file_path,
85
91
  env_name: "FL_DELETE_CSV_TRANSLATION_REQUEST_FILE_PATH",
86
92
  description: "The file path to your csv file",
@@ -6,15 +6,22 @@ module Fastlane
6
6
  module Helper
7
7
  class CsvTranslationHelper
8
8
 
9
+ def self.csv_file_folder_name
10
+ return ".fl_clone_csv_file"
11
+ end
12
+
13
+ def self.csv_file_folder_path
14
+ return File.join(Dir.pwd, self.csv_file_folder_name)
15
+ end
16
+
9
17
  def self.fetch_csv_file(params)
10
18
  repository_name = params[:repository_name]
11
19
  branch_name = params[:branch_name]
12
20
 
13
21
  # Setup csv_file folder for fresh git clone.
14
- csv_file_folder_name = ".fl_clone_csv_file"
15
- git_clone_folder = File.join(Dir.pwd, csv_file_folder_name)
22
+ git_clone_folder = self.csv_file_folder_path
16
23
  FileUtils.rm_rf(git_clone_folder) if File.directory?(git_clone_folder)
17
- Dir.mkdir(csv_file_folder_name)
24
+ Dir.mkdir(self.csv_file_folder_name)
18
25
 
19
26
  UI.success("Fetching csv file from git repo... ⏳")
20
27
  branch_option = "--branch #{branch_name}" if branch_name != 'HEAD'
@@ -22,9 +29,22 @@ module Fastlane
22
29
  Fastlane::Actions::sh("git clone #{git_url.shellescape} #{git_clone_folder.shellescape} --depth 1 -n #{branch_option}")
23
30
  Fastlane::Actions::sh("cd #{git_clone_folder.shellescape} && git checkout #{branch_name}")
24
31
 
32
+ self.create_feature_branch(params) if params[:feature_branch_name]
33
+
25
34
  return git_clone_folder
26
35
  end
27
36
 
37
+ def self.create_feature_branch(params)
38
+ git_clone_folder = self.csv_file_folder_path
39
+
40
+ # creating and checkout new branch
41
+ branch_name = params[:feature_branch_name]
42
+ Fastlane::Actions::sh("cd #{git_clone_folder.shellescape} && git checkout -b #{branch_name}")
43
+
44
+ # pushing newly created branch
45
+ Fastlane::Actions::sh("cd #{git_clone_folder.shellescape} && git push -u origin #{branch_name}")
46
+ end
47
+
28
48
  end
29
49
  end
30
50
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module CsvTranslation
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-csv_translation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manish Rathi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-10 00:00:00.000000000 Z
11
+ date: 2020-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry