nabokov 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +1 -0
- data/.gitignore +43 -0
- data/.rspec +2 -0
- data/.rubocop.yml +113 -0
- data/.travis.yml +14 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +16 -0
- data/Rakefile +22 -0
- data/bin/nabokov +5 -0
- data/lib/nabokov/commands/runner.rb +22 -0
- data/lib/nabokov/commands/setup.rb +75 -0
- data/lib/nabokov/commands/syncers/localizations_repo_syncer.rb +101 -0
- data/lib/nabokov/commands/syncers/project_syncer.rb +106 -0
- data/lib/nabokov/commands/syncers/syncer.rb +68 -0
- data/lib/nabokov/core/file_manager.rb +36 -0
- data/lib/nabokov/core/nabokovfile.rb +66 -0
- data/lib/nabokov/core/nabokovfile_content_validator.rb +51 -0
- data/lib/nabokov/core/nabokovfile_keys.rb +34 -0
- data/lib/nabokov/git/git_repo.rb +137 -0
- data/lib/nabokov/helpers/informator.rb +83 -0
- data/lib/nabokov/helpers/merger.rb +86 -0
- data/lib/nabokov/models/strings_file.rb +7 -0
- data/lib/nabokov/version.rb +8 -0
- data/lib/nabokov.rb +14 -0
- data/nabokov.gemspec +31 -0
- data/spec/fixtures/.DS_Store +0 -0
- data/spec/fixtures/README.md +1 -0
- data/spec/fixtures/de.strings +1 -0
- data/spec/fixtures/en.strings +1 -0
- data/spec/fixtures/nabokovfile_example.yaml +9 -0
- data/spec/fixtures/nabokovfile_example_invalid.yaml +2 -0
- data/spec/fixtures/nabokovfile_example_without_master_branch.yaml +8 -0
- data/spec/fixtures/test_git_setup/existed_pre_commit_file +0 -0
- data/spec/fixtures/test_git_setup/existed_pre_commit_file_alias +0 -0
- data/spec/fixtures/test_git_setup/not_executable_pre_commit_file +0 -0
- data/spec/fixtures/test_localizations_repo_syncer/localizations_repo_fixtures/README.md +1 -0
- data/spec/fixtures/test_localizations_repo_syncer/nabokovfile.yaml +8 -0
- data/spec/fixtures/test_project_syncer/localizations_repo_fixtures/de.strings +2 -0
- data/spec/fixtures/test_project_syncer/localizations_repo_fixtures/en.strings +2 -0
- data/spec/fixtures/test_project_syncer/project_repo_fixtures/de.strings +2 -0
- data/spec/fixtures/test_project_syncer/project_repo_fixtures/en.strings +2 -0
- data/spec/fixtures/test_project_syncer/project_repo_fixtures/nabokovfile.yaml +9 -0
- data/spec/lib/nabokov/commands/localizations_repo_syncer_spec.rb +137 -0
- data/spec/lib/nabokov/commands/project_syncer_spec.rb +61 -0
- data/spec/lib/nabokov/commands/runner_spec.rb +7 -0
- data/spec/lib/nabokov/commands/setup_spec.rb +101 -0
- data/spec/lib/nabokov/commands/syncer_spec.rb +23 -0
- data/spec/lib/nabokov/core/file_manager_spec.rb +115 -0
- data/spec/lib/nabokov/core/nabokovfile_content_validator_spec.rb +155 -0
- data/spec/lib/nabokov/core/nabokovfile_keyes_spec.rb +31 -0
- data/spec/lib/nabokov/core/nabokovfile_spec.rb +53 -0
- data/spec/lib/nabokov/git/git_repo_spec.rb +670 -0
- data/spec/lib/nabokov/helpers/informator_spec.rb +49 -0
- data/spec/lib/nabokov/helpers/merger_spec.rb +114 -0
- data/spec/lib/nabokov/models/strings_file_spec.rb +7 -0
- data/spec/spec_helper.rb +11 -0
- 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
|