esr-rim 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +40 -0
  3. data/README.md +3 -0
  4. data/Rakefile +56 -0
  5. data/bin/rim +3 -0
  6. data/lib/rim/command/command.rb +37 -0
  7. data/lib/rim/command/status.rb +110 -0
  8. data/lib/rim/command/sync.rb +69 -0
  9. data/lib/rim/command/upload.rb +33 -0
  10. data/lib/rim/command_helper.rb +119 -0
  11. data/lib/rim/dirty_check.rb +111 -0
  12. data/lib/rim/file_helper.rb +58 -0
  13. data/lib/rim/file_logger.rb +21 -0
  14. data/lib/rim/git.rb +339 -0
  15. data/lib/rim/manifest/helper.rb +82 -0
  16. data/lib/rim/manifest/json_reader.rb +40 -0
  17. data/lib/rim/manifest/manifest.json +7 -0
  18. data/lib/rim/manifest/model.rb +33 -0
  19. data/lib/rim/manifest/repo_reader.rb +61 -0
  20. data/lib/rim/module_helper.rb +52 -0
  21. data/lib/rim/module_info.rb +30 -0
  22. data/lib/rim/processor.rb +126 -0
  23. data/lib/rim/rev_status.rb +61 -0
  24. data/lib/rim/rim.rb +93 -0
  25. data/lib/rim/rim_exception.rb +15 -0
  26. data/lib/rim/rim_info.rb +129 -0
  27. data/lib/rim/status_builder.rb +219 -0
  28. data/lib/rim/sync_helper.rb +121 -0
  29. data/lib/rim/sync_module_helper.rb +115 -0
  30. data/lib/rim/upload_helper.rb +67 -0
  31. data/lib/rim/upload_module_helper.rb +152 -0
  32. data/lib/rim/version.rb +10 -0
  33. data/test/dirty_check_test.rb +210 -0
  34. data/test/file_helper_test.rb +132 -0
  35. data/test/git_test.rb +49 -0
  36. data/test/manifest_helper_test.rb +29 -0
  37. data/test/manifest_test_dir/manifest.rim +9 -0
  38. data/test/manifest_test_dir/subdir/only_to_keep_folder_in_git.txt +0 -0
  39. data/test/processor_test.rb +32 -0
  40. data/test/rim_info_test.rb +93 -0
  41. data/test/status_builder_test.rb +488 -0
  42. data/test/sync_helper_test.rb +193 -0
  43. data/test/sync_module_helper_test.rb +96 -0
  44. data/test/test_helper.rb +39 -0
  45. data/test/unit_tests.rb +14 -0
  46. data/test/upload_helper_test.rb +338 -0
  47. data/test/upload_module_helper_test.rb +92 -0
  48. metadata +110 -0
@@ -0,0 +1,92 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
+ $:.unshift File.join(File.dirname(__FILE__))
3
+
4
+ require 'minitest/autorun'
5
+ require 'rim/git'
6
+ require 'rim/dirty_check'
7
+ require 'rim/module_info'
8
+ require 'rim/rim_info'
9
+ require 'rim/upload_module_helper'
10
+ require 'test_helper'
11
+ require 'fileutils'
12
+
13
+ class UploadModuleHelperTest < Minitest::Test
14
+ include FileUtils
15
+ include TestHelper
16
+
17
+ def setup
18
+ @logger = Logger.new($stdout)
19
+ @logger.level = Logger::ERROR unless ARGV.include? "debug"
20
+ RIM::GitSession.logger = @logger
21
+ test_dir = empty_test_dir("upload_module_helper_test")
22
+ @remote_git_dir = File.join(test_dir, "remote_git")
23
+ FileUtils.mkdir(@remote_git_dir)
24
+ RIM::git_session(@remote_git_dir) do |s|
25
+ s.execute("git init")
26
+ s.execute("git checkout -B testbr")
27
+ write_file(@remote_git_dir, "readme.txt")
28
+ s.execute("git add .")
29
+ s.execute("git commit -m \"Initial commit\"")
30
+ s.execute("git checkout -B master")
31
+ write_file(@remote_git_dir, "readme2.txt")
32
+ s.execute("git add .")
33
+ s.execute("git commit -m \"Second commit\"")
34
+ s.execute("git checkout --detach master")
35
+ @initial_rev = s.rev_sha1("HEAD")
36
+ end
37
+ @ws_dir = File.join(test_dir, "ws")
38
+ FileUtils.mkdir(@ws_dir)
39
+ RIM::git_session(@ws_dir) do |s|
40
+ s.execute("git init")
41
+ `echo '.rim' >> #{File.join(@ws_dir, ".gitignore")}`
42
+ s.execute("git checkout -B master")
43
+ write_file(@ws_dir, "initial.txt")
44
+ s.execute("git add .")
45
+ s.execute("git commit -m \"Initial commit\"")
46
+ @initial_ws_rev = s.rev_sha1("HEAD")
47
+ end
48
+ end
49
+
50
+ def teardown
51
+ remove_test_dirs
52
+ end
53
+
54
+ def test_files_are_uploaded_to_branch
55
+ mod_dir = File.join(@ws_dir, "module")
56
+ FileUtils.mkdir_p(mod_dir)
57
+ write_file(mod_dir, "readme.txt")
58
+ rim_info = RIM::RimInfo.new
59
+ rim_info.revision_sha1 = @initial_rev
60
+ rim_info.target_revision = "testbr"
61
+ rim_info.to_dir(mod_dir)
62
+ revs = []
63
+ RIM::git_session(@ws_dir) do |s|
64
+ s.execute("git add --all #{@ws_dir}")
65
+ s.execute("git commit -m \"Initial workspace commit\"")
66
+ write_file(@ws_dir, "nomodulefile.txt")
67
+ s.execute("git add --all #{@ws_dir}")
68
+ s.execute("git commit -m \"Added non module file\"")
69
+ revs.push(s.rev_sha1("HEAD"))
70
+ write_file(mod_dir, "second.txt")
71
+ s.execute("git add --all #{@ws_dir}")
72
+ s.execute("git commit -m \"Added module file\"")
73
+ revs.push(s.rev_sha1("HEAD"))
74
+ end
75
+ info = RIM::ModuleInfo.new("file://" + @remote_git_dir, "module", "testbr")
76
+ cut = RIM::UploadModuleHelper.new(@ws_dir, info, true, @logger)
77
+ cut.upload(nil, revs)
78
+ RIM::git_session(@remote_git_dir) do |s|
79
+ s.execute("git checkout testbr")
80
+ end
81
+ assert File.exists?(File.join(@remote_git_dir, "readme.txt"))
82
+ assert File.exists?(File.join(@remote_git_dir, "second.txt"))
83
+ end
84
+
85
+ def write_file(dir, name)
86
+ FileUtils.mkdir_p(dir)
87
+ File.open(File.join(dir, name), "w") do |f|
88
+ f.write("Content of #{name}\n")
89
+ end
90
+ end
91
+
92
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: esr-rim
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.5
5
+ platform: ruby
6
+ authors:
7
+ - ESR Labs AG
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: subcommand
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.6
27
+ description: RIM lets you work with multiple git repositories from within one single
28
+ git repository.
29
+ email:
30
+ executables:
31
+ - rim
32
+ extensions: []
33
+ extra_rdoc_files:
34
+ - README.md
35
+ - CHANGELOG
36
+ files:
37
+ - lib/rim/command/command.rb
38
+ - lib/rim/command/status.rb
39
+ - lib/rim/command/sync.rb
40
+ - lib/rim/command/upload.rb
41
+ - lib/rim/command_helper.rb
42
+ - lib/rim/dirty_check.rb
43
+ - lib/rim/file_helper.rb
44
+ - lib/rim/file_logger.rb
45
+ - lib/rim/git.rb
46
+ - lib/rim/manifest/helper.rb
47
+ - lib/rim/manifest/json_reader.rb
48
+ - lib/rim/manifest/manifest.json
49
+ - lib/rim/manifest/model.rb
50
+ - lib/rim/manifest/repo_reader.rb
51
+ - lib/rim/module_helper.rb
52
+ - lib/rim/module_info.rb
53
+ - lib/rim/processor.rb
54
+ - lib/rim/rev_status.rb
55
+ - lib/rim/rim.rb
56
+ - lib/rim/rim_exception.rb
57
+ - lib/rim/rim_info.rb
58
+ - lib/rim/status_builder.rb
59
+ - lib/rim/sync_helper.rb
60
+ - lib/rim/sync_module_helper.rb
61
+ - lib/rim/upload_helper.rb
62
+ - lib/rim/upload_module_helper.rb
63
+ - lib/rim/version.rb
64
+ - test/dirty_check_test.rb
65
+ - test/file_helper_test.rb
66
+ - test/git_test.rb
67
+ - test/manifest_helper_test.rb
68
+ - test/manifest_test_dir/manifest.rim
69
+ - test/manifest_test_dir/subdir/only_to_keep_folder_in_git.txt
70
+ - test/processor_test.rb
71
+ - test/rim_info_test.rb
72
+ - test/status_builder_test.rb
73
+ - test/sync_helper_test.rb
74
+ - test/sync_module_helper_test.rb
75
+ - test/test_helper.rb
76
+ - test/unit_tests.rb
77
+ - test/upload_helper_test.rb
78
+ - test/upload_module_helper_test.rb
79
+ - README.md
80
+ - CHANGELOG
81
+ - Rakefile
82
+ - bin/rim
83
+ homepage: http://esrlabs.com
84
+ licenses: []
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options:
88
+ - --main
89
+ - README.md
90
+ - -x
91
+ - test
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.0.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: RIM - multi git tool
110
+ test_files: []