elliottcable-lobby 1

Sign up to get free protection for your applications and to get access to all the features.
data/.manifest ADDED
@@ -0,0 +1,5 @@
1
+ lib/lobby.rb
2
+ Rakefile.rb
3
+ README.markdown
4
+ spec/lobby_spec.rb
5
+ .manifest
data/README.markdown ADDED
@@ -0,0 +1,79 @@
1
+ Lobby
2
+ =====
3
+ Welcome to Ruby. Pull up a chair:
4
+
5
+ require 'lobby'
6
+ LobbyConstructor::construct!
7
+
8
+ Tell us about yourself!
9
+
10
+ def i_am
11
+ "me"
12
+ end
13
+
14
+ class Somewhere
15
+ class Deep
16
+ class In
17
+ class A
18
+ class GodForsaken
19
+ class Wasteland
20
+
21
+ puts Kernel::lobby.instance_eval { i_am }
22
+
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ From where do you hail?
31
+
32
+ class Somewhere
33
+ class Deep
34
+ class In
35
+ class A
36
+ class GodForsaken
37
+ class Wasteland
38
+
39
+ class ::Lobby
40
+ def who_knows
41
+ puts "somewere deep..."
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ who_knows()
53
+
54
+ Getting
55
+ -------
56
+ The authoritative source for this project is available at
57
+ <http://github.com/elliottcable/lobby>. You can clone your own copy with
58
+ the following command:
59
+
60
+ git clone git://github.com/elliottcable/lobby.git
61
+
62
+ If you want to make changes to the codebase, you need to fork your own GitHub
63
+ repository for said changes. Send a pullrequest to [elliottcable](http://github.com/elliottcable "elliottcable on GitHub")
64
+ when you've got something ready for the master branch that you think should be
65
+ merged.
66
+
67
+ Requirements
68
+ ------------
69
+ To use Lobby, you need... nothing!
70
+
71
+ Contributing
72
+ ------------
73
+ To develop and contribute to Lobby, you need...
74
+
75
+ - `gem install rake`
76
+ - `gem install elliottcable-echoe`
77
+ - `gem install rspec`
78
+ - `gem install relevance-rcov`
79
+ - `gem install lsegal-yard`
data/Rakefile.rb ADDED
@@ -0,0 +1,130 @@
1
+ ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
2
+ require "lobby"
3
+
4
+ default_tasks = Array.new
5
+
6
+ # =======================
7
+ # = Gem packaging tasks =
8
+ # =======================
9
+ begin
10
+ require 'echoe'
11
+
12
+ default_tasks << :'package:manifest' unless ENV['CI']
13
+ default_tasks << :'package:verify'
14
+
15
+ task :install => :'package:install'
16
+ task :package => :'package:package'
17
+ task :manifest => :'package:manifest'
18
+ namespace :package do
19
+ Echoe.new('lobby', LobbyConstructor::Version) do |g|
20
+ g.author = ['elliottcable']
21
+ g.email = ["Lobby@elliottcable.com"]
22
+ g.summary = "Welcome to Ruby. Enjoy your stay. Here's a chair."
23
+ g.url = 'http://github.com/elliottcable/lobby'
24
+ g.runtime_dependencies = []
25
+ g.development_dependencies = ['echoe >= 3.0.2', 'rspec', 'rcov', 'yard']
26
+ g.manifest_name = '.manifest'
27
+ g.retain_gemspec = true
28
+ g.rakefile_name = 'Rakefile.rb'
29
+ g.ignore_pattern = /^\.git\/|^meta\/|\.gemspec/
30
+ end
31
+
32
+ desc 'Tests packaged files to ensure they are all present'
33
+ task :verify => :package do
34
+ # An error message will be displayed if files are missing
35
+ if system %(ruby -e "require 'rubygems'; require 'pkg/lobby-#{LobbyConstructor::Version}/lib/lobby'")
36
+ puts "\nThe library files are present."
37
+ end
38
+ end
39
+ end
40
+
41
+ rescue LoadError => exception
42
+ raise exception unless exception.message =~ /(echoe)$/
43
+ desc '!! You need the `echoe` gem to package or install this project!'
44
+ task :package
45
+ end
46
+
47
+ # =======================
48
+ # = Spec/Coverage tasks =
49
+ # =======================
50
+ begin
51
+ require 'spec'
52
+ require 'rcov'
53
+ require 'spec/rake/spectask'
54
+
55
+ default_tasks << :'coverage:run'
56
+ default_tasks << :'coverage:open' unless ENV['CI']
57
+
58
+ task :coverage => :'coverage:run'
59
+ namespace :coverage do
60
+ Spec::Rake::SpecTask.new(:run) do |t|
61
+ t.spec_opts = ["--format", "specdoc"]
62
+ t.spec_opts << "--colour" unless ENV['CI']
63
+ t.spec_files = Dir[File.join('spec', '**', '*_spec.rb')].sort
64
+ t.libs = ['lib']
65
+ t.rcov = true
66
+ t.rcov_opts = ['--exclude-only', '".*"', '--include-file', '"^lib"',
67
+ '--sort', 'loc', '--sort-reverse',
68
+ '--comments', '--profile', '--text-report', '-w' ]
69
+ t.rcov_dir = File.join('meta', 'coverage')
70
+ end
71
+
72
+ task :open do
73
+ system 'open ' + File.join('meta', 'coverage', 'index.html')
74
+ end if RUBY_PLATFORM =~ /darwin/
75
+ end
76
+
77
+ rescue LoadError => exception
78
+ raise exception unless exception.message =~ /(rcov|spec)$/
79
+ desc '!! You need the `rcov` and `rspec` gems to run specs or coverage!'
80
+ task :coverage
81
+ end
82
+
83
+ # =======================
84
+ # = Documentation tasks =
85
+ # =======================
86
+ begin
87
+ require 'yard'
88
+ require 'yard/rake/yardoc_task'
89
+
90
+ default_tasks << :'documentation:generate'
91
+ default_tasks << :'documentation:open' unless ENV['CI']
92
+
93
+ task :documentation => :'documentation:generate'
94
+ namespace :documentation do
95
+ YARD::Rake::YardocTask.new :generate do |t|
96
+ t.files = [File.join('lib', '**', '*.rb')]
97
+ t.options = ['--output-dir', File.join('meta', 'documentation'),
98
+ '--readme', 'README.markdown']
99
+ end
100
+
101
+ YARD::Rake::YardocTask.new :yardoc do |t|
102
+ t.files = [File.join('lib', '**', '*.rb')]
103
+ t.options = ['--no-output',
104
+ '--readme', 'README.markdown']
105
+ end
106
+
107
+ task :open do
108
+ system 'open ' + File.join('meta', 'documentation', 'index.html')
109
+ end if RUBY_PLATFORM =~ /darwin/
110
+ end
111
+
112
+ rescue LoadError => exception
113
+ raise exception unless exception.message =~ /(yard)$/
114
+ desc '!! You need the `yard` gem to generate documentation!'
115
+ task :documentation
116
+ end
117
+
118
+ # =================
119
+ # = Miscellaneous =
120
+ # =================
121
+ desc 'Removes all meta producs'
122
+ task :clobber do
123
+ `rm -rf #{File.expand_path(File.join( File.dirname(__FILE__), 'meta' ))} #{File.expand_path(File.join( File.dirname(__FILE__), 'pkg' ))}`
124
+ end
125
+
126
+ desc 'Run all default tasks'
127
+ task :default => default_tasks do
128
+ puts "** Successfully ran the following tasks:"
129
+ puts "** #{Rake.application.tasks.select {|t| t.name == 'default' }.first.prerequisites.join(', ')}"
130
+ end
data/lib/lobby.rb ADDED
@@ -0,0 +1,30 @@
1
+ ##
2
+ # Simply the "root class" of this library, to expediate things.
3
+ class LobbyConstructor
4
+ Version = 1
5
+
6
+ ##
7
+ # This method is responsible for constructing the "lobby environment."
8
+ def self.construct!
9
+ lobby = ::Kernel::lobby
10
+ def lobby.inspect
11
+ "lobby"
12
+ end
13
+
14
+ root_object_eigenclass = class<<lobby;self;end
15
+ ::Kernel.send :const_set, "Lobby", root_object_eigenclass
16
+ def root_object_eigenclass.inspect
17
+ "Lobby"
18
+ end
19
+ end
20
+ end
21
+
22
+ module ::Kernel
23
+
24
+ ##
25
+ # This method returns the global "root object," also known as "main."
26
+ def lobby
27
+ ::Kernel.eval('self', ::TOPLEVEL_BINDING)
28
+ end
29
+
30
+ end
data/lobby.gemspec ADDED
@@ -0,0 +1,43 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{lobby}
5
+ s.version = "1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["elliottcable"]
9
+ s.date = %q{2009-06-17}
10
+ s.description = %q{Welcome to Ruby. Enjoy your stay. Here's a chair.}
11
+ s.email = ["Lobby@elliottcable.com"]
12
+ s.extra_rdoc_files = ["README.markdown", "lib/lobby.rb"]
13
+ s.files = ["README.markdown", "Rakefile.rb", "lib/lobby.rb", "spec/lobby_spec.rb", ".manifest", "lobby.gemspec"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/elliottcable/lobby}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Lobby", "--main", "README.markdown"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{lobby}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{Welcome to Ruby. Enjoy your stay. Here's a chair.}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ s.add_development_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
28
+ s.add_development_dependency(%q<rspec>, [">= 0"])
29
+ s.add_development_dependency(%q<rcov>, [">= 0"])
30
+ s.add_development_dependency(%q<yard>, [">= 0"])
31
+ else
32
+ s.add_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
33
+ s.add_dependency(%q<rspec>, [">= 0"])
34
+ s.add_dependency(%q<rcov>, [">= 0"])
35
+ s.add_dependency(%q<yard>, [">= 0"])
36
+ end
37
+ else
38
+ s.add_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
39
+ s.add_dependency(%q<rspec>, [">= 0"])
40
+ s.add_dependency(%q<rcov>, [">= 0"])
41
+ s.add_dependency(%q<yard>, [">= 0"])
42
+ end
43
+ end
@@ -0,0 +1,55 @@
1
+ ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), '..', 'lib' ))).uniq!
2
+ require 'lobby'
3
+
4
+ describe LobbyConstructor do
5
+ describe '::construct!' do
6
+ before :all do
7
+ LobbyConstructor::construct!
8
+ end
9
+
10
+ it 'should rename the root object to "lobby"' do
11
+ ::Kernel.eval('self', ::TOPLEVEL_BINDING).inspect.should == "lobby"
12
+ end
13
+
14
+ it 'should provide a singleton class named "Lobby"' do
15
+ class<<::Kernel.eval('self', ::TOPLEVEL_BINDING);self;end.inspect.should == "Lobby"
16
+ end
17
+
18
+ it 'should provide the "Lobby" singleton class under the Lobby constant' do
19
+ class<<::Kernel.eval('self', ::TOPLEVEL_BINDING);self;end.should ==
20
+ ::Kernel.eval('Lobby', ::TOPLEVEL_BINDING)
21
+ end
22
+
23
+ it 'should not allow instantiation of Lobby' do
24
+ lambda {
25
+ class<<::Kernel.eval('Lobby', ::TOPLEVEL_BINDING);self;end.new
26
+ }.should raise_error(TypeError)
27
+ end
28
+
29
+ it 'should allow the definition of methods on Lobby' do
30
+ ::Kernel.eval(<<-END, ::TOPLEVEL_BINDING)
31
+ class Lobby
32
+ def foo
33
+ return "foo"
34
+ end
35
+ end
36
+ END
37
+
38
+ ::Kernel.eval("foo()", ::TOPLEVEL_BINDING).should == "foo"
39
+ end
40
+ end
41
+ end
42
+
43
+ describe 'Kernel#lobby' do
44
+ it 'should be made available' do
45
+ lambda { ::Kernel.eval('self', ::TOPLEVEL_BINDING).instance_eval {
46
+ lobby
47
+ } }.should_not raise_error
48
+ end
49
+
50
+ it 'should make the main object available from anywhere' do
51
+ ::Kernel.eval('self', ::TOPLEVEL_BINDING).instance_eval {
52
+ lobby
53
+ }.should == ::Kernel.eval('self', ::TOPLEVEL_BINDING)
54
+ end
55
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elliottcable-lobby
3
+ version: !ruby/object:Gem::Version
4
+ version: "1"
5
+ platform: ruby
6
+ authors:
7
+ - elliottcable
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-17 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: echoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ - - "="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.2
27
+ version:
28
+ - !ruby/object:Gem::Dependency
29
+ name: rspec
30
+ type: :development
31
+ version_requirement:
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: "0"
37
+ version:
38
+ - !ruby/object:Gem::Dependency
39
+ name: rcov
40
+ type: :development
41
+ version_requirement:
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ - !ruby/object:Gem::Dependency
49
+ name: yard
50
+ type: :development
51
+ version_requirement:
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ description: Welcome to Ruby. Enjoy your stay. Here's a chair.
59
+ email:
60
+ - Lobby@elliottcable.com
61
+ executables: []
62
+
63
+ extensions: []
64
+
65
+ extra_rdoc_files:
66
+ - README.markdown
67
+ - lib/lobby.rb
68
+ files:
69
+ - README.markdown
70
+ - Rakefile.rb
71
+ - lib/lobby.rb
72
+ - spec/lobby_spec.rb
73
+ - .manifest
74
+ - lobby.gemspec
75
+ has_rdoc: true
76
+ homepage: http://github.com/elliottcable/lobby
77
+ post_install_message:
78
+ rdoc_options:
79
+ - --line-numbers
80
+ - --inline-source
81
+ - --title
82
+ - Lobby
83
+ - --main
84
+ - README.markdown
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ version:
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "1.2"
98
+ version:
99
+ requirements: []
100
+
101
+ rubyforge_project: lobby
102
+ rubygems_version: 1.2.0
103
+ signing_key:
104
+ specification_version: 2
105
+ summary: Welcome to Ruby. Enjoy your stay. Here's a chair.
106
+ test_files: []
107
+