Skip to content

Commit 2bbd69f

Browse files
author
masarakki
committed
auto require
1 parent d73b3b8 commit 2bbd69f

File tree

7 files changed

+99
-25
lines changed

7 files changed

+99
-25
lines changed

Gemfile

-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
source 'https://rubygems.org'
22

3-
# Specify your gem's dependencies in ikazuchi.gemspec
43
gemspec
54

6-
group :development, :test do
7-
gem 'pry'
8-
gem 'byebug'
9-
gem 'pry-rails'
10-
gem 'pry-doc'
11-
gem 'pry-stack_explorer'
12-
gem 'pry-byebug'
13-
gem 'quiet_assets'
14-
gem 'better_errors'
15-
gem 'binding_of_caller'
16-
gem 'tapp'
17-
gem 'libnotify', :require => false
18-
gem 'growl', :require => false
19-
end

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Ikazuchi
22

3-
Useful gems for Rails development
3+
A meta package to intall useful gems for Rails development.
4+
5+
[Ikazuchi](https://twitter.com/hotaiyokan/status/366101148937105408/photo/1) is a [ダメ男製造機](http://seiga.nicovideo.jp/tag/%E3%83%80%E3%83%A1%E7%94%B7%E8%A3%BD%E9%80%A0%E6%A9%9F)
6+
7+
She makes us Lazy.
48

59
## Installation
610

@@ -16,10 +20,15 @@ Or install it yourself as:
1620

1721
$ gem install ikazuchi
1822

23+
## Installed gems in your rails application
24+
25+
see: https://github.com/masarakki/ikazuchi/blob/master/lib/ikazuchi/Gemfile
26+
1927
## Contributing
2028

2129
1. Fork it
2230
2. Create your feature branch (`git checkout -b my-new-feature`)
23-
3. Commit your changes (`git commit -am 'Add some feature'`)
24-
4. Push to the branch (`git push origin my-new-feature`)
25-
5. Create new Pull Request
31+
3. Edit Gemfile ( lib/ikazuchi/Gemfile )
32+
4. Commit your changes (`git commit -am 'Add some feature'`)
33+
5. Push to the branch (`git push origin my-new-feature`)
34+
6. Create new Pull Request

ikazuchi.gemspec

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib = File.expand_path('../lib', __FILE__)
33
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44
require 'ikazuchi/version'
5+
require 'ikazuchi/definition'
56

67
Gem::Specification.new do |spec|
78
spec.name = "ikazuchi"
@@ -18,8 +19,10 @@ Gem::Specification.new do |spec|
1819
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
1920
spec.require_paths = ["lib"]
2021

21-
spec.add_dependency 'http_accept_language'
22-
2322
spec.add_development_dependency "bundler", "~> 1.3"
2423
spec.add_development_dependency "rake"
24+
25+
Ikazuchi::Definition.dependencies.each do |dependency|
26+
spec.add_dependency dependency.name, dependency.requirement.to_s
27+
end
2528
end

lib/ikazuchi.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
require "ikazuchi/version"
2-
3-
module Ikazuchi
4-
# Your code goes here...
5-
end
2+
require "ikazuchi/definition"
3+
require 'ikazuchi/railtie' if defined? Rails

lib/ikazuchi/Gemfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'kaminari'
4+
gem 'http_accept_language'
5+
6+
group :development, :test do
7+
gem 'guard'
8+
gem 'rspec-rails'
9+
gem 'spork-rails'
10+
gem 'guard-rspec'
11+
gem 'gaurd-spork'
12+
gem 'libnotify', :require => false
13+
gem 'growl', :require => false
14+
15+
gem 'factory_girl_rails'
16+
gem 'simplecov', :require => false
17+
18+
gem 'pry'
19+
gem 'pry-rails'
20+
gem 'pry-doc'
21+
gem 'pry-stack_explorer'
22+
gem 'pry-byebug'
23+
24+
gem 'better_errors'
25+
gem 'binding_of_caller'
26+
gem 'tapp'
27+
gem 'awesome_print'
28+
29+
gem 'quiet_assets'
30+
gem 'rack-mini-profiler'
31+
end
32+
33+
group :development do
34+
gem 'capistrano'
35+
gem 'capistrano_colors'
36+
end

lib/ikazuchi/definition.rb

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require 'bundler'
2+
module Ikazuchi
3+
class Definition
4+
def root
5+
@root ||= File.expand_path '../../../', __FILE__
6+
end
7+
8+
def gemfile
9+
@gemfile ||= File.expand_path '../Gemfile', __FILE__
10+
end
11+
12+
def definition
13+
@definition ||= ::Bundler::Definition.build gemfile, nil, nil
14+
end
15+
16+
def runtime
17+
@runtime ||= ::Bundler::Runtime.new root, definition
18+
end
19+
20+
def dependencies
21+
definition.dependencies
22+
end
23+
24+
def require!(*groups)
25+
runtime.require(*groups)
26+
end
27+
28+
class << self
29+
def require!(*groups)
30+
self.new.require!(*groups)
31+
end
32+
33+
def dependencies
34+
self.new.dependencies
35+
end
36+
end
37+
end
38+
end

lib/ikazuchi/railtie.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Ikazuchi
2+
class Railtie < ::Rails::Railtie
3+
Ikazuchi::Definition.require!(Rails.env)
4+
end
5+
end

0 commit comments

Comments
 (0)