yamlfish 0.1.0.alpha2 → 0.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d12427d97a7ae3df74fd9eb9506e000bd5d4769c9d3e8c3bf403c03eebae4b40
4
- data.tar.gz: 1a5ce410afd9e1944b42d9b8840ad48a4980537aa19be9bbe5cc7f53139e0806
3
+ metadata.gz: f39e202ade947987febfd14899b18b537a9545ef093d4a8ecf6b45cabf980bd4
4
+ data.tar.gz: f4efc6422f4d8526d8ae5203ff2569ccb0d1a25c71d128f98f4a4079c57d6d80
5
5
  SHA512:
6
- metadata.gz: 1441f3a45996505674ca21af113a5b4704da38de26b599f1afa35244d598f57358aecbd6546ddc6fc48e9bf9c12c57541cc2a907f879bd412bf6823a49f26be7
7
- data.tar.gz: 445bb5b1a86a9b7c43cd8f64f8987944e50517f7579d3d7b5a499c9ed849ca188b99986fb14fb7e0c5902bf4357b428ff8d637e10da97f629386195bf318a36f
6
+ metadata.gz: 34a6c43f12db61c42e218cdc5e5e43d7dd6d85b88738deb86c40cec8ed3059df219b44e24caa5fe248f9f99b34cbebc6bc1a96fa3dca038963744c5a25736fc9
7
+ data.tar.gz: 440223976ca8416174716d2bda1994929592a53747445aef8fea82da78a6fc4647614bc0784f25c39e27c59cb8f1ddc4bd9736ef0dddc0f07f81b878325fb398
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yamlfish (0.1.0.alpha1)
4
+ yamlfish (0.1.0.rc1)
5
5
  activesupport (>= 6)
6
6
  faraday (~> 2.0)
7
7
  rainbow (~> 3.1)
@@ -10,57 +10,58 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.1.3)
13
+ activesupport (7.2.1)
14
14
  base64
15
15
  bigdecimal
16
- concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ concurrent-ruby (~> 1.0, >= 1.3.1)
17
17
  connection_pool (>= 2.2.5)
18
18
  drb
19
19
  i18n (>= 1.6, < 2)
20
+ logger (>= 1.4.2)
20
21
  minitest (>= 5.1)
21
- mutex_m
22
- tzinfo (~> 2.0)
22
+ securerandom (>= 0.3)
23
+ tzinfo (~> 2.0, >= 2.0.5)
23
24
  base64 (0.2.0)
24
- bigdecimal (3.1.6)
25
- concurrent-ruby (1.2.3)
25
+ bigdecimal (3.1.8)
26
+ concurrent-ruby (1.3.4)
26
27
  connection_pool (2.4.1)
27
- diff-lcs (1.5.0)
28
- drb (2.2.0)
29
- ruby2_keywords
30
- faraday (2.9.0)
31
- faraday-net_http (>= 2.0, < 3.2)
32
- faraday-net_http (3.1.0)
28
+ diff-lcs (1.5.1)
29
+ drb (2.2.1)
30
+ faraday (2.11.0)
31
+ faraday-net_http (>= 2.0, < 3.4)
32
+ logger
33
+ faraday-net_http (3.3.0)
33
34
  net-http
34
- i18n (1.14.1)
35
+ i18n (1.14.5)
35
36
  concurrent-ruby (~> 1.0)
36
- minitest (5.22.2)
37
- mutex_m (0.2.0)
37
+ logger (1.6.0)
38
+ minitest (5.25.1)
38
39
  net-http (0.4.1)
39
40
  uri
40
41
  rainbow (3.1.1)
41
- rake (13.0.6)
42
- rspec (3.12.0)
43
- rspec-core (~> 3.12.0)
44
- rspec-expectations (~> 3.12.0)
45
- rspec-mocks (~> 3.12.0)
46
- rspec-core (3.12.2)
47
- rspec-support (~> 3.12.0)
48
- rspec-expectations (3.12.3)
42
+ rake (13.2.1)
43
+ rspec (3.13.0)
44
+ rspec-core (~> 3.13.0)
45
+ rspec-expectations (~> 3.13.0)
46
+ rspec-mocks (~> 3.13.0)
47
+ rspec-core (3.13.0)
48
+ rspec-support (~> 3.13.0)
49
+ rspec-expectations (3.13.2)
49
50
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.12.0)
51
- rspec-mocks (3.12.6)
51
+ rspec-support (~> 3.13.0)
52
+ rspec-mocks (3.13.1)
52
53
  diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.12.0)
54
- rspec-support (3.12.1)
55
- ruby2_keywords (0.0.5)
56
- thor (1.3.0)
54
+ rspec-support (~> 3.13.0)
55
+ rspec-support (3.13.1)
56
+ securerandom (0.3.1)
57
+ thor (1.3.1)
57
58
  tzinfo (2.0.6)
58
59
  concurrent-ruby (~> 1.0)
59
- uri (0.13.0)
60
+ uri (0.13.1)
60
61
 
61
62
  PLATFORMS
62
- x86_64-darwin-21
63
- x86_64-darwin-22
63
+ arm64-darwin-23
64
+ ruby
64
65
 
65
66
  DEPENDENCIES
66
67
  rake (~> 13.0)
@@ -68,4 +69,4 @@ DEPENDENCIES
68
69
  yamlfish!
69
70
 
70
71
  BUNDLED WITH
71
- 2.2.32
72
+ 2.5.18
data/README.md CHANGED
@@ -1 +1,33 @@
1
- # Yamlfish
1
+ # YAMLFish CLI
2
+
3
+ This is the command line interface for [YAMLFish](https:s://yamlfish.dev), the simple and powerful translation management platform.
4
+
5
+ ## Installation
6
+
7
+ The YAMLFish CLI is available as a Ruby gem.
8
+ First, make sure you have Ruby installed on your machine. You can follow the [official Ruby installation guide](https://www.ruby-lang.org/en/documentation/installation/) for your operating system.
9
+
10
+ Then, to install the YAMLFish CLI, run:
11
+
12
+ ```bash
13
+ gem install yamlfish --pre
14
+ ```
15
+
16
+ YAMLFish is still in beta, hence the `--pre` flag to install the latest RC.
17
+
18
+ ## Configuration
19
+
20
+ Before you can use the YAMLFish CLI, you need to configure it with your API key and project token.
21
+
22
+ To do this, create a `.yamlfish.yml` file in your project's root directory with the following content:
23
+
24
+ ```yaml
25
+ api_key: YOUR_API_KEY
26
+ project_token: YOUR_PROJECT_TOKEN
27
+ ```
28
+
29
+ Those secrets can be found in the footer of your project's page on YAMLFish.
30
+
31
+ ## Usage
32
+
33
+ For usage instructions, please refer to the [official documentation](https://yamlfish.dev/docs/).
data/exe/yamlfish CHANGED
@@ -9,6 +9,9 @@ class YamlfishExe < Thor
9
9
  option :branch, type: :string, default: "main"
10
10
  def push(locale)
11
11
  Yamlfish::Cli::Push.new(locale, branch: options[:branch]).call
12
+ rescue Errno::ENOENT => e
13
+ puts Rainbow("Could not push: #{e.message}").red.bright
14
+ exit 1
12
15
  end
13
16
 
14
17
  desc "pull", "Pulls translations from yamlfish"
@@ -17,6 +20,14 @@ class YamlfishExe < Thor
17
20
  option :branch, type: :string, default: "main"
18
21
  def pull(locale)
19
22
  Yamlfish::Cli::Pull.new(locale, inplace: options[:inplace], force_update: options[:force_update], branch: options[:branch]).call
23
+ rescue Errno::ENOENT => e
24
+ puts Rainbow("Could not pull: #{e.message}").red.bright
25
+ exit 1
26
+ end
27
+
28
+ desc "version", "Prints the version"
29
+ def version
30
+ puts Yamlfish::Cli::VERSION
20
31
  end
21
32
  end
22
33
 
@@ -28,7 +28,7 @@ module Yamlfish
28
28
 
29
29
  if response.status != 200
30
30
  puts Rainbow("Failed to pull, unexpected HTTP status #{response.status}").red.bright
31
- return
31
+ exit 1
32
32
  end
33
33
 
34
34
  translations = JSON.parse(response.body)
@@ -45,7 +45,7 @@ module Yamlfish
45
45
  private
46
46
 
47
47
  def replace_inplace(translations)
48
- Dir.glob("./config/locales/**/*.yml").each do |filename|
48
+ Dir.glob("./#{Yamlfish::Cli.configuration.locales_path}/**/*.yml").each do |filename|
49
49
  file = YAML.load_file(filename).dot_flatten
50
50
  update = false
51
51
 
@@ -61,7 +61,7 @@ module Yamlfish
61
61
  end
62
62
 
63
63
  def dump_translations(translations)
64
- File.write("./config/locales/#{@locale_identifier}.yml", Yamlfish::Cli::YamlDumper.dump(translations.dot_unflatten))
64
+ File.write("./#{Yamlfish::Cli.configuration.locales_path}/#{@locale_identifier}.yml", Yamlfish::Cli::YamlDumper.dump(translations.dot_unflatten))
65
65
  end
66
66
  end
67
67
  end
@@ -12,7 +12,7 @@ module Yamlfish
12
12
  end
13
13
 
14
14
  def call
15
- translations = Dir.glob("./config/locales/**/*.yml").each_with_object({}) do |filename, translations|
15
+ translations = Dir.glob("./#{Yamlfish::Cli.configuration.locales_path}/**/*.yml").each_with_object({}) do |filename, translations|
16
16
  translations.deep_merge!(YAML.load_file(filename))
17
17
  end
18
18
 
@@ -31,6 +31,7 @@ module Yamlfish
31
31
  puts "Successfully pushed translations for locale #{Rainbow(@locale_identifier).magenta.bright} on branch #{Rainbow(@branch).magenta.bright}"
32
32
  else
33
33
  puts Rainbow("Failed to push, unexpected HTTP status #{response.status}").red.bright
34
+ exit 1
34
35
  end
35
36
  end
36
37
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yamlfish
4
4
  module Cli
5
- VERSION = "0.1.0.alpha2"
5
+ VERSION = "0.1.0.rc2"
6
6
  end
7
7
  end
data/lib/yamlfish/cli.rb CHANGED
@@ -16,9 +16,10 @@ module Yamlfish
16
16
  end
17
17
 
18
18
  class Configuration
19
- attr_accessor :api_key, :project_token, :base_url
19
+ attr_accessor :api_key, :project_token, :base_url, :locales_path
20
20
 
21
21
  DEFAULT_BASE_URL = "https://yamlfish.dev/api/v1"
22
+ DEFAULT_LOCALES_PATH = "config/locales"
22
23
 
23
24
  def initialize
24
25
  configuration = begin
@@ -30,6 +31,7 @@ module Yamlfish
30
31
  @api_key = configuration["api_key"]
31
32
  @project_token = configuration["project_token"]
32
33
  @base_url = configuration["base_url"] || DEFAULT_BASE_URL
34
+ @locales_path = configuration["locales_path"] || DEFAULT_LOCALES_PATH
33
35
  end
34
36
  end
35
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamlfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha2
4
+ version: 0.1.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Siami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-01 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,7 @@ homepage: https://yamlfish.dev
94
94
  licenses:
95
95
  - MIT
96
96
  metadata:
97
+ source_code_uri: https://github.com/yamlfish/yamlfish-cli
97
98
  homepage_uri: https://yamlfish.dev
98
99
  post_install_message:
99
100
  rdoc_options: []
@@ -106,11 +107,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
107
  version: 2.6.0
107
108
  required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  requirements:
109
- - - ">"
110
+ - - ">="
110
111
  - !ruby/object:Gem::Version
111
- version: 1.3.1
112
+ version: '0'
112
113
  requirements: []
113
- rubygems_version: 3.4.21
114
+ rubygems_version: 3.5.10
114
115
  signing_key:
115
116
  specification_version: 4
116
117
  summary: Easily manage your translations with yamlfish