i18n-wigodo 0.1.2 → 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: 678e25416451af890b1e6a89bc11184a92e4ba782712ba6a77cdeabf36645579
4
- data.tar.gz: bab9592b702e715ea8e2d64596428486f2b7709822f101c7e2272c939067a0b7
3
+ metadata.gz: 7572d4bfaa1d27de8e4a403a0f5afddba3a65721d0f190a4b418af138384f069
4
+ data.tar.gz: 132463a6c1afff1655005c997dbd756247dbe92a994f24b9eb4e8c7a91addcbd
5
5
  SHA512:
6
- metadata.gz: 4bebd32cb1168779bd2e87d47e3760a26170afdb949155f0d24905b6bcf398983b0d860ce1cec3170e9a27ff9a798bbd18e4ca52cd38098aabefe99affddad60
7
- data.tar.gz: cf3a7b8888c3a4448e90db0ffeb3cf1d5415a03068d435e79275707b2ed17a87a72d3eecaeff52567245e69b5d21d6bebecade806229d27b7ac6140cc585d740
6
+ metadata.gz: 89b983c7db48d0051c785979d5fb8c1de9263e422d28a5ca8b8b0b3abf109c751e5bd1484432fb9654842abbc935611bdd81e4e1973d5e7deee91a72ff6c0ce6
7
+ data.tar.gz: a5aca3a0bc7c61c054d5123586684c01d701b9b385ab92b68cdaada23f3f55966332ba953c6a166e0c55d0937b74df55098ab087ed5cef17edbb447182bf989b
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,41 @@
1
- # Contributor Covenant Code of Conduct
1
+ # Code of Conduct
2
2
 
3
- ## Our Pledge
3
+ ## Philosophy
4
4
 
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
5
+ This project exists to make a positive impact on the world through collaborative effort. We believe that personal growth and technical excellence go hand in hand.
11
6
 
12
- ## Our Standards
7
+ ## Core Principles
13
8
 
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
9
+ 1. **Do No Harm**
10
+ We commit to avoiding actions that could harm the project or its community, whether through code, communications, or conduct.
16
11
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
12
+ 2. **Practice Honesty**
13
+ We communicate truthfully and transparently about our work, capabilities, and challenges.
22
14
 
23
- Examples of unacceptable behavior by participants include:
15
+ 3. **Respect Resources**
16
+ We value and respect everyone's time, effort, and contributions. We take only what is freely given.
24
17
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
18
+ 4. **Speak Mindfully**
19
+ We choose our words carefully, ensuring our communication is truthful, helpful, and constructive.
33
20
 
34
- ## Our Responsibilities
21
+ ## Conflict Resolution
35
22
 
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
23
+ When conflicts arise, we:
24
+ - Take responsibility for our own reactions and emotions
25
+ - Use disagreements as opportunities for learning and growth
26
+ - Focus on finding solutions rather than assigning blame
27
+ - Practice equanimity in the face of criticism or disagreement
39
28
 
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
29
+ ## Expectations
45
30
 
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
31
+ Contributors agree to:
32
+ - Contribute to the best of their ability
33
+ - Accept that others will do the same
34
+ - Focus on improving themselves rather than criticizing others
35
+ - Work towards the common good of the project
56
36
 
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at malte.muenchert@gmx.net. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
37
+ ## Scope
69
38
 
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
39
+ This code applies to all project spaces, including issues, pull requests, discussions, and any project-related communications.
72
40
 
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
41
+ Remember: Your participation in this project is voluntary, and your contributions are appreciated. Let's work together to create something beneficial for all.
data/README.md CHANGED
@@ -35,9 +35,63 @@ Or install it yourself as:
35
35
 
36
36
  $ gem install i18n-wigodo
37
37
 
38
+ ## Configuration
39
+
40
+ The spreadsheet file is either identified by the URL or directly via the
41
+ `document_id`.
42
+
43
+ There is an [example file](https://docs.google.com/spreadsheets/d/1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc/edit?gid=0#gid=0) showing how the columns should be laid out.
44
+ The `document_id` of this file is the part between `d/` and `/edit`: `1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc`.
45
+
46
+ You have two options to set this:
47
+
48
+ ### Initializer (recommended)
49
+
50
+ After the gem is loaded from a Rails app, you can use the install
51
+ generator to create the initializer file:
52
+
53
+ ```sh
54
+ bin/rails wigodo:install --url="https://docs.google.com/spreadsheets/d/1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc/edit?gid=0#gid=0"
55
+ ```
56
+
57
+ This will create `config/initializers/wigodo.rb` inside your Rails
58
+ project and store the URL to the translations document.
59
+ The `--url` parameter is optional, though.
60
+
61
+ Alternatively, create the initializer file manually:
62
+
63
+ Add `config/initializers/wigodo.rb`
64
+
65
+ ```Ruby
66
+ I18nWigodo.configure do |config|
67
+ config.document_url = "https://docs.google.com/spreadsheets/d/1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc/edit?gid=0#gid=0"
68
+
69
+ # Or just provide the document_id
70
+ # config.document_id = "1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc"
71
+ end
72
+ ```
73
+
74
+ ### YAML files (deprecated)
75
+
76
+ Rails will read the config from `config/credentials.yml` or
77
+ `config/secrets.yml`
78
+
79
+ Add a key `wigodo_doc_id` containing the `document_id`.
80
+ Just storing the URL directly is not supported with this method.
81
+
82
+ Example:
83
+
84
+ ```yaml
85
+ wigodo_doc_id: 1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc
86
+ ```
87
+
38
88
  ## Usage
39
89
 
40
- TODO: Write usage instructions here
90
+ ###
91
+
92
+ ```sh
93
+ rake wigodo:fetch
94
+ ```
41
95
 
42
96
  ## Development
43
97
 
data/i18n_wigodo.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ["lib"]
34
34
 
35
- spec.add_development_dependency "bundler", "~> 1.16"
36
- spec.add_development_dependency "rake", "~> 12.3"
37
- spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "bundler", "~> 2.5"
36
+ spec.add_development_dependency "rake", "~> 13.2"
37
+ spec.add_development_dependency "rspec", "~> 3.13"
38
38
  end
@@ -0,0 +1,18 @@
1
+ require "rails/generators"
2
+
3
+ module I18nWigodo
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path("templates", __dir__)
6
+
7
+ class_option :url, type: :string, default: nil, desc: "URL to translation spreadsheet (Google Docs) [optional]."
8
+
9
+ namespace "wigodo:install"
10
+
11
+ desc "Create initializer file for Wigodo (put the URL to your spreadsheet there)."
12
+ def create_initializer
13
+ @url = options[:url] || ''
14
+ template "initializer.rb.erb", "config/initializers/wigodo.rb"
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,3 @@
1
+ I18nWigodo.configure do |config|
2
+ config.document_url = <%= @url.inspect %>
3
+ end
@@ -0,0 +1,36 @@
1
+ module I18nWigodo
2
+ class Configuration
3
+ attr_accessor :document_id
4
+ attr_accessor :document_url
5
+
6
+ def initialize
7
+ id_from_credentials = Rails.application.credentials.wigodo_doc_id
8
+ id_from_secrets = Rails.application.respond_to?(:secrets) ? Rails.application.secrets.wigodo_doc_id : nil
9
+ @document_id = id_from_credentials || id_from_secrets
10
+ end
11
+
12
+ def get_document_id
13
+ if @document_url
14
+ if @document_url =~ /^https:\/\/docs\.google\.com\/spreadsheets\/d\//
15
+ @document_url.split('/')[5]
16
+ else
17
+ raise "Wigodo: document_url has an unexpected format #{@document_url}. It might help to update the gem (i18n-wigodo)."
18
+ end
19
+ else
20
+ if @document_id.present?
21
+ @document_id
22
+ else
23
+ nil
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ def self.configuration
30
+ @configuration ||= Configuration.new
31
+ end
32
+
33
+ def self.configure
34
+ yield(configuration)
35
+ end
36
+ end
@@ -17,18 +17,24 @@ end
17
17
 
18
18
  namespace :wigodo do
19
19
  desc 'Import translations from Google Drive'
20
- task :fetch do
21
- document_id = Rails.application.secrets.wigodo_doc_id || Rails.application.credentials.wigodo_doc_id
20
+ task fetch: :environment do
21
+ document_id = I18nWigodo.configuration.get_document_id
22
22
 
23
23
  unless document_id
24
- abort("i18n-wigodo: wigodo_doc_id not set!\n" +
25
- "Add the id of your Google Doc spreadsheet to\n" +
26
- "config/credentials.yml (Rails < 5.2: config/secrets.yml).\n" +
27
- "Use wigodo_doc_id as key.\n\n" +
28
- "Example:\n\n" +
29
- "wigodo_doc_id: 1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc\n\n" +
30
- "(This is the id of a sample document your can check out here:\n" +
31
- "https://docs.google.com/spreadsheets/d/1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc/edit#gid=0")
24
+ abort(<<~HELP
25
+ i18n-wigodo: document_url not set!
26
+
27
+ Get the URL to your spreadsheet.
28
+ Here is an example file:
29
+ https://docs.google.com/spreadsheets/d/1en5BoKGaAqO9_BRSQ9CQKkvwrYQWNBUPjgSzxyn83Pc/edit?gid=0#gid=0
30
+
31
+ Then, create an initializer in config/initializers/wigodo.rb like so:
32
+
33
+ I18nWigodo.configure do |config|
34
+ config.document_url = "(url to your Google Doc spreadsheet)"
35
+ end
36
+ HELP
37
+ )
32
38
  end
33
39
 
34
40
  resp = fetch_with_redirect("https://docs.google.com/spreadsheets/d/#{document_id}/export?format=csv")
@@ -1,3 +1,3 @@
1
1
  module I18nWigodo
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/i18n_wigodo.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'i18n_wigodo/version'
2
2
  require 'i18n_wigodo/railtie' if defined?(Rails)
3
+ require 'i18n_wigodo/configuration'
4
+ require 'generators/i18n_wigodo/install_generator'
3
5
 
4
6
  module I18nWigodo
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-wigodo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Malte Münchert
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2025-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.3'
33
+ version: '13.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '12.3'
40
+ version: '13.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '3.13'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '3.13'
55
55
  description: Adds a rake task to your Rails app that lets you fetch your translations
56
56
  from a Google Doc spreadsheet and convert it into YAML
57
57
  email:
@@ -71,8 +71,11 @@ files:
71
71
  - bin/console
72
72
  - bin/setup
73
73
  - i18n_wigodo.gemspec
74
+ - lib/generators/i18n_wigodo/install_generator.rb
75
+ - lib/generators/i18n_wigodo/templates/initializer.rb.erb
74
76
  - lib/i18n-wigodo.rb
75
77
  - lib/i18n_wigodo.rb
78
+ - lib/i18n_wigodo/configuration.rb
76
79
  - lib/i18n_wigodo/railtie.rb
77
80
  - lib/i18n_wigodo/tasks/wigodo.rake
78
81
  - lib/i18n_wigodo/version.rb
@@ -81,7 +84,7 @@ licenses:
81
84
  - MIT
82
85
  metadata:
83
86
  allowed_push_host: https://rubygems.org
84
- post_install_message:
87
+ post_install_message:
85
88
  rdoc_options: []
86
89
  require_paths:
87
90
  - lib
@@ -96,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
99
  - !ruby/object:Gem::Version
97
100
  version: '0'
98
101
  requirements: []
99
- rubygems_version: 3.1.4
100
- signing_key:
102
+ rubygems_version: 3.5.11
103
+ signing_key:
101
104
  specification_version: 4
102
105
  summary: Fetch translations from a Google Doc spreadsheet
103
106
  test_files: []