rugem 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ ----------------------------------------------------------------------
2
+ r2326 (orig r5377): walf443 | 2008-01-24 02:31:59 +0900
3
+
4
+ lang/ruby/rugem: adjust new project name.
5
+ ----------------------------------------------------------------------
6
+ r2325 (orig r5376): walf443 | 2008-01-24 02:30:35 +0900
7
+
8
+ lang/ruby/rugem: adjust new project name.
9
+ ----------------------------------------------------------------------
10
+ r2324 (orig r5375): walf443 | 2008-01-24 02:07:51 +0900
11
+
12
+ lang/ruby/rubywgem: rename project name from rubywgem to rugem because rubywgem is too long to use as command
13
+ ----------------------------------------------------------------------
14
+ r2265 (orig r5316): walf443 | 2008-01-23 02:11:17 +0900
15
+
16
+ lang/ruby/rubywgem: start new project rubywgem - just a wrapper of ruby command that can use gem library with -r option.
17
+ ----------------------------------------------------------------------
data/README ADDED
@@ -0,0 +1,34 @@
1
+
2
+ = rugem
3
+
4
+ rugem is just a wrapper to load rubygems library with command line option before running some ruby script
5
+
6
+ == Synopsis
7
+
8
+ $ rugem -r open-uri/cache/memcache my_script.rb
9
+
10
+ You can use one liner with -e option. or other ruby options.
11
+
12
+ $ rugem -r active_support -e "p [].blank?"
13
+
14
+ == Description
15
+
16
+ It's useful for debug switching or writing just some snipets.
17
+
18
+ == Installation
19
+
20
+ === Archive Installation
21
+
22
+ rake install
23
+
24
+ === Gem Installation
25
+
26
+ gem install rugem
27
+
28
+ == Features/Problems
29
+
30
+ == Copyright
31
+
32
+ Author:: Keiji, Yoshimi <walf443 at gmail.com>
33
+ Copyright:: Copyright (c) 2008 Keiji, Yoshimi
34
+ License:: you can redistribute it and/or modify it under the same terms as Ruby itself.
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'rake/contrib/sshpublisher'
10
+ require 'fileutils'
11
+ include FileUtils
12
+
13
+ load File.join(File.dirname(__FILE__), 'tasks', 'basic_config.rake')
14
+
15
+ NAME = "rugem"
16
+ DESCRIPTION = <<-"END_DESCRIPTION"
17
+ rugem is a wrapper of ruby command that can use gem library with -r option
18
+ END_DESCRIPTION
19
+ BIN_FILES = %w( rugem )
20
+ VERS = "0.0.1"
21
+ RUBYFORGE_PACKAGE_ID = 6761
22
+
23
+ EXTRA_RDOC_FILES = []
24
+ HECKLE_ROOT_MODULES = ["Rubywgem"]
25
+
26
+ SPEC = Gem::Specification.new do |s|
27
+ s.name = NAME
28
+ s.version = VERS
29
+ s.platform = Gem::Platform::RUBY
30
+ s.has_rdoc = true
31
+ s.extra_rdoc_files = DEFAULT_EXTRA_RDOC_FILES + EXTRA_RDOC_FILES
32
+ s.rdoc_options += RDOC_OPTS + ['--title', "#{NAME} documentation"]
33
+ s.summary = DESCRIPTION
34
+ s.description = DESCRIPTION
35
+ s.author = AUTHOR
36
+ s.email = EMAIL
37
+ s.homepage = HOMEPATH
38
+ s.executables = BIN_FILES
39
+ s.rubyforge_project = RUBYFORGE_PROJECT
40
+ s.bindir = "bin"
41
+ s.require_path = "lib"
42
+ s.autorequire = ""
43
+ s.test_files = Dir["spec/*_spec.rb"]
44
+
45
+ s.add_dependency('escape', '>= 0.0.1')
46
+
47
+ s.files = PKG_FILES + EXTRA_RDOC_FILES
48
+ s.extensions = EXTENSIONS
49
+ end
50
+
51
+ import File.join(File.dirname(__FILE__), 'tasks', 'basic_tasks.rake')
@@ -0,0 +1,7 @@
1
+ #!/opt/local/bin/ruby
2
+
3
+ require 'rubygems'
4
+ require 'escape'
5
+
6
+ command = %[ruby -I #{Gem.latest_load_paths.join(':')} #{Escape.shell_command(ARGV)}]
7
+ exec command
@@ -0,0 +1,4 @@
1
+ # FIXME: this file is not need to use. but, generating ri failed without this file...
2
+ module Rugem
3
+ VERSION = "0.0.1"
4
+ end
File without changes
@@ -0,0 +1,59 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require 'pathname'
3
+ require 'open3'
4
+
5
+ COMMAND = Pathname(__FILE__).parent.parent + 'bin/rugem'
6
+ DUMMY_SCRIPT = File.join(File.dirname(__FILE__), 'dummy.rb')
7
+ describe 'rugem' do
8
+ it '-r option should effect to gem library' do
9
+ stdin, stdout, stderr = *Open3.popen3(COMMAND, '-r', 'sources', DUMMY_SCRIPT)
10
+ stdout.read.should == ''
11
+ stderr.read.should == ''
12
+ end
13
+
14
+ describe "one liner" do
15
+ def one_liner ruby_code
16
+ expected = {}
17
+ expected[:stdin], expected[:stdout], expected[:stderr] = *Open3.popen3('ruby', '-e', ruby_code)
18
+ actual = {}
19
+ actual[:stdin], actual[:stdout], actual[:stderr] = *Open3.popen3(COMMAND, '-e', ruby_code)
20
+
21
+ # expected[:stdin].read.should == actual[:stdin].read
22
+ actual[:stdout].read.should == expected[:stdout].read
23
+ actual[:stderr].read.should == expected[:stderr].read
24
+ ensure
25
+ [:stdin, :stdout, :stderr].each do |io|
26
+ actual[io].close
27
+ expected[io].close
28
+ end
29
+ end
30
+
31
+ it 'should be able to write' do
32
+ one_liner('p true')
33
+ end
34
+
35
+ it 'should be able to write single quote' do
36
+ one_liner("p 'hoge'")
37
+ end
38
+
39
+ it 'should be able to write double quote' do
40
+ one_liner('p "hoge"')
41
+ end
42
+
43
+ it 'should be able to write []' do
44
+ one_liner('p []')
45
+ end
46
+
47
+ it 'should be able to write "|" ' do
48
+ one_liner('[1.2.3].each do |i| warn i end')
49
+ end
50
+
51
+ it 'should be able to write "{" and "}"' do
52
+ one_liner('[1.2.3].each {|i| warn i }')
53
+ end
54
+
55
+ it 'should be able to write "\"' do
56
+ one_liner(%{p "fuga".sub(/(fu)/, '\1'})
57
+ end
58
+ end
59
+ end
@@ -0,0 +1 @@
1
+ -Du -c -fs
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib/'))
4
+
@@ -0,0 +1,22 @@
1
+ AUTHOR = "Keiji, Yoshimi"
2
+ EMAIL = "walf443 at gmail.com"
3
+ RUBYFORGE_PROJECT = "akasakarb"
4
+ RUBYFORGE_PROJECT_ID = 4314
5
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
6
+ RDOC_OPTS = [
7
+ "--charset", "utf-8",
8
+ "--opname", "index.html",
9
+ "--line-numbers",
10
+ "--main", "README",
11
+ "--inline-source",
12
+ '--exclude', '^(example|extras)/'
13
+ ]
14
+ DEFAULT_EXTRA_RDOC_FILES = ['README', 'ChangeLog']
15
+ PKG_FILES = [ 'Rakefile' ] +
16
+ DEFAULT_EXTRA_RDOC_FILES +
17
+ Dir.glob('{bin,lib,test,spec,doc,tasks,script,generator,templates,extras,website}/**/*') +
18
+ Dir.glob('ext/**/*.{h,c,rb}') +
19
+ Dir.glob('examples/**/*.rb') +
20
+ Dir.glob('tools/*.rb')
21
+
22
+ EXTENSIONS = FileList['ext/**/extconf.rb'].to_a
@@ -0,0 +1,139 @@
1
+
2
+ REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
3
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config', 'doc']
4
+
5
+ Rake::GemPackageTask.new(SPEC) do |p|
6
+ p.need_tar = true
7
+ p.gem_spec = SPEC
8
+ end
9
+
10
+ task :default => [:spec]
11
+ task :test => [:spec]
12
+ task :package => [:clean]
13
+
14
+ require 'spec/rake/spectask'
15
+ Spec::Rake::SpecTask.new(:spec) do |t|
16
+ t.spec_files = FileList['spec/**/*_spec.rb']
17
+ t.spec_opts = ['--options', 'spec/spec.opts']
18
+ t.warning = true
19
+ t.rcov = true
20
+ t.rcov_dir = 'doc/output/coverage'
21
+ t.rcov_opts = ['--exclude', 'spec,\.autotest']
22
+ end
23
+
24
+ desc "Heckle each module and class in turn"
25
+ task :heckle => :spec do
26
+ root_modules = HECKLE_ROOT_MODULES
27
+ spec_files = FileList['spec/**/*_spec.rb']
28
+
29
+ current_module, current_method = nil, nil
30
+ heckle_caught_modules = Hash.new { |hash, key| hash[key] = [] }
31
+ unhandled_mutations = 0
32
+
33
+ root_modules.each do |root_module|
34
+ IO.popen("heckle #{root_module} -t #{spec_files}") do |pipe|
35
+ while line = pipe.gets
36
+ line = line.chomp
37
+
38
+ if line =~ /^\*\*\* ((?:\w+(?:::)?)+)#(\w+)/
39
+ current_module, current_method = $1, $2
40
+ elsif line == "The following mutations didn't cause test failures:"
41
+ heckle_caught_modules[current_module] << current_method
42
+ elsif line == "+++ mutation"
43
+ unhandled_mutations += 1
44
+ end
45
+
46
+ puts line
47
+ end
48
+ end
49
+ end
50
+
51
+ if unhandled_mutations > 0
52
+ error_message_lines = ["*************\n"]
53
+
54
+ error_message_lines <<
55
+ "Heckle found #{unhandled_mutations} " +
56
+ "mutation#{"s" unless unhandled_mutations == 1} " +
57
+ "that didn't cause spec violations\n"
58
+
59
+ heckle_caught_modules.each do |mod, methods|
60
+ error_message_lines <<
61
+ "#{mod} contains the following poorly-specified methods:"
62
+ methods.each do |m|
63
+ error_message_lines << " - #{m}"
64
+ end
65
+ error_message_lines << ""
66
+ end
67
+
68
+ error_message_lines <<
69
+ "Get your act together and come back " +
70
+ "when your specs are doing their job!"
71
+
72
+ puts "*************"
73
+ raise error_message_lines.join("\n")
74
+ else
75
+ puts "Well done! Your code withstood a heckling."
76
+ end
77
+ end
78
+
79
+ require 'spec/rake/verify_rcov'
80
+ RCov::VerifyTask.new(:rcov => :spec) do |t|
81
+ t.index_html = "doc/output/coverage/index.html"
82
+ t.threshold = 100
83
+ end
84
+
85
+ task :install do
86
+ name = "#{NAME}-#{VERS}.gem"
87
+ sh %{rake package}
88
+ sh %{sudo gem install pkg/#{name}}
89
+ end
90
+
91
+ task :uninstall => [:clean] do
92
+ sh %{sudo gem uninstall #{NAME}}
93
+ end
94
+
95
+
96
+ Rake::RDocTask.new do |rdoc|
97
+ rdoc.rdoc_dir = 'html'
98
+ rdoc.options += RDOC_OPTS
99
+ rdoc.template = "resh"
100
+ #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
101
+ if ENV['DOC_FILES']
102
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
103
+ else
104
+ rdoc.rdoc_files.include('README', 'ChangeLog')
105
+ rdoc.rdoc_files.include('lib/**/*.rb')
106
+ rdoc.rdoc_files.include('ext/**/*.c')
107
+ end
108
+ end
109
+
110
+ desc "Publish to RubyForge"
111
+ task :rubyforge => [:rdoc, :package] do
112
+ require 'rubyforge'
113
+ Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'yoshimi').upload
114
+ end
115
+
116
+ desc 'Package and upload the release to rubyforge.'
117
+ task :release => [:clean, :package] do |t|
118
+ require 'rubyforge'
119
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
120
+ abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
121
+ pkg = "pkg/#{NAME}-#{VERS}"
122
+
123
+ rf = RubyForge.new
124
+ puts "Logging in"
125
+ rf.login
126
+
127
+ c = rf.userconfig
128
+ c["release_notes"] = DESCRIPTION if DESCRIPTION
129
+ # c["release_changes"] = changes if changes
130
+ c["preformatted"] = true
131
+
132
+ files = [
133
+ "#{pkg}.tgz",
134
+ "#{pkg}.gem"
135
+ ].compact
136
+
137
+ puts "Releasing #{NAME} v. #{VERS}"
138
+ rf.add_release RUBYFORGE_PROJECT_ID, RUBYFORGE_PACKAGE_ID, VERS, *files
139
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: rugem
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2008-01-25 00:00:00 +09:00
8
+ summary: rugem is a wrapper of ruby command that can use gem library with -r option
9
+ require_paths:
10
+ - lib
11
+ email: walf443 at gmail.com
12
+ homepage: http://akasakarb.rubyforge.org
13
+ rubyforge_project: akasakarb
14
+ description: rugem is a wrapper of ruby command that can use gem library with -r option
15
+ autorequire: ""
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Keiji, Yoshimi
31
+ files:
32
+ - Rakefile
33
+ - README
34
+ - ChangeLog
35
+ - bin/rugem
36
+ - lib/rugem.rb
37
+ - spec/dummy.rb
38
+ - spec/rugem_spec.rb
39
+ - spec/spec.opts
40
+ - spec/spec_helper.rb
41
+ - tasks/basic_config.rake
42
+ - tasks/basic_tasks.rake
43
+ test_files:
44
+ - spec/rugem_spec.rb
45
+ rdoc_options:
46
+ - --charset
47
+ - utf-8
48
+ - --opname
49
+ - index.html
50
+ - --line-numbers
51
+ - --main
52
+ - README
53
+ - --inline-source
54
+ - --exclude
55
+ - ^(example|extras)/
56
+ - --title
57
+ - rugem documentation
58
+ extra_rdoc_files:
59
+ - README
60
+ - ChangeLog
61
+ executables:
62
+ - rugem
63
+ extensions: []
64
+
65
+ requirements: []
66
+
67
+ dependencies:
68
+ - !ruby/object:Gem::Dependency
69
+ name: escape
70
+ version_requirement:
71
+ version_requirements: !ruby/object:Gem::Version::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.1
76
+ version: