Skip to content
This repository

Bundler way of dealing with gem's stuff #119

Closed
wants to merge 2 commits into from

3 participants

Łukasz Strzałkowski Konstantin Haase Ryan Sobol
Łukasz Strzałkowski

I was messing with sinatra source recently and found it a bit troublesome to develop it. Before running tests I had to install all gem dependecies by hand. I really like bundler way of solving this issue. Thought it would be helpfull.

Let me know what do you think.

Konstantin Haase
Owner

I have created a Gemfile locally for exactly the same purpose. I think there is no Dir.glob in the gemspec on purpose. If we generate the file list in the gemspec, I much prefer using git ls-files.

Łukasz Strzałkowski

Thanks rkh for feedback, actually I also prefere git's ls-files rather than listing files in ruby (probably that's faster, don't know), but I left with Dir.glob because mostly people don't like mixing shell executions in code, I also don't like but in this case I think it's good idea.

Pushed commit with change.

Konstantin Haase
Owner

Yeah, but you'll have to maintain an ignore list (*.rbc and such).

Ryan Sobol

I like the patch. +1

Konstantin Haase
Owner

@strzalek feel free to contact Blake about this issue (bmizerany on IRC, GitHub and Twitter), I don't feel like being in the position to decide on this.

Konstantin Haase
Owner

Having bundler in the version control would bring more disadvantages than advantages (I use it to regularly change the Rack and Tilt versions I'm running against, but there is no point in committing that).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Nov 04, 2010
Łukasz Strzałkowski Bundler way 02a6f02
Nov 09, 2010
Łukasz Strzałkowski Use git ls-files instead of Dir.glob 32cd8a6
This page is out of date. Refresh to see the latest.
1  .gitignore
@@ -7,3 +7,4 @@
7 7
 .#*
8 8
 \#*
9 9
 .emacs*
  10
+.bundle
4  Gemfile
... ...
@@ -0,0 +1,4 @@
  1
+source "http://rubygems.org"
  2
+
  3
+# Specify your gem's dependencies in sinatra.gemspec
  4
+gemspec
61  Gemfile.lock
... ...
@@ -0,0 +1,61 @@
  1
+PATH
  2
+  remote: .
  3
+  specs:
  4
+    sinatra (1.1.0)
  5
+      rack (~> 1.1)
  6
+      tilt (~> 1.1)
  7
+
  8
+GEM
  9
+  remote: http://rubygems.org/
  10
+  specs:
  11
+    RedCloth (4.2.3)
  12
+    abstract (1.0.0)
  13
+    builder (2.1.2)
  14
+    coffee-script (1.1.0)
  15
+    erubis (2.6.6)
  16
+      abstract (>= 1.0.0)
  17
+    haml (3.0.23)
  18
+    less (1.2.21)
  19
+      mutter (>= 0.4.2)
  20
+      treetop (>= 1.4.2)
  21
+    liquid (2.2.2)
  22
+    markaby (0.7.1)
  23
+      builder (>= 2.0.0)
  24
+    mutter (0.5.3)
  25
+    nokogiri (1.4.3.1)
  26
+    polyglot (0.3.1)
  27
+    rack (1.2.1)
  28
+    rack-test (0.5.6)
  29
+      rack (>= 1.0)
  30
+    radius (0.6.1)
  31
+    rake (0.8.7)
  32
+    rdiscount (1.6.5)
  33
+    rdoc (2.5.11)
  34
+    shotgun (0.8)
  35
+      rack (>= 1.0)
  36
+    tilt (1.1)
  37
+    treetop (1.4.8)
  38
+      polyglot (>= 0.3.1)
  39
+
  40
+PLATFORMS
  41
+  ruby
  42
+
  43
+DEPENDENCIES
  44
+  RedCloth
  45
+  builder
  46
+  coffee-script
  47
+  erubis
  48
+  haml (>= 3.0)
  49
+  less
  50
+  liquid
  51
+  markaby
  52
+  nokogiri
  53
+  rack (~> 1.1)
  54
+  rack-test (>= 0.5.6)
  55
+  radius
  56
+  rake
  57
+  rdiscount
  58
+  rdoc
  59
+  shotgun (~> 0.6)
  60
+  sinatra!
  61
+  tilt (~> 1.1)
76  Rakefile
@@ -2,6 +2,9 @@ require 'rake/clean'
2 2
 require 'rake/testtask'
3 3
 require 'fileutils'
4 4
 require 'date'
  5
+require 'bundler'
  6
+
  7
+Bundler::GemHelper.install_tasks
5 8
 
6 9
 task :default => :test
7 10
 task :spec => :test
@@ -64,76 +67,3 @@ file 'doc/api/index.html' => FileList['lib/**/*.rb', 'README.*'] do |f|
64 67
   end
65 68
 end
66 69
 CLEAN.include 'doc/api'
67  
-
68  
-# PACKAGING ============================================================
69  
-
70  
-if defined?(Gem)
71  
-  # Load the gemspec using the same limitations as github
72  
-  def spec
73  
-    require 'rubygems' unless defined? Gem::Specification
74  
-    @spec ||= eval(File.read('sinatra.gemspec'))
75  
-  end
76  
-
77  
-  def package(ext='')
78  
-    "pkg/sinatra-#{spec.version}" + ext
79  
-  end
80  
-
81  
-  desc 'Build packages'
82  
-  task :package => %w[.gem .tar.gz].map {|e| package(e)}
83  
-
84  
-  desc 'Build and install as local gem'
85  
-  task :install => package('.gem') do
86  
-    sh "gem install #{package('.gem')}"
87  
-  end
88  
-
89  
-  directory 'pkg/'
90  
-  CLOBBER.include('pkg')
91  
-
92  
-  file package('.gem') => %w[pkg/ sinatra.gemspec] + spec.files do |f|
93  
-    sh "gem build sinatra.gemspec"
94  
-    mv File.basename(f.name), f.name
95  
-  end
96  
-
97  
-  file package('.tar.gz') => %w[pkg/] + spec.files do |f|
98  
-    sh <<-SH
99  
-      git archive \
100  
-        --prefix=sinatra-#{source_version}/ \
101  
-        --format=tar \
102  
-        HEAD | gzip > #{f.name}
103  
-    SH
104  
-  end
105  
-
106  
-  task 'sinatra.gemspec' => FileList['{lib,test,compat}/**','Rakefile','CHANGES','*.rdoc'] do |f|
107  
-    # read spec file and split out manifest section
108  
-    spec = File.read(f.name)
109  
-    head, manifest, tail = spec.split("  # = MANIFEST =\n")
110  
-    # replace version and date
111  
-    head.sub!(/\.version = '.*'/, ".version = '#{source_version}'")
112  
-    head.sub!(/\.date = '.*'/, ".date = '#{Date.today.to_s}'")
113  
-    # determine file list from git ls-files
114  
-    files = `git ls-files`.
115  
-      split("\n").
116  
-      sort.
117  
-      reject{ |file| file =~ /^\./ }.
118  
-      reject { |file| file =~ /^doc/ }.
119  
-      map{ |file| "    #{file}" }.
120  
-      join("\n")
121  
-    # piece file back together and write...
122  
-    manifest = "  s.files = %w[\n#{files}\n  ]\n"
123  
-    spec = [head,manifest,tail].join("  # = MANIFEST =\n")
124  
-    File.open(f.name, 'w') { |io| io.write(spec) }
125  
-    puts "updated #{f.name}"
126  
-  end
127  
-
128  
-  task 'release' => package('.gem') do
129  
-    sh <<-SH
130  
-      gem install #{package('.gem')} --local &&
131  
-      gem push #{package('.gem')}  &&
132  
-      git add sinatra.gemspec &&
133  
-      git commit --allow-empty -m '#{source_version} release'  &&
134  
-      git tag -s #{source_version} -m '#{source_version} release'  &&
135  
-      git push && (git push sinatra || true) &&
136  
-      git push --tags && (git push sinatra --tags || true)
137  
-    SH
138  
-  end
139  
-end
104  sinatra.gemspec
@@ -12,107 +12,15 @@ Gem::Specification.new do |s|
12 12
   s.authors = ["Blake Mizerany", "Ryan Tomayko", "Simon Rozet", "Konstantin Haase"]
13 13
   s.email = "sinatrarb@googlegroups.com"
14 14
 
15  
-  # = MANIFEST =
16  
-  s.files = %w[
17  
-    AUTHORS
18  
-    CHANGES
19  
-    LICENSE
20  
-    README.de.rdoc
21  
-    README.es.rdoc
22  
-    README.fr.rdoc
23  
-    README.hu.rdoc
24  
-    README.jp.rdoc
25  
-    README.rdoc
26  
-    README.zh.rdoc
27  
-    Rakefile
28  
-    lib/sinatra.rb
29  
-    lib/sinatra/base.rb
30  
-    lib/sinatra/images/404.png
31  
-    lib/sinatra/images/500.png
32  
-    lib/sinatra/main.rb
33  
-    lib/sinatra/showexceptions.rb
34  
-    sinatra.gemspec
35  
-    test/base_test.rb
36  
-    test/builder_test.rb
37  
-    test/coffee_test.rb
38  
-    test/contest.rb
39  
-    test/encoding_test.rb
40  
-    test/erb_test.rb
41  
-    test/erubis_test.rb
42  
-    test/extensions_test.rb
43  
-    test/filter_test.rb
44  
-    test/haml_test.rb
45  
-    test/hello.mab
46  
-    test/helper.rb
47  
-    test/helpers_test.rb
48  
-    test/less_test.rb
49  
-    test/liquid_test.rb
50  
-    test/mapped_error_test.rb
51  
-    test/markaby_test.rb
52  
-    test/markdown_test.rb
53  
-    test/middleware_test.rb
54  
-    test/nokogiri_test.rb
55  
-    test/public/favicon.ico
56  
-    test/radius_test.rb
57  
-    test/rdoc_test.rb
58  
-    test/request_test.rb
59  
-    test/response_test.rb
60  
-    test/result_test.rb
61  
-    test/route_added_hook_test.rb
62  
-    test/routing_test.rb
63  
-    test/sass_test.rb
64  
-    test/scss_test.rb
65  
-    test/server_test.rb
66  
-    test/settings_test.rb
67  
-    test/sinatra_test.rb
68  
-    test/static_test.rb
69  
-    test/templates_test.rb
70  
-    test/textile_test.rb
71  
-    test/views/ascii.haml
72  
-    test/views/error.builder
73  
-    test/views/error.erb
74  
-    test/views/error.erubis
75  
-    test/views/error.haml
76  
-    test/views/error.sass
77  
-    test/views/explicitly_nested.str
78  
-    test/views/foo/hello.test
79  
-    test/views/hello.builder
80  
-    test/views/hello.coffee
81  
-    test/views/hello.erb
82  
-    test/views/hello.erubis
83  
-    test/views/hello.haml
84  
-    test/views/hello.less
85  
-    test/views/hello.liquid
86  
-    test/views/hello.mab
87  
-    test/views/hello.md
88  
-    test/views/hello.nokogiri
89  
-    test/views/hello.radius
90  
-    test/views/hello.rdoc
91  
-    test/views/hello.sass
92  
-    test/views/hello.scss
93  
-    test/views/hello.str
94  
-    test/views/hello.test
95  
-    test/views/hello.textile
96  
-    test/views/layout2.builder
97  
-    test/views/layout2.erb
98  
-    test/views/layout2.erubis
99  
-    test/views/layout2.haml
100  
-    test/views/layout2.liquid
101  
-    test/views/layout2.mab
102  
-    test/views/layout2.nokogiri
103  
-    test/views/layout2.radius
104  
-    test/views/layout2.str
105  
-    test/views/layout2.test
106  
-    test/views/nested.str
107  
-    test/views/utf8.haml
108  
-  ]
109  
-  # = MANIFEST =
  15
+  s.files         = `git ls-files README* AUTHORS CHANGES LICENSE Rakefile Gemfile lib/`.split("\n")
  16
+  s.test_files    = `git ls-files test/`.split("\n")
  17
+  s.require_paths = ["lib"]
110 18
 
111  
-  s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}
  19
+  s.extra_rdoc_files = `git ls-files README* LICENSE`.split("\n")
112 20
 
113  
-  s.extra_rdoc_files = %w[README.rdoc README.de.rdoc README.jp.rdoc README.fr.rdoc README.es.rdoc README.hu.rdoc README.zh.rdoc LICENSE]
114 21
   s.add_dependency 'rack', '~> 1.1'
115 22
   s.add_dependency 'tilt', '~> 1.1'
  23
+
116 24
   s.add_development_dependency 'rake'
117 25
   s.add_development_dependency 'shotgun', '~> 0.6'
118 26
   s.add_development_dependency 'rack-test', '>= 0.5.6'
@@ -132,7 +40,7 @@ Gem::Specification.new do |s|
132 40
   s.has_rdoc = true
133 41
   s.homepage = "http://sinatra.rubyforge.org"
134 42
   s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sinatra", "--main", "README.rdoc"]
135  
-  s.require_paths = %w[lib]
  43
+
136 44
   s.rubyforge_project = 'sinatra'
137 45
   s.rubygems_version = '1.1.1'
138 46
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.