yamlfish 0.1.0.alpha2 → 0.1.0.rc1

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: 49157d9d4bd38be7815795f988ec8b7029099a624c461ddd0b10e56f901e1ca5
4
+ data.tar.gz: 761f1992eb5676261ca80a84a7b1b5b69690052f16ddb5b3445146738232ffd3
5
5
  SHA512:
6
- metadata.gz: 1441f3a45996505674ca21af113a5b4704da38de26b599f1afa35244d598f57358aecbd6546ddc6fc48e9bf9c12c57541cc2a907f879bd412bf6823a49f26be7
7
- data.tar.gz: 445bb5b1a86a9b7c43cd8f64f8987944e50517f7579d3d7b5a499c9ed849ca188b99986fb14fb7e0c5902bf4357b428ff8d637e10da97f629386195bf318a36f
6
+ metadata.gz: 4cf03873a81a812551491e8bee607b0a0beefb4000a57de94f789b81cd66fbb76e1b221376e65c2380fa19b35eb56850b4f6c8ffa2313a8289d8d0b09204370d
7
+ data.tar.gz: 8b5ca3a399a3bed89c3edc87b001c886b6690cd3955ab6b8bd334a0aae155220d085236b858b3ebc892f1d7bc7c0d8203d7ee7d51516b7a0de6e003a96f6b8c7
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/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.rc1"
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.rc1
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-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -106,11 +106,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  version: 2.6.0
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">"
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 1.3.1
111
+ version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.4.21
113
+ rubygems_version: 3.5.10
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Easily manage your translations with yamlfish