Skip to content

Commit

Permalink
Adding gem-scaffold directory and changing links
Browse files Browse the repository at this point in the history
  • Loading branch information
martinos committed Oct 27, 2010
1 parent d973760 commit ac34d19
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gem-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ To begin to create a gem using Bundler, use the `bundle gem` command like this:

We call our gem `foodie` because this gem is going to do a couple of things around food, such as portraying them as either "Delicious!" or "Gross!". Stay tuned.

This command creates a [scaffold directory](gem-development/foodie) for our new gem and if we have Git installed initializes a Git repository in this directory so we can start committing right away. The files generated are:
This command creates a [scaffold directory](gem-scaffold/foodie) for our new gem and if we have Git installed initializes a Git repository in this directory so we can start committing right away. The files generated are:

* [**Gemfile**](gem-development/foodie/Gemfile) : Used to manage gem dependencies for our library's development. This file contains a `gemspec` line meaning that Bundler will include dependencies specified in _foodie.gemspec_ too. It's best practice to specify the gems that our library depends on all in the _gemspec_.
* [**Gemfile**](gem-scaffold/foodie/Gemfile) : Used to manage gem dependencies for our library's development. This file contains a `gemspec` line meaning that Bundler will include dependencies specified in _foodie.gemspec_ too. It's best practice to specify the gems that our library depends on all in the _gemspec_.

* [**Rakefile**](gem-development/foodie/Rakefile): Requires Bundler and adds the `build`, `install` and `release` Rake tasks by way of calling _Bundler::GemHelper.install\_tasks_. The `build` task will build the current version of the gem and store it under the _pkg_ folder, the `install` task will build _and_ install the gem to our system (just like it would do if we `gem install`'d it) and `release` will push the gem to Rubygems for consumption by the public.
* [**Rakefile**](gem-scaffold/foodie/Rakefile): Requires Bundler and adds the `build`, `install` and `release` Rake tasks by way of calling _Bundler::GemHelper.install\_tasks_. The `build` task will build the current version of the gem and store it under the _pkg_ folder, the `install` task will build _and_ install the gem to our system (just like it would do if we `gem install`'d it) and `release` will push the gem to Rubygems for consumption by the public.

* [**.gitignore**](gem-development/foodie/.gitignore): (only if we have Git). This ignores anything in the _pkg_ directory (generally files put there by `rake build`), anything with a _.gem_ extension and the _.bundle_ directory.
* [**.gitignore**](gem-scaffold/foodie/.gitignore): (only if we have Git). This ignores anything in the _pkg_ directory (generally files put there by `rake build`), anything with a _.gem_ extension and the _.bundle_ directory.

* [**foodie.gemspec**](gem-development/foodie/foodie.gemspec): The Gem Specification file. This is where we provide information for Rubygems' consumption such as the name, description and homepage of our gem. This is also where we specify the dependencies our gem needs to run.
* [**foodie.gemspec**](gem-scaffold/foodie/foodie.gemspec): The Gem Specification file. This is where we provide information for Rubygems' consumption such as the name, description and homepage of our gem. This is also where we specify the dependencies our gem needs to run.

* [**lib/foodie.rb**](gem-development/foodie/lib/foodie.rb): The main file to define our gem's code. This is the file that will be required by Bundler (or any similarly smart system) when our gem is loaded. This file defines a `module` which we can use a namespace for all our gem's code. It's best practice to put our code in...
* [**lib/foodie.rb**](gem-scaffold/foodie/lib/foodie.rb): The main file to define our gem's code. This is the file that will be required by Bundler (or any similarly smart system) when our gem is loaded. This file defines a `module` which we can use a namespace for all our gem's code. It's best practice to put our code in...

* [**lib/foodie**](gem-development/foodie/lib/foodie): here. This folder should contain all the code (classes, etc.) for our gem. The _lib/foodie.rb_ file is there for setting up our gem's environment, whilst all the parts to it go in this folder. If our gem has multiple uses, separating this out so that people can require one class/file at a time can be really helpful.
* [**lib/foodie**](gem-scaffold/foodie/lib/foodie): here. This folder should contain all the code (classes, etc.) for our gem. The _lib/foodie.rb_ file is there for setting up our gem's environment, whilst all the parts to it go in this folder. If our gem has multiple uses, separating this out so that people can require one class/file at a time can be really helpful.

* [**lib/foodie/version.rb**](gem-development/foodie/lib/foodie/version.rb): Defines a `Foodie` constant and in it, a `VERSION` constant. This file is loaded by the _foodie.gemspec_ to specify a version for the gem specification. When we release a new version of the gem we will increment a part of this version number to indicate to Rubygems that we're releasing a new version.
* [**lib/foodie/version.rb**](gem-scaffold/foodie/lib/foodie/version.rb): Defines a `Foodie` constant and in it, a `VERSION` constant. This file is loaded by the _foodie.gemspec_ to specify a version for the gem specification. When we release a new version of the gem we will increment a part of this version number to indicate to Rubygems that we're releasing a new version.

There's our base and our layout, now get developing!

Expand Down
3 changes: 3 additions & 0 deletions gem-scaffold/foodie/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pkg/*
*.gem
.bundle
4 changes: 4 additions & 0 deletions gem-scaffold/foodie/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source :gemcutter

# Specify your gem's dependencies in foodie.gemspec
gemspec
2 changes: 2 additions & 0 deletions gem-scaffold/foodie/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks
22 changes: 22 additions & 0 deletions gem-scaffold/foodie/foodie.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
require File.expand_path("../lib/foodie/version", __FILE__)

Gem::Specification.new do |s|
s.name = "foodie"
s.version = Foodie::VERSION
s.platform = Gem::Platform::RUBY
s.authors = []
s.email = []
s.homepage = "http://rubygems.org/gems/foodie"
s.summary = "TODO: Write a gem summary"
s.description = "TODO: Write a gem description"

s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "foodie"

s.add_development_dependency "bundler", ">= 1.0.0"

s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
s.require_path = 'lib'
end
3 changes: 3 additions & 0 deletions gem-scaffold/foodie/lib/foodie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Foodie
# Your code goes here...
end
3 changes: 3 additions & 0 deletions gem-scaffold/foodie/lib/foodie/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Foodie
VERSION = "0.0.1"
end

0 comments on commit ac34d19

Please sign in to comment.