gem_butler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source :rubygems
2
+ group :development do
3
+ gem "rspec", "~> 2.10.0"
4
+ gem "rdoc", "~> 3.12"
5
+ gem "bundler", "~> 1.1.0"
6
+ gem "jeweler", "~> 1.8.3"
7
+ gem "simplecov", ">= 0.5"
8
+ end
@@ -0,0 +1,37 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ jeweler (1.8.3)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rdoc
11
+ json (1.7.1)
12
+ multi_json (1.3.4)
13
+ rake (0.9.2.2)
14
+ rdoc (3.12)
15
+ json (~> 1.4)
16
+ rspec (2.10.0)
17
+ rspec-core (~> 2.10.0)
18
+ rspec-expectations (~> 2.10.0)
19
+ rspec-mocks (~> 2.10.0)
20
+ rspec-core (2.10.0)
21
+ rspec-expectations (2.10.0)
22
+ diff-lcs (~> 1.1.3)
23
+ rspec-mocks (2.10.1)
24
+ simplecov (0.6.2)
25
+ multi_json (~> 1.3)
26
+ simplecov-html (~> 0.5.3)
27
+ simplecov-html (0.5.3)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (~> 1.1.0)
34
+ jeweler (~> 1.8.3)
35
+ rdoc (~> 3.12)
36
+ rspec (~> 2.10.0)
37
+ simplecov (>= 0.5)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Kristian Mandrup
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # Gem butler
2
+
3
+ Makes it easy to divide your Gemfile into packages (or categories) of gems to include, each in a separate (smaller) gemfile.
4
+
5
+ You could put the gemfiles in a `gemfiles` folder in the root of your app.
6
+ The gemfiles should be of the form `Assets.gemfile`.
7
+
8
+ Example file structure
9
+
10
+ ```
11
+ + gemfiles
12
+ - Assets.gemfile
13
+ - Backend.gemfile
14
+ + view
15
+ - Bootstrap.gemfile
16
+ ```
17
+
18
+ In your Gemfile:
19
+
20
+ ```ruby
21
+ require 'butler'
22
+ butler = GemButler.new
23
+ butler.base_path = File.dirname(__FILE__) + '/gemfiles'
24
+ butler.exclude = [:bootstrap]
25
+
26
+ butler.included_gemfiles.each do |gemfile|
27
+ # puts "gemfile: #{gemfile}"
28
+ eval(IO.read(gemfile), binding)
29
+ end
30
+ ```
31
+
32
+ ## Contributing to gem_butler
33
+
34
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
35
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
36
+ * Fork the project.
37
+ * Start a feature/bugfix branch.
38
+ * Commit and push until you are happy with your contribution.
39
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
40
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
41
+
42
+ == Copyright
43
+
44
+ Copyright (c) 2012 Kristian Mandrup. See LICENSE.txt for
45
+ further details.
46
+
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "gem_butler"
18
+ gem.homepage = "http://github.com/kristianmandrup/gem_butler"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Divide Gemfile into named Gem packages and select which to include/exclude}
21
+ gem.description = %Q{Allows a much easier way to select/deselect a subset of related gems to include in a project}
22
+ gem.email = "kmandrup@gmail.com"
23
+ gem.authors = ["Kristian Mandrup"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "gem_butler #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "gem_butler"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Kristian Mandrup"]
12
+ s.date = "2012-05-09"
13
+ s.description = "Allows a much easier way to select/deselect a subset of related gems to include in a project"
14
+ s.email = "kmandrup@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "gem_butler.gemspec",
29
+ "lib/gem_butler.rb",
30
+ "spec/app/gemfiles/Assets.gemfile",
31
+ "spec/app/gemfiles/Facebook.gemfile",
32
+ "spec/app/gemfiles/backend/DataStore.gemfile",
33
+ "spec/app/gemfiles/view/Bootstrap.gemfile",
34
+ "spec/gem_butler_spec.rb",
35
+ "spec/spec_helper.rb"
36
+ ]
37
+ s.homepage = "http://github.com/kristianmandrup/gem_butler"
38
+ s.licenses = ["MIT"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = "1.8.24"
41
+ s.summary = "Divide Gemfile into named Gem packages and select which to include/exclude"
42
+
43
+ if s.respond_to? :specification_version then
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_development_dependency(%q<rspec>, ["~> 2.10.0"])
48
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
49
+ s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
50
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
51
+ s.add_development_dependency(%q<simplecov>, [">= 0.5"])
52
+ else
53
+ s.add_dependency(%q<rspec>, ["~> 2.10.0"])
54
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
55
+ s.add_dependency(%q<bundler>, ["~> 1.1.0"])
56
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
57
+ s.add_dependency(%q<simplecov>, [">= 0.5"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<rspec>, ["~> 2.10.0"])
61
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
62
+ s.add_dependency(%q<bundler>, ["~> 1.1.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
64
+ s.add_dependency(%q<simplecov>, [">= 0.5"])
65
+ end
66
+ end
67
+
@@ -0,0 +1,71 @@
1
+ class GemButler
2
+ attr_accessor :base_path
3
+
4
+ attr_writer :exclude, :include_only
5
+
6
+ def initialize path
7
+ @base_path = path
8
+ end
9
+
10
+ def gemfiles
11
+ @gemfiles ||= Dir.glob File.join(gemfiles_path, '**', '*.gemfile')
12
+ end
13
+
14
+ def gemfile_names mode = :included
15
+ list = case mode
16
+ when :included
17
+ included_gemfiles
18
+ else
19
+ gemfiles
20
+ end
21
+ list.map {|gemfile| gemfile.match(/\/(\w+)\.\w+$/)[1] }
22
+ end
23
+
24
+ def gemfile_paths
25
+ @gemfile_paths ||= gemfiles.map(&:to_s)
26
+ end
27
+
28
+ def included_gemfiles
29
+ return only_included if only_included?
30
+ excluded
31
+ end
32
+
33
+ def excluded
34
+ return [] if !exclude
35
+ @excluded ||= begin
36
+ gemfile_paths - exclude_list.flatten
37
+ end
38
+ end
39
+
40
+ def exclude_list
41
+ @exclude_list ||= [exclude].flatten.inject([]) do |res, gemfile|
42
+ res += gemfile_paths.grep(/#{Regexp.escape(gemfile)}\.gemfile$/i)
43
+ res
44
+ end
45
+ end
46
+
47
+ def only_included?
48
+ !only_included.empty?
49
+ end
50
+
51
+ def only_included
52
+ return [] if !include_only
53
+ @only_included ||= [include_only].flatten.inject([]) do |res, gemfile|
54
+ res += gemfile_paths.grep(/#{Regexp.escape(gemfile)}\.gemfile$/i)
55
+ res
56
+ end
57
+ end
58
+
59
+ def gemfiles_path
60
+ File.expand_path(base_path, __FILE__)
61
+ end
62
+
63
+ def include_only
64
+ @include_only ||= []
65
+ end
66
+
67
+ def exclude
68
+ @exclude ||= []
69
+ end
70
+ end
71
+
@@ -0,0 +1,14 @@
1
+ # Gems used only for assets and not required
2
+ # in production environments by default.
3
+ group :assets do
4
+ gem 'sass-rails' # '~> 4.0.0.beta', :git => 'git://github.com/rails/sass-rails.git'
5
+ gem 'compass-rails', '~> 1.0.1'
6
+ gem 'coffee-rails' # '~> 4.0.0.beta', :git => 'git://github.com/rails/coffee-rails.git'
7
+ gem 'uglifier', '>= 1.0.3'
8
+ # gem "bootstrap-sass", "~> 2.0.1" # https://github.com/thomas-mcdonald/bootstrap-sass
9
+ gem "twitter-bootstrap-rails"
10
+ gem 'bourbon' # sass helpers
11
+
12
+ gem 'haml_coffee_assets'
13
+ gem 'execjs'
14
+ end
@@ -0,0 +1,6 @@
1
+ # Facebook
2
+
3
+ # http://jeffdeville.com/minifb-vs-koala-vs-mogli-facebook-graph-api-r
4
+
5
+ gem 'facebook-social_plugins', '~> 0.2.2' #, :git => 'git://github.com/kristianmandrup/facebook-social_plugins.git'
6
+ gem 'facebook-rails-starterkit', '~> 0.1.3' #, :git => 'git://github.com/kristianmandrup/facebook-rails-starterkit.git'
@@ -0,0 +1,6 @@
1
+ # Mongo db
2
+ gem "bson_ext", '>= 1.6.1'
3
+ gem "mongoid", '~> 2' #, :git => 'git://github.com/mongoid/mongoid.git'
4
+
5
+ # Redis
6
+ gem 'redis', '>= 2.2.1'
@@ -0,0 +1,9 @@
1
+ # twitter bootstrap
2
+ # -----------------
3
+ # gem 'bootstrapped' , :git => 'git://github.com/kristianmandrup/bootstrapped.git'
4
+ # gem 'bootstrap_helper', :git => 'git://github.com/kristianmandrup/bootstrap-helper.git'
5
+
6
+ # gem 'twitter_bootstrap_form_for', :git => 'git://github.com/kristianmandrup/twitter_bootstrap_form_for.git'
7
+
8
+ # gem 'formtastic-bootstrap', :git => 'git://github.com/kristianmandrup/formtastic-bootstrap.git'
9
+ # gem 'bootstrap-components-rails', :git => 'git://github.com/kristianmandrup/bootstrap-components-rails.git'
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe GemButler do
4
+ subject { butler }
5
+
6
+ let(:butler) { GemButler.new path }
7
+
8
+ let(:path) { File.join File.dirname(__FILE__), 'app/gemfiles' }
9
+
10
+ context "none excluded" do
11
+ its(:gemfile_names) { should include('Assets', 'Bootstrap', 'DataStore', 'Facebook')}
12
+ end
13
+
14
+ context "assets excluded" do
15
+ before do
16
+ subject.exclude = [:assets]
17
+ end
18
+
19
+ its(:exclude) { should include(:assets) }
20
+ its(:only_included?) { should_not be_true }
21
+ its(:only_included) { should be_empty }
22
+ its(:excluded) { should_not be_empty }
23
+ specify { subject.exclude_list.first.should match /Assets\.gemfile/ }
24
+ its(:gemfile_names) { should_not include('Assets') }
25
+ end
26
+
27
+ context "assets include only" do
28
+ before do
29
+ subject.exclude = []
30
+ subject.include_only = [:assets, :view]
31
+ end
32
+
33
+ its(:include_only) { should include(:assets, :view) }
34
+ its(:only_included?) { should be_true }
35
+ its(:only_included) { should_not be_empty }
36
+ its(:excluded) { should_not be_empty }
37
+ its(:gemfile_names) { should include('Assets') }
38
+ its(:gemfile_names) { should_not include('Bootstrap') }
39
+ end
40
+ end
@@ -0,0 +1,10 @@
1
+ require 'rspec'
2
+ require 'gem_butler'
3
+
4
+ # Requires supporting files with custom matchers and macros, etc,
5
+ # in ./support/ and its subdirectories.
6
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
7
+
8
+ RSpec.configure do |config|
9
+
10
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_butler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kristian Mandrup
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.10.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 2.10.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rdoc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.12'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.12'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.3
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.3
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0.5'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0.5'
94
+ description: Allows a much easier way to select/deselect a subset of related gems
95
+ to include in a project
96
+ email: kmandrup@gmail.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files:
100
+ - LICENSE.txt
101
+ - README.md
102
+ files:
103
+ - .document
104
+ - .rspec
105
+ - Gemfile
106
+ - Gemfile.lock
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - VERSION
111
+ - gem_butler.gemspec
112
+ - lib/gem_butler.rb
113
+ - spec/app/gemfiles/Assets.gemfile
114
+ - spec/app/gemfiles/Facebook.gemfile
115
+ - spec/app/gemfiles/backend/DataStore.gemfile
116
+ - spec/app/gemfiles/view/Bootstrap.gemfile
117
+ - spec/gem_butler_spec.rb
118
+ - spec/spec_helper.rb
119
+ homepage: http://github.com/kristianmandrup/gem_butler
120
+ licenses:
121
+ - MIT
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ segments:
133
+ - 0
134
+ hash: 3847435360100278583
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 1.8.24
144
+ signing_key:
145
+ specification_version: 3
146
+ summary: Divide Gemfile into named Gem packages and select which to include/exclude
147
+ test_files: []