nabokov 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +1 -0
  3. data/.gitignore +43 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +113 -0
  6. data/.travis.yml +14 -0
  7. data/CHANGELOG.md +5 -0
  8. data/Gemfile +9 -0
  9. data/LICENSE +21 -0
  10. data/README.md +16 -0
  11. data/Rakefile +22 -0
  12. data/bin/nabokov +5 -0
  13. data/lib/nabokov/commands/runner.rb +22 -0
  14. data/lib/nabokov/commands/setup.rb +75 -0
  15. data/lib/nabokov/commands/syncers/localizations_repo_syncer.rb +101 -0
  16. data/lib/nabokov/commands/syncers/project_syncer.rb +106 -0
  17. data/lib/nabokov/commands/syncers/syncer.rb +68 -0
  18. data/lib/nabokov/core/file_manager.rb +36 -0
  19. data/lib/nabokov/core/nabokovfile.rb +66 -0
  20. data/lib/nabokov/core/nabokovfile_content_validator.rb +51 -0
  21. data/lib/nabokov/core/nabokovfile_keys.rb +34 -0
  22. data/lib/nabokov/git/git_repo.rb +137 -0
  23. data/lib/nabokov/helpers/informator.rb +83 -0
  24. data/lib/nabokov/helpers/merger.rb +86 -0
  25. data/lib/nabokov/models/strings_file.rb +7 -0
  26. data/lib/nabokov/version.rb +8 -0
  27. data/lib/nabokov.rb +14 -0
  28. data/nabokov.gemspec +31 -0
  29. data/spec/fixtures/.DS_Store +0 -0
  30. data/spec/fixtures/README.md +1 -0
  31. data/spec/fixtures/de.strings +1 -0
  32. data/spec/fixtures/en.strings +1 -0
  33. data/spec/fixtures/nabokovfile_example.yaml +9 -0
  34. data/spec/fixtures/nabokovfile_example_invalid.yaml +2 -0
  35. data/spec/fixtures/nabokovfile_example_without_master_branch.yaml +8 -0
  36. data/spec/fixtures/test_git_setup/existed_pre_commit_file +0 -0
  37. data/spec/fixtures/test_git_setup/existed_pre_commit_file_alias +0 -0
  38. data/spec/fixtures/test_git_setup/not_executable_pre_commit_file +0 -0
  39. data/spec/fixtures/test_localizations_repo_syncer/localizations_repo_fixtures/README.md +1 -0
  40. data/spec/fixtures/test_localizations_repo_syncer/nabokovfile.yaml +8 -0
  41. data/spec/fixtures/test_project_syncer/localizations_repo_fixtures/de.strings +2 -0
  42. data/spec/fixtures/test_project_syncer/localizations_repo_fixtures/en.strings +2 -0
  43. data/spec/fixtures/test_project_syncer/project_repo_fixtures/de.strings +2 -0
  44. data/spec/fixtures/test_project_syncer/project_repo_fixtures/en.strings +2 -0
  45. data/spec/fixtures/test_project_syncer/project_repo_fixtures/nabokovfile.yaml +9 -0
  46. data/spec/lib/nabokov/commands/localizations_repo_syncer_spec.rb +137 -0
  47. data/spec/lib/nabokov/commands/project_syncer_spec.rb +61 -0
  48. data/spec/lib/nabokov/commands/runner_spec.rb +7 -0
  49. data/spec/lib/nabokov/commands/setup_spec.rb +101 -0
  50. data/spec/lib/nabokov/commands/syncer_spec.rb +23 -0
  51. data/spec/lib/nabokov/core/file_manager_spec.rb +115 -0
  52. data/spec/lib/nabokov/core/nabokovfile_content_validator_spec.rb +155 -0
  53. data/spec/lib/nabokov/core/nabokovfile_keyes_spec.rb +31 -0
  54. data/spec/lib/nabokov/core/nabokovfile_spec.rb +53 -0
  55. data/spec/lib/nabokov/git/git_repo_spec.rb +670 -0
  56. data/spec/lib/nabokov/helpers/informator_spec.rb +49 -0
  57. data/spec/lib/nabokov/helpers/merger_spec.rb +114 -0
  58. data/spec/lib/nabokov/models/strings_file_spec.rb +7 -0
  59. data/spec/spec_helper.rb +11 -0
  60. metadata +238 -0
@@ -0,0 +1,53 @@
1
+ require "nabokov/core/nabokovfile"
2
+
3
+ describe Nabokov::Nabokovfile do
4
+ context "when there is no nabokovfile at the given path" do
5
+ it "raises an exception" do
6
+ expect { Nabokov::Nabokovfile.new("./nabokovfile.yml") }.to raise_error("Couldn't find nabokov file at './nabokovfile.yml'")
7
+ end
8
+ end
9
+
10
+ context "when the file does not have a legit YAML syntax" do
11
+ it "raises an exception" do
12
+ expect { Nabokov::Nabokovfile.new("spec/fixtures/nabokovfile_example_invalid.yaml") }.to raise_error("File at 'spec/fixtures/nabokovfile_example_invalid.yaml' doesn't have a legit YAML syntax")
13
+ end
14
+ end
15
+
16
+ context "when the file has legit YAML syntax and exists" do
17
+ before do
18
+ @nabokovfile = Nabokov::Nabokovfile.new("spec/fixtures/nabokovfile_example.yaml")
19
+ end
20
+
21
+ it "assigns the localization_git_repo value" do
22
+ expect(@nabokovfile.localizations_repo_url).to eql("https://github.com/Antondomashnev/nabokov_example.git")
23
+ end
24
+
25
+ it "assigns the project_localization_file_paths value" do
26
+ expect(@nabokovfile.project_localization_file_paths) == { "en" => "spec/fixtures/en.stirngs", "de" => "spec/fixtures/de.strings" }
27
+ end
28
+
29
+ it "assigns the localization_local_path value" do
30
+ expect(@nabokovfile.localizations_repo_local_path).to eql("#{Dir.home}/.nabokov/antondomashnev/nabokov_example")
31
+ end
32
+
33
+ it "assigns the project_local_path value" do
34
+ expect(@nabokovfile.project_local_path).to eql("spec/fixtures/local_project")
35
+ end
36
+
37
+ context "when the master_branch key is presented" do
38
+ it "assigns the localizations_repo_master_branch value" do
39
+ expect(@nabokovfile.localizations_repo_master_branch).to eql("shmaster")
40
+ end
41
+ end
42
+
43
+ context "when the master_branch key is not presented" do
44
+ before do
45
+ @nabokovfile = Nabokov::Nabokovfile.new("spec/fixtures/nabokovfile_example_without_master_branch.yaml")
46
+ end
47
+
48
+ it "assigns the localizations_repo_master_branch default value" do
49
+ expect(@nabokovfile.localizations_repo_master_branch).to eql("master")
50
+ end
51
+ end
52
+ end
53
+ end