rip 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/.gitignore +4 -0
  2. data/LICENSE +20 -0
  3. data/README.markdown +306 -0
  4. data/Rakefile +51 -0
  5. data/bin/rip +6 -0
  6. data/examples/debug.rb +13 -0
  7. data/examples/reverse.rb +21 -0
  8. data/ext/extconf.rb +11 -0
  9. data/lib/rip.rb +53 -0
  10. data/lib/rip/commands.rb +113 -0
  11. data/lib/rip/commands/build.rb +23 -0
  12. data/lib/rip/commands/core.rb +82 -0
  13. data/lib/rip/commands/install.rb +37 -0
  14. data/lib/rip/commands/uninstall.rb +43 -0
  15. data/lib/rip/env.rb +128 -0
  16. data/lib/rip/installer.rb +130 -0
  17. data/lib/rip/memoize.rb +111 -0
  18. data/lib/rip/package.rb +126 -0
  19. data/lib/rip/package_api.rb +94 -0
  20. data/lib/rip/package_manager.rb +175 -0
  21. data/lib/rip/packages/dir_package.rb +34 -0
  22. data/lib/rip/packages/file_package.rb +60 -0
  23. data/lib/rip/packages/gem_package.rb +44 -0
  24. data/lib/rip/packages/git_package.rb +62 -0
  25. data/lib/rip/packages/http_package.rb +46 -0
  26. data/lib/rip/packages/remote_gem_package.rb +64 -0
  27. data/lib/rip/packages/ripfile_package.rb +46 -0
  28. data/lib/rip/setup.rb +205 -0
  29. data/lib/rip/sh/git.rb +35 -0
  30. data/lib/rip/ui.rb +24 -0
  31. data/lib/rip/version.rb +9 -0
  32. data/setup.rb +27 -0
  33. data/test/commands_test.rb +15 -0
  34. data/test/dev.rip +2 -0
  35. data/test/dir_test.rb +25 -0
  36. data/test/env_test.rb +173 -0
  37. data/test/git_test.rb +36 -0
  38. data/test/mock_git.rb +51 -0
  39. data/test/repos/simple_c/dot_git/HEAD +1 -0
  40. data/test/repos/simple_c/dot_git/config +6 -0
  41. data/test/repos/simple_c/dot_git/description +1 -0
  42. data/test/repos/simple_c/dot_git/hooks/applypatch-msg.sample +15 -0
  43. data/test/repos/simple_c/dot_git/hooks/commit-msg.sample +24 -0
  44. data/test/repos/simple_c/dot_git/hooks/post-commit.sample +8 -0
  45. data/test/repos/simple_c/dot_git/hooks/post-receive.sample +15 -0
  46. data/test/repos/simple_c/dot_git/hooks/post-update.sample +8 -0
  47. data/test/repos/simple_c/dot_git/hooks/pre-applypatch.sample +14 -0
  48. data/test/repos/simple_c/dot_git/hooks/pre-commit.sample +18 -0
  49. data/test/repos/simple_c/dot_git/hooks/pre-rebase.sample +169 -0
  50. data/test/repos/simple_c/dot_git/hooks/prepare-commit-msg.sample +36 -0
  51. data/test/repos/simple_c/dot_git/hooks/update.sample +107 -0
  52. data/test/repos/simple_c/dot_git/index +0 -0
  53. data/test/repos/simple_c/dot_git/info/exclude +6 -0
  54. data/test/repos/simple_c/dot_git/logs/HEAD +1 -0
  55. data/test/repos/simple_c/dot_git/logs/refs/heads/master +1 -0
  56. data/test/repos/simple_c/dot_git/objects/2d/94227280db3ac66875f52592c6a736b4526084 +0 -0
  57. data/test/repos/simple_c/dot_git/objects/3f/1d6dacdedf75058e9edf23f48de03fa451f7ce +1 -0
  58. data/test/repos/simple_c/dot_git/objects/53/23e9a7ff897fe7bfc3357d9274775b67f9ade4 +0 -0
  59. data/test/repos/simple_c/dot_git/objects/55/31db58bd71148661c400dc48815bf06b366128 +0 -0
  60. data/test/repos/simple_c/dot_git/objects/d7/55c6f119520808609a8d79bac1a8dbe0c57424 +0 -0
  61. data/test/repos/simple_c/dot_git/objects/d7/58739ea968ac8e8fe0cbbf1f6451af47f04964 +0 -0
  62. data/test/repos/simple_c/dot_git/objects/e6/7b81a24f0ce4bff84c3599b5c9ba7093f554d8 +0 -0
  63. data/test/repos/simple_c/dot_git/objects/ec/be0a80dc841c16beb2c733bbdd320b45565d89 +0 -0
  64. data/test/repos/simple_c/dot_git/refs/heads/master +1 -0
  65. data/test/repos/simple_c/ext/simp/extconf.rb +6 -0
  66. data/test/repos/simple_c/ext/simp/simp.c +17 -0
  67. data/test/repos/simple_c/lib/simple_c.rb +1 -0
  68. data/test/repos/simple_d-1.2.3/lib/simple_d.rb +1 -0
  69. data/test/rip_test.rb +8 -0
  70. data/test/test_helper.rb +79 -0
  71. data/test/ui_test.rb +36 -0
  72. metadata +149 -0
@@ -0,0 +1 @@
1
+ require 'simp'
@@ -0,0 +1 @@
1
+ require 'simp'
@@ -0,0 +1,8 @@
1
+ require "test/unit"
2
+ require "rip"
3
+
4
+ class RipTest < Test::Unit::TestCase
5
+ def test_sanity
6
+ assert Rip
7
+ end
8
+ end
@@ -0,0 +1,79 @@
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
3
+
4
+ require 'rip'
5
+ require 'rip/commands'
6
+
7
+ Rip.dir = File.expand_path(File.join(File.dirname(__FILE__), 'ripdir'))
8
+ Rip.ui = nil
9
+
10
+ require 'mock_git'
11
+ require 'fakefs'
12
+ require 'test/unit'
13
+ require 'test/spec/mini'
14
+
15
+ def repo_path(repo_name)
16
+ RealFile.expand_path(RealFile.dirname(__FILE__) + '/repos/' + repo_name)
17
+ end
18
+
19
+ begin
20
+ require 'redgreen'
21
+ rescue LoadError
22
+ end
23
+
24
+ class Test::Unit::TestCase
25
+ def self.setup_with_fs(&block)
26
+ define_method :setup do
27
+ FakeFS::FileSystem.clear
28
+ Rip::Env.create('other')
29
+ Rip::Setup.setup_ripenv(Rip.dir)
30
+ Rip::Env.create('base')
31
+ setup_block
32
+ end
33
+
34
+ define_method(:setup_block, &block)
35
+ end
36
+
37
+ def fresh_remote_git(repo_name)
38
+ Rip::GitPackage.mock_remote_git(repo_name)
39
+ end
40
+
41
+ def fresh_local_git(repo_name)
42
+ Rip::GitPackage.mock_local_git(repo_name)
43
+ end
44
+
45
+ def fresh_local_dir(repo_name)
46
+ FakeFS::FileSystem.clone(repo_path(repo_name))
47
+ Rip::DirPackage.new(repo_path(repo_name))
48
+ end
49
+ end
50
+
51
+ module Rip
52
+ class GitPackage
53
+ # Since we don't have any mocking code, we monkey patch.
54
+
55
+ def self.mock_remote_git(repo_name)
56
+ real_source = "git://localhost/#{repo_name}"
57
+ include_mock_git(repo_name, real_source)
58
+ end
59
+
60
+ def self.mock_local_git(repo_name)
61
+ FakeFS::FileSystem.clone(repo_path(repo_name))
62
+ FileUtils.mv(repo_path(repo_name)+'/dot_git', repo_path(repo_name)+'/.git')
63
+ real_source = "file://#{repo_path(repo_name)}"
64
+ include_mock_git(repo_name, real_source)
65
+ end
66
+
67
+ def self.include_mock_git(repo_name, real_source)
68
+ Sh::MockGit.module_eval("def real_repo_name; #{repo_name.inspect}; end")
69
+ Sh::MockGit.module_eval("def real_source; #{real_source.inspect}; end")
70
+
71
+ include Sh::MockGit
72
+ real_source
73
+ end
74
+
75
+ def self.unmock_git
76
+ include Sh::Git
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,36 @@
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
2
+ require 'test_helper'
3
+ require 'stringio'
4
+
5
+ context "Rip::UI" do
6
+ setup do
7
+ @output = ''
8
+ @ui = Rip::UI.new(StringIO.new(@output))
9
+ end
10
+
11
+ test 'puts message' do
12
+ @ui.puts 'hello'
13
+ assert_equal 'hello', @output.chomp
14
+ end
15
+
16
+ test 'empty puts' do
17
+ @ui.puts
18
+ assert_equal "\n", @output
19
+ end
20
+
21
+ test 'prepends "rip: " to abort message' do
22
+ begin
23
+ old = Kernel.method(:abort)
24
+ class << Kernel; def abort(msg); msg end end
25
+ assert_equal "rip: goodbye", @ui.abort("goodbye")
26
+ ensure
27
+ class << Kernel; self end.class_eval { define_method(:abort, old) }
28
+ end
29
+ end
30
+
31
+ test "does not perform actions when no IO given" do
32
+ ui = Rip::UI.new
33
+ ui.puts 'this should not show up'
34
+ ui.abort 'this should not abort'
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rip
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Wanstrath
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-10 00:00:00 -07:00
13
+ default_executable: ""
14
+ dependencies: []
15
+
16
+ description: "Rip: Ruby's Intelligent Packaging"
17
+ email: chris@ozmm.org
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - .gitignore
26
+ - LICENSE
27
+ - README.markdown
28
+ - Rakefile
29
+ - bin/rip
30
+ - examples/debug.rb
31
+ - examples/reverse.rb
32
+ - ext/extconf.rb
33
+ - lib/rip.rb
34
+ - lib/rip/commands.rb
35
+ - lib/rip/commands/build.rb
36
+ - lib/rip/commands/core.rb
37
+ - lib/rip/commands/install.rb
38
+ - lib/rip/commands/uninstall.rb
39
+ - lib/rip/env.rb
40
+ - lib/rip/installer.rb
41
+ - lib/rip/memoize.rb
42
+ - lib/rip/package.rb
43
+ - lib/rip/package_api.rb
44
+ - lib/rip/package_manager.rb
45
+ - lib/rip/packages/dir_package.rb
46
+ - lib/rip/packages/file_package.rb
47
+ - lib/rip/packages/gem_package.rb
48
+ - lib/rip/packages/git_package.rb
49
+ - lib/rip/packages/http_package.rb
50
+ - lib/rip/packages/remote_gem_package.rb
51
+ - lib/rip/packages/ripfile_package.rb
52
+ - lib/rip/setup.rb
53
+ - lib/rip/sh/git.rb
54
+ - lib/rip/ui.rb
55
+ - lib/rip/version.rb
56
+ - setup.rb
57
+ - test/commands_test.rb
58
+ - test/dev.rip
59
+ - test/dir_test.rb
60
+ - test/env_test.rb
61
+ - test/git_test.rb
62
+ - test/mock_git.rb
63
+ - test/repos/simple_c/dot_git/HEAD
64
+ - test/repos/simple_c/dot_git/config
65
+ - test/repos/simple_c/dot_git/description
66
+ - test/repos/simple_c/dot_git/hooks/applypatch-msg.sample
67
+ - test/repos/simple_c/dot_git/hooks/commit-msg.sample
68
+ - test/repos/simple_c/dot_git/hooks/post-commit.sample
69
+ - test/repos/simple_c/dot_git/hooks/post-receive.sample
70
+ - test/repos/simple_c/dot_git/hooks/post-update.sample
71
+ - test/repos/simple_c/dot_git/hooks/pre-applypatch.sample
72
+ - test/repos/simple_c/dot_git/hooks/pre-commit.sample
73
+ - test/repos/simple_c/dot_git/hooks/pre-rebase.sample
74
+ - test/repos/simple_c/dot_git/hooks/prepare-commit-msg.sample
75
+ - test/repos/simple_c/dot_git/hooks/update.sample
76
+ - test/repos/simple_c/dot_git/index
77
+ - test/repos/simple_c/dot_git/info/exclude
78
+ - test/repos/simple_c/dot_git/logs/HEAD
79
+ - test/repos/simple_c/dot_git/logs/refs/heads/master
80
+ - test/repos/simple_c/dot_git/objects/2d/94227280db3ac66875f52592c6a736b4526084
81
+ - test/repos/simple_c/dot_git/objects/3f/1d6dacdedf75058e9edf23f48de03fa451f7ce
82
+ - test/repos/simple_c/dot_git/objects/53/23e9a7ff897fe7bfc3357d9274775b67f9ade4
83
+ - test/repos/simple_c/dot_git/objects/55/31db58bd71148661c400dc48815bf06b366128
84
+ - test/repos/simple_c/dot_git/objects/d7/55c6f119520808609a8d79bac1a8dbe0c57424
85
+ - test/repos/simple_c/dot_git/objects/d7/58739ea968ac8e8fe0cbbf1f6451af47f04964
86
+ - test/repos/simple_c/dot_git/objects/e6/7b81a24f0ce4bff84c3599b5c9ba7093f554d8
87
+ - test/repos/simple_c/dot_git/objects/ec/be0a80dc841c16beb2c733bbdd320b45565d89
88
+ - test/repos/simple_c/dot_git/refs/heads/master
89
+ - test/repos/simple_c/ext/simp/extconf.rb
90
+ - test/repos/simple_c/ext/simp/simp.c
91
+ - test/repos/simple_c/lib/simple_c.rb
92
+ - test/repos/simple_d-1.2.3/lib/simple_d.rb
93
+ - test/rip_test.rb
94
+ - test/test_helper.rb
95
+ - test/ui_test.rb
96
+ has_rdoc: true
97
+ homepage: http://hellorip.com
98
+ licenses: []
99
+
100
+ post_install_message: |
101
+ ****************************************************
102
+ So far so good...
103
+
104
+ Run `rip check` to be sure Rip installed successfully
105
+
106
+ NOTE: You may need to source your ~/.bashrc
107
+ or start a new shell session.
108
+
109
+ Get started: `rip -h` or http://hellorip.com/
110
+
111
+ ****************************************************
112
+
113
+ rdoc_options:
114
+ - --charset=UTF-8
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: "0"
122
+ version:
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: "0"
128
+ version:
129
+ requirements: []
130
+
131
+ rubyforge_project:
132
+ rubygems_version: 1.3.3
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: "Rip: Ruby's Intelligent Packaging"
136
+ test_files:
137
+ - test/commands_test.rb
138
+ - test/dir_test.rb
139
+ - test/env_test.rb
140
+ - test/git_test.rb
141
+ - test/mock_git.rb
142
+ - test/repos/simple_c/ext/simp/extconf.rb
143
+ - test/repos/simple_c/lib/simple_c.rb
144
+ - test/repos/simple_d-1.2.3/lib/simple_d.rb
145
+ - test/rip_test.rb
146
+ - test/test_helper.rb
147
+ - test/ui_test.rb
148
+ - examples/debug.rb
149
+ - examples/reverse.rb