sashimi 0.1.5 → 0.1.6
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.
- data/CHANGELOG +38 -0
- data/lib/sashimi.rb +1 -0
- data/lib/sashimi/repositories/abstract_repository.rb +6 -44
- data/lib/sashimi/repositories/git_repository.rb +2 -2
- data/lib/sashimi/repositories/svn_repository.rb +2 -2
- data/sashimi.gemspec +3 -2
- data/test/test_helper.rb +19 -4
- data/test/unit/repositories/git_repository_test.rb +25 -1
- data/test/unit/repositories/svn_repository_test.rb +25 -1
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,41 @@
|
|
1
|
+
* *v0.1.6*
|
2
|
+
|
3
|
+
* Tagged v0.1.6
|
4
|
+
|
5
|
+
* Prepare for v0.1.6
|
6
|
+
|
7
|
+
* Massive changelog
|
8
|
+
|
9
|
+
* Added rubyforge project reference to gemspec
|
10
|
+
|
11
|
+
* Added sashimi*.gem to .gitignore
|
12
|
+
|
13
|
+
* Removed AbstractRepository#cache_file, now uses cattr_accessor
|
14
|
+
|
15
|
+
* Updated annotation for AbstractRepository public methods in test/test_helper.rb
|
16
|
+
|
17
|
+
* Introduced Class#class_method_proxy in order to make available annotated class methods as private methods
|
18
|
+
|
19
|
+
Example:
|
20
|
+
class Repository
|
21
|
+
def self.path
|
22
|
+
@@path
|
23
|
+
end
|
24
|
+
|
25
|
+
class_method_proxy :path
|
26
|
+
end
|
27
|
+
|
28
|
+
Produces:
|
29
|
+
# Proxy method for <tt>Repository#path</tt>
|
30
|
+
def path
|
31
|
+
self.class.path
|
32
|
+
end
|
33
|
+
private :path
|
34
|
+
|
35
|
+
* Improved tests for repositories system calls
|
36
|
+
|
37
|
+
|
38
|
+
|
1
39
|
* *v0.1.5*
|
2
40
|
|
3
41
|
* Tagged v0.1.5
|
data/lib/sashimi.rb
CHANGED
@@ -13,6 +13,8 @@ module Sashimi
|
|
13
13
|
class AbstractRepository
|
14
14
|
@@local_repository_sub_path = File.join('.rails', 'plugins')
|
15
15
|
@@cache_file = '.plugins'
|
16
|
+
cattr_accessor :cache_file
|
17
|
+
|
16
18
|
attr_accessor :plugin
|
17
19
|
|
18
20
|
def initialize(plugin)
|
@@ -117,10 +119,6 @@ module Sashimi
|
|
117
119
|
@local_repository_path ||= File.join(find_home, @@local_repository_sub_path)
|
118
120
|
end
|
119
121
|
|
120
|
-
def cache_file #:nodoc:
|
121
|
-
@@cache_file
|
122
|
-
end
|
123
|
-
|
124
122
|
# Return the path to the Rails app where the user launched sashimi command.
|
125
123
|
def path_to_rails_app
|
126
124
|
$rails_app
|
@@ -234,52 +232,16 @@ module Sashimi
|
|
234
232
|
FileUtils.rm_rf(plugin.name+'-tmp')
|
235
233
|
end
|
236
234
|
|
235
|
+
class_method_proxy :change_dir, :change_dir_to_local_repository,
|
236
|
+
:change_dir_to_absolute_plugins_dir, :local_repository_path,
|
237
|
+
:cache_file, :cache_content, :plugins_dir, :path_to_rails_app
|
238
|
+
|
237
239
|
private
|
238
|
-
# Proxy for <tt>AbstractRepository#change_dir</tt>
|
239
|
-
def change_dir(dir)
|
240
|
-
self.class.change_dir(dir)
|
241
|
-
end
|
242
|
-
|
243
|
-
# Proxy for <tt>AbstractRepository#change_dir_to_local_repository</tt>
|
244
|
-
def change_dir_to_local_repository
|
245
|
-
self.class.change_dir_to_local_repository
|
246
|
-
end
|
247
|
-
|
248
|
-
# Proxy for <tt>AbstractRepository#change_dir_to_absolute_plugins_dir</tt>
|
249
|
-
def change_dir_to_absolute_plugins_dir
|
250
|
-
self.class.change_dir_to_absolute_plugins_dir
|
251
|
-
end
|
252
|
-
|
253
240
|
# Change the current directory with the plugin one
|
254
241
|
def change_dir_to_plugin_path
|
255
242
|
change_dir(File.join(local_repository_path, plugin.name || plugin.guess_name))
|
256
243
|
end
|
257
244
|
|
258
|
-
# Proxy for <tt>AbstractRepository#local_repository_path</tt>
|
259
|
-
def local_repository_path
|
260
|
-
self.class.local_repository_path
|
261
|
-
end
|
262
|
-
|
263
|
-
# Proxy for <tt>AbstractRepository#cache_file</tt>
|
264
|
-
def cache_file
|
265
|
-
self.class.cache_file
|
266
|
-
end
|
267
|
-
|
268
|
-
# Proxy for <tt>AbstractRepository#cache_content</tt>
|
269
|
-
def cache_content
|
270
|
-
self.class.cache_content
|
271
|
-
end
|
272
|
-
|
273
|
-
# Proxy for <tt>AbstractRepository#plugins_dir</tt>
|
274
|
-
def plugins_dir
|
275
|
-
self.class.plugins_dir
|
276
|
-
end
|
277
|
-
|
278
|
-
# Proxy for <tt>AbstractRepository#path_to_rails_app</tt>
|
279
|
-
def path_to_rails_app
|
280
|
-
self.class.path_to_rails_app
|
281
|
-
end
|
282
|
-
|
283
245
|
# Prepare the plugin installation
|
284
246
|
def prepare_installation
|
285
247
|
FileUtils.mkdir_p(local_repository_path)
|
@@ -3,14 +3,14 @@ module Sashimi
|
|
3
3
|
def install
|
4
4
|
prepare_installation
|
5
5
|
puts plugin.guess_name.titleize + "\n\n"
|
6
|
-
system("git clone #{plugin.url}")
|
6
|
+
Kernel.system("git clone #{plugin.url}")
|
7
7
|
add_to_cache(plugin.to_hash)
|
8
8
|
end
|
9
9
|
|
10
10
|
def update
|
11
11
|
puts plugin.name.titleize + "\n\n"
|
12
12
|
change_dir_to_plugin_path
|
13
|
-
system('git pull')
|
13
|
+
Kernel.system('git pull')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -3,14 +3,14 @@ module Sashimi
|
|
3
3
|
def install
|
4
4
|
prepare_installation
|
5
5
|
puts plugin.guess_name.titleize + "\n\n"
|
6
|
-
system("svn co #{plugin.url} #{plugin.guess_name}")
|
6
|
+
Kernel.system("svn co #{plugin.url} #{plugin.guess_name}")
|
7
7
|
add_to_cache(plugin.to_hash)
|
8
8
|
end
|
9
9
|
|
10
10
|
def update
|
11
11
|
puts plugin.name.titleize + "\n\n"
|
12
12
|
change_dir_to_plugin_path
|
13
|
-
system("svn up")
|
13
|
+
Kernel.system("svn up")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/sashimi.gemspec
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "sashimi"
|
3
|
-
s.version = "0.1.
|
4
|
-
s.date = "2008-
|
3
|
+
s.version = "0.1.6"
|
4
|
+
s.date = "2008-06-23"
|
5
5
|
s.summary = "Rails plugins manager"
|
6
6
|
s.author = "Luca Guidi"
|
7
7
|
s.email = "guidi.luca@gmail.com"
|
8
8
|
s.homepage = "http://lucaguidi.com/pages/sashimi"
|
9
9
|
s.description = "Sashimi is a local repository for Rails plugins."
|
10
10
|
s.has_rdoc = true
|
11
|
+
s.rubyforge_project = %q{sashimi}
|
11
12
|
s.executables = [ 'sashimi' ]
|
12
13
|
s.files = ["CHANGELOG", "MIT-LICENSE", "Rakefile", "README", "sashimi.gemspec", "setup.rb", "bin/sashimi", "lib/sashimi/commands.rb", "lib/sashimi/plugin.rb", "lib/sashimi/repositories/abstract_repository.rb", "lib/sashimi/repositories/git_repository.rb", "lib/sashimi/repositories/svn_repository.rb", "lib/sashimi/repositories.rb", "lib/sashimi.rb", "test/test_helper.rb", "test/unit/plugin_test.rb", "test/unit/repositories/abstract_repository_test.rb", "test/unit/repositories/git_repository_test.rb", "test/unit/repositories/svn_repository_test.rb"]
|
13
14
|
s.test_files = ["test/unit/plugin_test.rb", "test/unit/repositories/abstract_repository_test.rb", "test/unit/repositories/git_repository_test.rb", "test/unit/repositories/svn_repository_test.rb"]
|
data/test/test_helper.rb
CHANGED
@@ -65,9 +65,24 @@ end
|
|
65
65
|
module Sashimi
|
66
66
|
class AbstractRepository
|
67
67
|
@@local_repository_sub_path = 'sashimi_test/.rails/plugins'
|
68
|
-
public :
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
68
|
+
public :add_to_cache, :cache_content, :cache_file,
|
69
|
+
:change_dir, :change_dir_to_absolute_plugins_dir,
|
70
|
+
:change_dir_to_local_repository, :change_dir_to_plugin_path,
|
71
|
+
:copy_plugin_to_rails_app, :local_repository_path, :path_to_rails_app,
|
72
|
+
:plugins_dir, :prepare_installation, :remove_from_cache,
|
73
|
+
:remove_hidden_folders, :rename_temp_folder, :run_install_hook,
|
74
|
+
:write_to_cache
|
72
75
|
end
|
73
76
|
end
|
77
|
+
|
78
|
+
# Thanks to Rails Core Team
|
79
|
+
def uses_mocha(description)
|
80
|
+
require 'rubygems'
|
81
|
+
require 'mocha'
|
82
|
+
yield
|
83
|
+
rescue LoadError
|
84
|
+
$stderr.puts "Skipping #{description} tests. `gem install mocha` and try again."
|
85
|
+
end
|
86
|
+
|
87
|
+
def puts(message) #shut-up!
|
88
|
+
end
|
@@ -5,4 +5,28 @@ class GitRepositoryTest < Test::Unit::TestCase
|
|
5
5
|
def test_type
|
6
6
|
assert_equal('git', GitRepository.new(nil).scm_type)
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
|
+
uses_mocha 'test_git_system_calls_for_install_and_update_process' do
|
10
|
+
def test_should_raise_exception_for_unexistent_repository
|
11
|
+
Kernel.expects(:system).with('git clone unexistent').raises(Errno::ENOENT)
|
12
|
+
repository = GitRepository.new(create_plugin(nil, 'unexistent'))
|
13
|
+
assert_raise(Errno::ENOENT) { repository.install }
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_raise_exception_for_non_repository_url
|
17
|
+
Kernel.expects(:system).with('git clone http://github.com/jodosha.git').raises(Errno::ENOENT)
|
18
|
+
repository = GitRepository.new(create_plugin(nil, 'http://github.com/jodosha.git'))
|
19
|
+
assert_raise(Errno::ENOENT) { repository.install }
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_create_git_repository
|
23
|
+
initialize_repository_for_test do
|
24
|
+
FileUtils.mkdir_p('sashimi')
|
25
|
+
Kernel.expects(:system).with('git clone git://github.com/jodosha/sashimi.git')
|
26
|
+
GitRepository.new(plugin).install
|
27
|
+
File.expects(:exists?).with('.git').returns(true)
|
28
|
+
assert File.exists?('.git')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -5,4 +5,28 @@ class SvnRepositoryTest < Test::Unit::TestCase
|
|
5
5
|
def test_type
|
6
6
|
assert_equal('svn', SvnRepository.new(nil).scm_type)
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
|
+
uses_mocha 'test_svn_system_calls_for_install_and_update_process' do
|
10
|
+
def test_should_raise_exception_for_unexistent_repository
|
11
|
+
Kernel.expects(:system).with('svn co unexistent unexistent').raises(Errno::ENOENT)
|
12
|
+
repository = SvnRepository.new(create_plugin(nil, 'unexistent'))
|
13
|
+
assert_raise(Errno::ENOENT) { repository.install }
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_raise_exception_for_non_repository_url
|
17
|
+
Kernel.expects(:system).with('svn co http://sushistarweb.com sushistarweb.com').raises(Errno::ENOENT)
|
18
|
+
repository = SvnRepository.new(create_plugin(nil, 'http://sushistarweb.com'))
|
19
|
+
assert_raise(Errno::ENOENT) { repository.install }
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_create_git_repository
|
23
|
+
initialize_repository_for_test do
|
24
|
+
FileUtils.mkdir_p('sashimi')
|
25
|
+
Kernel.expects(:system).with('svn co http://dev.repository.com/svn/sashimi/trunk sashimi')
|
26
|
+
SvnRepository.new(create_plugin(nil, 'http://dev.repository.com/svn/sashimi/trunk')).install
|
27
|
+
File.expects(:exists?).with('.svn').returns(true)
|
28
|
+
assert File.exists?('.svn')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sashimi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-06-23 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version:
|
72
72
|
requirements: []
|
73
73
|
|
74
|
-
rubyforge_project:
|
74
|
+
rubyforge_project: sashimi
|
75
75
|
rubygems_version: 1.1.1
|
76
76
|
signing_key:
|
77
77
|
specification_version: 2
|