room_service 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a6b025cc0bc0b5eae33452c4c6fd73e0d02bd9cb
4
+ data.tar.gz: 37fc2b8669f11803818e994c8471ec1ea2272876
5
+ SHA512:
6
+ metadata.gz: d192da57b99cfadc798ba77487882cb4cfd3a3d14b1d9cf94bf5e3c1864cdda112a148f7e7236846e1486cc70cf3ab6d6067dcc25a93cd2d783527549f683d3b
7
+ data.tar.gz: 12362c0917a502b9ed8a75be8a12024d8264db51fd713a7a6b931a82116517daa27b794cfd6575b1aa055b4c154132a95a0c8d6ab21369d3f7b17812cfa44881
data/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ *.rbc
2
+ capybara-*.html
3
+ .rspec
4
+ /log
5
+ /tmp
6
+ /db/*.sqlite3
7
+ /db/*.sqlite3-journal
8
+ /public/system
9
+ /coverage/
10
+ /spec/tmp
11
+ **.orig
12
+ rerun.txt
13
+ pickle-email-*.html
14
+
15
+ # TODO Comment out these rules if you are OK with secrets being uploaded to the repo
16
+ config/initializers/secret_token.rb
17
+ config/secrets.yml
18
+
19
+ ## Environment normalisation:
20
+ /.bundle
21
+ /vendor/bundle
22
+
23
+ # these should all be checked in to normalise the environment:
24
+ # Gemfile.lock, .ruby-version, .ruby-gemset
25
+
26
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
27
+ .rvmrc
28
+
29
+ # if using bower-rails ignore default bower_components path bower.json files
30
+ /vendor/assets/bower_components
31
+ *.bowerrc
32
+ bower.json
33
+
34
+ # Ignore pow environment settings
35
+ .powenv
36
+
37
+ .idea
data/.pryrc ADDED
@@ -0,0 +1 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.1
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'pry'
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ room_service (0.1.0)
5
+ activesupport (~> 4.2.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.2.3)
11
+ i18n (~> 0.7)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ coderay (1.1.0)
17
+ i18n (0.7.0)
18
+ json (1.8.3)
19
+ method_source (0.8.2)
20
+ minitest (5.7.0)
21
+ pry (0.10.1)
22
+ coderay (~> 1.1.0)
23
+ method_source (~> 0.8.1)
24
+ slop (~> 3.4)
25
+ slop (3.6.0)
26
+ thread_safe (0.3.5)
27
+ tzinfo (1.2.2)
28
+ thread_safe (~> 0.1)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ pry
35
+ room_service!
36
+
37
+ BUNDLED WITH
38
+ 1.10.5
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # RoomService
2
+ RoomService is a tongue in cheek demo project for the Omaha Ruby Meetup that dynamically loads gems (installing them if necessary) when they are referenced.
@@ -0,0 +1,51 @@
1
+ require 'active_support/inflector'
2
+ require 'room_service/version'
3
+
4
+ module RoomService
5
+ def try_require_for_const(const_name, path)
6
+ require path
7
+
8
+ const_defined?(const_name)
9
+ rescue Exception
10
+ false
11
+ end
12
+
13
+ def try_to_install_gem(gem_name)
14
+ gems_installed = Gem.install(gem_name)
15
+
16
+ gem = gems_installed.first
17
+ gem_version = gem.version
18
+
19
+ gemfile_entry = "gem '#{gem_name}', '#{gem_version}'"
20
+ File.open('Gemfile', 'a') { |file| file.write "\n#{gemfile_entry}" }
21
+
22
+ gem.activate rescue nil
23
+
24
+ system 'bundle > /dev/null 2>&1'
25
+ rescue Exception
26
+ false
27
+ end
28
+
29
+ def const_missing(const_name)
30
+ catch(:found) do
31
+ standard_require_path = ActiveSupport::Inflector.underscore(const_name.to_s)
32
+ nonstandard_but_annoyingly_common_require_path = standard_require_path.gsub(/_/, '')
33
+
34
+ throw :found if try_require_for_const(const_name, standard_require_path)
35
+ throw :found if try_require_for_const(const_name, nonstandard_but_annoyingly_common_require_path)
36
+
37
+ if try_to_install_gem(standard_require_path) || try_to_install_gem(nonstandard_but_annoyingly_common_require_path)
38
+ throw :found if try_require_for_const(const_name, standard_require_path)
39
+ throw :found if try_require_for_const(const_name, nonstandard_but_annoyingly_common_require_path)
40
+ end
41
+
42
+ super(const_name)
43
+ end
44
+
45
+ const_get(const_name)
46
+ rescue Exception
47
+ super(const_name)
48
+ end
49
+ end
50
+
51
+ Module.prepend(RoomService)
@@ -0,0 +1,4 @@
1
+ module RoomService
2
+ # http://semver.org/
3
+ VERSION = '0.1.0'
4
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'room_service/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'room_service'
7
+ s.version = RoomService::VERSION.dup
8
+ s.platform = Gem::Platform::RUBY
9
+ s.licenses = ['MIT']
10
+ s.summary = 'Room service is a tongue in cheek demo project for the Omaha Ruby Meetup that dynamically loads gems (installing them if necessary) when they are referenced.'
11
+ s.email = 'alec.larsen@agapered.com'
12
+ s.homepage = 'https://github.com/anarchocurious/room_service'
13
+ s.description = s.summary
14
+ s.authors = ['Alec Larsen', 'The Omaha Ruby Meetup Community']
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.require_paths = ['lib']
18
+ s.required_ruby_version = '>= 2.0.0'
19
+
20
+ s.add_dependency('activesupport', '~> 4.2.3')
21
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: room_service
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alec Larsen
8
+ - The Omaha Ruby Meetup Community
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-07-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 4.2.3
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 4.2.3
28
+ description: Room service is a tongue in cheek demo project for the Omaha Ruby Meetup
29
+ that dynamically loads gems (installing them if necessary) when they are referenced.
30
+ email: alec.larsen@agapered.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - ".pryrc"
37
+ - ".ruby-version"
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - README.md
41
+ - lib/room_service.rb
42
+ - lib/room_service/version.rb
43
+ - room_service.gemspec
44
+ homepage: https://github.com/anarchocurious/room_service
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.0
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.4.6
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Room service is a tongue in cheek demo project for the Omaha Ruby Meetup
68
+ that dynamically loads gems (installing them if necessary) when they are referenced.
69
+ test_files: []
70
+ has_rdoc: