Skip to content
Browse files

Working towards gemification

  • Loading branch information...
1 parent 7364a56 commit 1a44ba5f60262644d6eba8d36e4285f2c261732c @quirkey quirkey committed Feb 27, 2009
Showing with 29 additions and 66 deletions.
  1. +15 −3 Rakefile
  2. +4 −0 VERSION.yml
  3. +3 −3 bin/gembox
  4. +2 −2 config.ru
  5. +4 −1 lib/gembox.rb
  6. +0 −42 lib/gembox/cli.rb
  7. +1 −1 lib/gembox/gems.rb
  8. +0 −14 test/test_gembox_cli.rb
View
18 Rakefile
@@ -1,6 +1,21 @@
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
require File.dirname(__FILE__) + '/lib/gembox'
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |s|
+ s.name = "the-perfect-gem"
+ s.summary = "TODO"
+ s.email = "josh@technicalpickles.com"
+ s.homepage = "http://github.com/technicalpickles/the-perfect-gem"
+ s.description = "TODO"
+ s.authors = ["Josh Nichols"]
+ end
+rescue LoadError
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
+end
+
+
# Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory)
$hoe = Hoe.new('gembox', Gembox::VERSION) do |p|
@@ -23,6 +38,3 @@ end
require 'newgem/tasks' # load /tasks/*.rake
Dir['tasks/**/*.rake'].each { |t| load t }
-
-# TODO - want other tests/tasks run by default? Add them to the list
-# task :default => [:spec, :features]
View
4 VERSION.yml
@@ -0,0 +1,4 @@
+---
+:patch: 0
+:major: 0
+:minor: 0
View
6 bin/gembox 100644 → 100755
@@ -5,6 +5,6 @@
require File.expand_path(File.dirname(__FILE__) + "/../lib/gembox")
-require "gembox/cli"
-
-Gembox::CLI.execute(STDOUT, ARGV)
+Gembox::App.set :environment, :production
+Gembox::App.set :port, 5678
+Gembox::App.run!
View
4 config.ru
@@ -1,8 +1,8 @@
# To use with thin
# thin start -p PORT -R config.ru
-require File.join(File.dirname(__FILE__), 'gembox.rb')
+require File.join(File.dirname(__FILE__), 'gembox')
disable :run
set :env, :production
-run Sinatra.application
+run Gembox::App
View
5 lib/gembox.rb
@@ -5,10 +5,13 @@ module Gembox
VERSION = '0.0.1'
end
+require 'rubygems'
require 'active_support'
require 'will_paginate/array'
require 'will_paginate/view_helpers'
require 'extensions'
require 'gembox/gem_list'
-require 'gembox/gems'
+require 'gembox/gems'
+require 'gembox/view_helpers'
+require 'gembox/app'
View
42 lib/gembox/cli.rb
@@ -1,42 +0,0 @@
-require 'optparse'
-
-module Gembox
- class CLI
- def self.execute(stdout, arguments=[])
-
- # NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
-
- options = {
- :path => '~'
- }
- mandatory_options = %w( )
-
- parser = OptionParser.new do |opts|
- opts.banner = <<-BANNER.gsub(/^ /,'')
- This application is wonderful because...
-
- Usage: #{File.basename($0)} [options]
-
- Options are:
- BANNER
- opts.separator ""
- opts.on("-p", "--path=PATH", String,
- "This is a sample message.",
- "For multiple lines, add more strings.",
- "Default: ~") { |arg| options[:path] = arg }
- opts.on("-h", "--help",
- "Show this help message.") { stdout.puts opts; exit }
- opts.parse!(arguments)
-
- if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
- stdout.puts opts; exit
- end
- end
-
- path = options[:path]
-
- # do stuff
- puts "To update this executable, look in lib/gembox/cli.rb"
- end
- end
-end
View
2 lib/gembox/gems.rb
@@ -14,7 +14,7 @@ def local_gems
def search(search_term, version = nil)
version = version ? Gem::Requirement.create(version) : Gem::Requirement.default
- gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version)
+ gems = source_index.search Gem::Dependency.new(/#{Regexp.escape(search_term)}/, version)
group_gems(gems)
end
View
14 test/test_gembox_cli.rb
@@ -1,14 +0,0 @@
-require File.join(File.dirname(__FILE__), "test_helper.rb")
-require 'gembox/cli'
-
-class TestGemboxCli < Test::Unit::TestCase
- def setup
- Gembox::CLI.execute(@stdout_io = StringIO.new, [])
- @stdout_io.rewind
- @stdout = @stdout_io.read
- end
-
- def test_not_print_default_output
- assert_no_match(/To update this executable/, @stdout)
- end
-end

0 comments on commit 1a44ba5

Please sign in to comment.
Something went wrong with that request. Please try again.