jackdempsey-beet 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Jack Dempsey
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.
data/README.rdoc ADDED
@@ -0,0 +1,13 @@
1
+ = beet
2
+
3
+ Beet is a simple project/app generator, with its roots and underlying infrastructure heavily influenced from Rails Templates.
4
+
5
+ Currently Beet will focus on Rails template generation, but there's no reason not to extend it to build out any sort of project.
6
+ The goal is to have a variety of core level methods to allow for building of higher level concepts that make sense in whatever
7
+ your project needs.
8
+
9
+ Eventually I would love to see strategies/templates for sinatra, merb, iPhone apps, etc. The sky is the limit.
10
+
11
+ == Copyright
12
+
13
+ Copyright (c) 2009 Jack Dempsey. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "beet"
8
+ gem.summary = %Q{A gem to help with easily generating projects}
9
+ gem.email = "jack.dempsey@gmail.com"
10
+ gem.homepage = "http://github.com/jackdempsey/beet"
11
+ gem.authors = ["Jack Dempsey"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'spec/rake/spectask'
20
+ Spec::Rake::SpecTask.new(:spec) do |spec|
21
+ spec.libs << 'lib' << 'spec'
22
+ spec.spec_files = FileList['spec/**/*_spec.rb']
23
+ end
24
+
25
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.pattern = 'spec/**/*_spec.rb'
28
+ spec.rcov = true
29
+ end
30
+
31
+
32
+ task :default => :spec
33
+
34
+ require 'rake/rdoctask'
35
+ Rake::RDocTask.new do |rdoc|
36
+ if File.exist?('VERSION.yml')
37
+ config = YAML.load(File.read('VERSION.yml'))
38
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
39
+ else
40
+ version = ""
41
+ end
42
+
43
+ rdoc.rdoc_dir = 'rdoc'
44
+ rdoc.title = "beet #{version}"
45
+ rdoc.rdoc_files.include('README*')
46
+ rdoc.rdoc_files.include('lib/**/*.rb')
47
+ end
48
+
data/TODO ADDED
File without changes
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/beet.gemspec ADDED
@@ -0,0 +1,61 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{beet}
5
+ s.version = "0.0.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jack Dempsey"]
9
+ s.date = %q{2009-05-20}
10
+ s.default_executable = %q{beet}
11
+ s.email = %q{jack.dempsey@gmail.com}
12
+ s.executables = ["beet"]
13
+ s.extra_rdoc_files = [
14
+ "LICENSE",
15
+ "README.rdoc"
16
+ ]
17
+ s.files = [
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "TODO",
22
+ "VERSION",
23
+ "beet.gemspec",
24
+ "bin/beet",
25
+ "lib/beet.rb",
26
+ "lib/beet/capistrano.rb",
27
+ "lib/beet/execution.rb",
28
+ "lib/beet/executor.rb",
29
+ "lib/beet/file_system.rb",
30
+ "lib/beet/interaction.rb",
31
+ "lib/beet/logging.rb",
32
+ "lib/beet/rails.rb",
33
+ "lib/beet/scm.rb",
34
+ "lib/beet/scm/git.rb",
35
+ "lib/beet/scm/svn.rb",
36
+ "lib/beet/templates/rails/clean_files.rb",
37
+ "lib/beet/templates/rails/git.rb",
38
+ "lib/beet/templates/rails/jquery.rb",
39
+ "spec/beet_spec.rb",
40
+ "spec/spec_helper.rb"
41
+ ]
42
+ s.homepage = %q{http://github.com/jackdempsey/beet}
43
+ s.rdoc_options = ["--charset=UTF-8"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = %q{1.3.3}
46
+ s.summary = %q{A gem to help with easily generating projects}
47
+ s.test_files = [
48
+ "spec/beet_spec.rb",
49
+ "spec/spec_helper.rb"
50
+ ]
51
+
52
+ if s.respond_to? :specification_version then
53
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
+ s.specification_version = 3
55
+
56
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57
+ else
58
+ end
59
+ else
60
+ end
61
+ end
data/bin/beet ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'thor'
5
+ require 'ruby-debug'
6
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
7
+ require 'beet'
8
+
9
+ class BeetRunner < Thor
10
+ default_task :help
11
+
12
+ map "-g" => :generate
13
+ map "-h" => :help
14
+ map "-v" => :version
15
+
16
+ desc 'generate [app_name]', "the main app generate method"
17
+ method_options :templates => :optional
18
+ def generate(app_name, type=:rails)
19
+ case type
20
+ when :rails
21
+ puts "Generating rails project #{app_name}..."
22
+ system("rails #{app_name}")
23
+ if options[:templates]
24
+ executor = Beet::Executor.new(options[:templates], app_name)
25
+ executor.run_templates
26
+ end
27
+ else
28
+ puts "type not recognized!"
29
+ end
30
+ end
31
+
32
+ desc 'version', "the current version of beet"
33
+ def version
34
+ version_file = Dir.pwd + '/VERSION'
35
+ if File.exists?(version_file) and version = File.read(version_file)
36
+ puts "Beet version: #{version}"
37
+ end
38
+ end
39
+
40
+ desc 'help', 'help output'
41
+ def help
42
+ puts %{
43
+ Usage: #{$0} /path/to/your/app [options]
44
+
45
+ Options:
46
+
47
+ Beet Info:
48
+ -v, --version Show the Beet version number and quit.
49
+ -h, --help Show this help message and quit.
50
+
51
+ General Options:
52
+
53
+ Description:
54
+ Beet is used to quickly generate applications.
55
+
56
+ Example:
57
+ beet example_app --git --clean_files
58
+ }
59
+ end
60
+ end
61
+ BeetRunner.start
@@ -0,0 +1,14 @@
1
+ module Beet
2
+ module Capistrano
3
+ # Just run the capify command in root
4
+ #
5
+ # ==== Example
6
+ #
7
+ # capify!
8
+ #
9
+ def capify!
10
+ log 'capifying'
11
+ in_root { run('capify .', false) }
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,37 @@
1
+ module Beet
2
+ module Execution
3
+ # Executes a command
4
+ #
5
+ # ==== Example
6
+ #
7
+ # inside('vendor') do
8
+ # run('ln -s ~/edge rails)
9
+ # end
10
+ #
11
+ def run(command, log_action = true)
12
+ log 'executing', "#{command} from #{Dir.pwd}" if log_action
13
+ `#{command}`
14
+ end
15
+
16
+ # Executes a ruby script (taking into account WIN32 platform quirks)
17
+ def run_ruby_script(command, log_action = true)
18
+ ruby_command = RUBY_PLATFORM=~ /win32/ ? 'ruby ' : ''
19
+ run("#{ruby_command}#{command}", log_action)
20
+ end
21
+
22
+ # Runs the supplied rake task
23
+ #
24
+ # ==== Example
25
+ #
26
+ # rake("db:migrate")
27
+ # rake("db:migrate", :env => "production")
28
+ # rake("gems:install", :sudo => true)
29
+ #
30
+ def rake(command, options = {})
31
+ log 'rake', command
32
+ env = options[:env] || 'development'
33
+ sudo = options[:sudo] ? 'sudo ' : ''
34
+ in_root { run("#{sudo}rake #{command} RAILS_ENV=#{env}", false) }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,43 @@
1
+ require 'open-uri'
2
+ module Beet
3
+ class Executor
4
+ include Beet::Execution
5
+ include Beet::FileSystem
6
+ include Beet::Interaction
7
+ include Beet::Logging
8
+
9
+ # TODO create a better way to mixin things from rails/whatever as needed
10
+ include Beet::Rails
11
+ include Beet::Capistrano
12
+ include Beet::SCM
13
+
14
+ attr_reader :root
15
+ attr_writer :logger
16
+ attr_accessor :templates, :app_name
17
+
18
+ def initialize(templates, app_name) # :nodoc:
19
+ @root = File.expand_path(File.join(Dir.pwd, app_name))
20
+ @templates = []
21
+ templates.split(/[\s,]+/).each do |template|
22
+ @templates << (if !File.exists?(template) and !template.include?('http')
23
+ # they're trying to use a named template from the templates directory
24
+ File.expand_path(File.join(File.dirname(__FILE__), 'templates', "#{template}.rb"))
25
+ else
26
+ template
27
+ end)
28
+ end
29
+ end
30
+
31
+ def run_templates
32
+ @templates.each do |template|
33
+ begin
34
+ code = open(template).read
35
+ in_root { self.instance_eval(code) }
36
+ rescue LoadError, Errno::ENOENT => e
37
+ raise "The template [#{template}] could not be loaded. Error: #{e}"
38
+ end
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,112 @@
1
+ require 'fileutils'
2
+ module Beet
3
+ module FileSystem
4
+ # Create a new file in the project folder. Specify the
5
+ # relative path from the project's root. Data is the return value of a block
6
+ # or a data string.
7
+ #
8
+ # ==== Examples
9
+ #
10
+ # file("lib/fun_party.rb") do
11
+ # hostname = ask("What is the virtual hostname I should use?")
12
+ # "vhost.name = #{hostname}"
13
+ # end
14
+ #
15
+ # file("config/apach.conf", "your apache config")
16
+ #
17
+ def file(filename, data = nil, log_action = true, &block)
18
+ log 'file', filename if log_action
19
+ dir, file = [File.dirname(filename), File.basename(filename)]
20
+
21
+ inside(dir) do
22
+ File.open(file, "w") do |f|
23
+ if block_given?
24
+ f.write(block.call)
25
+ else
26
+ f.write(data)
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ # Create a new file in the lib/ directory. Code can be specified
33
+ # in a block or a data string can be given.
34
+ #
35
+ # ==== Examples
36
+ #
37
+ # lib("crypto.rb") do
38
+ # "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'"
39
+ # end
40
+ #
41
+ # lib("foreign.rb", "# Foreign code is fun")
42
+ #
43
+ def lib(filename, data = nil, &block)
44
+ log 'lib', filename
45
+ file("lib/#{filename}", data, false, &block)
46
+ end
47
+
48
+ # Create a new Rakefile with the provided code (either in a block or a string).
49
+ #
50
+ # ==== Examples
51
+ #
52
+ # rakefile("bootstrap.rake") do
53
+ # project = ask("What is the UNIX name of your project?")
54
+ #
55
+ # <<-TASK
56
+ # namespace :#{project} do
57
+ # task :bootstrap do
58
+ # puts "i like boots!"
59
+ # end
60
+ # end
61
+ # TASK
62
+ # end
63
+ #
64
+ # rakefile("seed.rake", "puts 'im plantin ur seedz'")
65
+ #
66
+ def rakefile(filename, data = nil, &block)
67
+ log 'rakefile', filename
68
+ file("lib/tasks/#{filename}", data, false, &block)
69
+ end
70
+
71
+ # Do something in the root of the project or
72
+ # a provided subfolder; the full path is yielded to the block you provide.
73
+ # The path is set back to the previous path when the method exits.
74
+ def inside(dir = '', &block)
75
+ folder = File.join(root, dir)
76
+ FileUtils.mkdir_p(folder) unless File.exist?(folder)
77
+ FileUtils.cd(folder) { block.arity == 1 ? yield(folder) : yield }
78
+ end
79
+
80
+ def in_root
81
+ FileUtils.cd(root) { yield }
82
+ end
83
+
84
+ # Run a regular expression replacement on a file
85
+ #
86
+ # ==== Example
87
+ #
88
+ # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
89
+ #
90
+ def gsub_file(relative_destination, regexp, *args, &block)
91
+ path = destination_path(relative_destination)
92
+ content = File.read(path).gsub(regexp, *args, &block)
93
+ File.open(path, 'wb') { |file| file.write(content) }
94
+ end
95
+
96
+ # Append text to a file
97
+ #
98
+ # ==== Example
99
+ #
100
+ # append_file 'config/environments/test.rb', 'config.gem "rspec"'
101
+ #
102
+ def append_file(relative_destination, data)
103
+ path = destination_path(relative_destination)
104
+ File.open(path, 'ab') { |file| file.write(data) }
105
+ end
106
+
107
+ def destination_path(relative_destination)
108
+ File.join(root, relative_destination)
109
+ end
110
+
111
+ end
112
+ end
@@ -0,0 +1,36 @@
1
+ module Beet
2
+ module Interaction
3
+ # Get a user's input
4
+ #
5
+ # ==== Example
6
+ #
7
+ # answer = ask("Should I freeze the latest Rails?")
8
+ # freeze! if ask("Should I freeze the latest Rails?") == "yes"
9
+ #
10
+ def ask(string)
11
+ log '', string
12
+ STDIN.gets.strip
13
+ end
14
+
15
+ # Helper to test if the user says yes(y)?
16
+ #
17
+ # ==== Example
18
+ #
19
+ # freeze! if yes?("Should I freeze the latest Rails?")
20
+ #
21
+ def yes?(question)
22
+ answer = ask(question).downcase
23
+ answer == "y" || answer == "yes"
24
+ end
25
+
26
+ # Helper to test if the user does NOT say yes(y)?
27
+ #
28
+ # ==== Example
29
+ #
30
+ # capify! if no?("Will you be using vlad to deploy your application?")
31
+ #
32
+ def no?(question)
33
+ !yes?(question)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ require 'logger'
2
+ module Beet
3
+ module Logging
4
+
5
+ def log(action, message = '')
6
+ logger.debug("#{action}: #{message}")
7
+ end
8
+
9
+ def logger
10
+ @logger ||= Logger.new(STDOUT)
11
+ end
12
+
13
+ end
14
+ end
data/lib/beet/rails.rb ADDED
@@ -0,0 +1,146 @@
1
+ module Beet
2
+ module Rails
3
+ # Make an entry in Rails routing file conifg/routes.rb
4
+ #
5
+ # === Example
6
+ #
7
+ # route "map.root :controller => :welcome"
8
+ #
9
+ def route(routing_code)
10
+ log 'route', routing_code
11
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
12
+
13
+ in_root do
14
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
15
+ "#{match}\n #{routing_code}\n"
16
+ end
17
+ end
18
+ end
19
+
20
+ # Add Rails to /vendor/rails
21
+ #
22
+ # ==== Example
23
+ #
24
+ # freeze!
25
+ #
26
+ def freeze!(args = {})
27
+ log 'vendor', 'rails edge'
28
+ in_root { run('rake rails:freeze:edge', false) }
29
+ end
30
+
31
+ # Install a plugin. You must provide either a Subversion url or Git url.
32
+ # For a Git-hosted plugin, you can specify if it should be added as a submodule instead of cloned.
33
+ #
34
+ # ==== Examples
35
+ #
36
+ # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
37
+ # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
38
+ # plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk'
39
+ #
40
+ def plugin(name, options)
41
+ log 'plugin', name
42
+
43
+ if options[:git] && options[:submodule]
44
+ in_root do
45
+ Git.run("submodule add #{options[:git]} vendor/plugins/#{name}")
46
+ end
47
+ elsif options[:git] || options[:svn]
48
+ in_root do
49
+ run_ruby_script("script/plugin install #{options[:svn] || options[:git]}", false)
50
+ end
51
+ else
52
+ log "! no git or svn provided for #{name}. skipping..."
53
+ end
54
+ end
55
+
56
+ # Adds an entry into config/environment.rb for the supplied gem :
57
+ def gem(name, options = {})
58
+ log 'gem', name
59
+ env = options.delete(:env)
60
+
61
+ gems_code = "config.gem '#{name}'"
62
+
63
+ if options.any?
64
+ opts = options.inject([]) {|result, h| result << [":#{h[0]} => #{h[1].inspect.gsub('"',"'")}"] }.sort.join(", ")
65
+ gems_code << ", #{opts}"
66
+ end
67
+
68
+ environment gems_code, :env => env
69
+ end
70
+
71
+ # Adds a line inside the Initializer block for config/environment.rb. Used by #gem
72
+ # If options :env is specified, the line is appended to the corresponding
73
+ # file in config/environments/#{env}.rb
74
+ def environment(data = nil, options = {}, &block)
75
+ sentinel = 'Rails::Initializer.run do |config|'
76
+
77
+ data = block.call if !data && block_given?
78
+
79
+ in_root do
80
+ if options[:env].nil?
81
+ gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
82
+ "#{match}\n " << data
83
+ end
84
+ else
85
+ Array.wrap(options[:env]).each do|env|
86
+ append_file "config/environments/#{env}.rb", "\n#{data}"
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ # Create a new file in the vendor/ directory. Code can be specified
93
+ # in a block or a data string can be given.
94
+ #
95
+ # ==== Examples
96
+ #
97
+ # vendor("sekrit.rb") do
98
+ # sekrit_salt = "#{Time.now}--#{3.years.ago}--#{rand}--"
99
+ # "salt = '#{sekrit_salt}'"
100
+ # end
101
+ #
102
+ # vendor("foreign.rb", "# Foreign code is fun")
103
+ #
104
+ def vendor(filename, data = nil, &block)
105
+ log 'vendoring', filename
106
+ file("vendor/#{filename}", data, false, &block)
107
+ end
108
+
109
+
110
+ # Create a new initializer with the provided code (either in a block or a string).
111
+ #
112
+ # ==== Examples
113
+ #
114
+ # initializer("globals.rb") do
115
+ # data = ""
116
+ #
117
+ # ['MY_WORK', 'ADMINS', 'BEST_COMPANY_EVAR'].each do
118
+ # data << "#{const} = :entp"
119
+ # end
120
+ #
121
+ # data
122
+ # end
123
+ #
124
+ # initializer("api.rb", "API_KEY = '123456'")
125
+ #
126
+ def initializer(filename, data = nil, &block)
127
+ log 'initializer', filename
128
+ file("config/initializers/#{filename}", data, false, &block)
129
+ end
130
+
131
+ # Generate something using a generator from Rails or a plugin.
132
+ # The second parameter is the argument string that is passed to
133
+ # the generator or an Array that is joined.
134
+ #
135
+ # ==== Example
136
+ #
137
+ # generate(:authenticated, "user session")
138
+ #
139
+ def generate(what, *args)
140
+ log 'generating', what
141
+ argument = args.map {|arg| arg.to_s }.flatten.join(" ")
142
+
143
+ in_root { run_ruby_script("script/generate #{what} #{argument}", false) }
144
+ end
145
+ end # Rails
146
+ end # Beet
@@ -0,0 +1,15 @@
1
+ class Git < Scm
2
+ def self.clone(repos, branch=nil)
3
+ system("git clone #{repos}")
4
+
5
+ if branch
6
+ system("cd #{repos.split('/').last}/")
7
+ system("git checkout #{branch}")
8
+ end
9
+ end
10
+
11
+ def self.run(command)
12
+ system("git #{command}")
13
+ end
14
+ end
15
+
@@ -0,0 +1,5 @@
1
+ class Svn < Scm
2
+ def self.checkout(repos, branch = nil)
3
+ `svn checkout #{repos}/#{branch || "trunk"}`
4
+ end
5
+ end
data/lib/beet/scm.rb ADDED
@@ -0,0 +1,36 @@
1
+ class Scm
2
+
3
+ private
4
+
5
+ def self.hash_to_parameters(hash)
6
+ hash.collect { |key, value| "--#{key} #{(value.kind_of?(String) ? value : "")}"}.join(" ")
7
+ end
8
+ end
9
+ require File.dirname(__FILE__) + '/scm/git'
10
+ require File.dirname(__FILE__) + '/scm/svn'
11
+
12
+ module Beet
13
+ module SCM
14
+ # Run a command in git.
15
+ #
16
+ # ==== Examples
17
+ #
18
+ # git :init
19
+ # git :add => "this.file that.rb"
20
+ # git :add => "onefile.rb", :rm => "badfile.cxx"
21
+ #
22
+ def git(command = {})
23
+ in_root do
24
+ if command.is_a?(Symbol)
25
+ log 'running', "git #{command}"
26
+ Git.run(command.to_s)
27
+ else
28
+ command.each do |command, options|
29
+ log 'running', "git #{command} #{options}"
30
+ Git.run("#{command} #{options}")
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,4 @@
1
+ run "rm README"
2
+ run "rm public/index.html"
3
+ run "rm public/favicon.ico"
4
+ run "rm public/robots.txt"
@@ -0,0 +1,24 @@
1
+ ["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
2
+ run("rmdir ./#{f}")
3
+ end
4
+
5
+ run("find . \\( -type d -empty \\) -and \\( -not -regex ./\\.git.* \\) -exec touch {}/.gitignore \\;")
6
+
7
+ git :init
8
+
9
+ file '.gitignore', <<-CODE
10
+ log/\\*.log
11
+ log/\\*.pid
12
+ db/\\*.db
13
+ db/\\*.sqlite3
14
+ db/schema.rb
15
+ tmp/\\*\\*/\\*
16
+ .DS_Store
17
+ doc/api
18
+ doc/app
19
+ config/database.yml
20
+ CODE
21
+
22
+ git :add => "."
23
+
24
+ git :commit => "-m 'Initial commit. Enjoy.'"
@@ -0,0 +1,2 @@
1
+ run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js > public/javascripts/jquery.js"
2
+ run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
data/lib/beet.rb ADDED
@@ -0,0 +1,9 @@
1
+ # TODO similarly, figure out how to require things as needed by the template
2
+ require 'beet/execution'
3
+ require 'beet/file_system'
4
+ require 'beet/interaction'
5
+ require 'beet/logging'
6
+ require 'beet/capistrano'
7
+ require 'beet/rails'
8
+ require 'beet/scm'
9
+ require 'beet/executor'
data/spec/beet_spec.rb ADDED
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "beet" do
4
+ it "should do nothing" do
5
+ true.should == true
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec'
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ require 'beet'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jackdempsey-beet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Jack Dempsey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-20 00:00:00 -07:00
13
+ default_executable: beet
14
+ dependencies: []
15
+
16
+ description:
17
+ email: jack.dempsey@gmail.com
18
+ executables:
19
+ - beet
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.rdoc
25
+ files:
26
+ - LICENSE
27
+ - README.rdoc
28
+ - Rakefile
29
+ - TODO
30
+ - VERSION
31
+ - beet.gemspec
32
+ - bin/beet
33
+ - lib/beet.rb
34
+ - lib/beet/capistrano.rb
35
+ - lib/beet/execution.rb
36
+ - lib/beet/executor.rb
37
+ - lib/beet/file_system.rb
38
+ - lib/beet/interaction.rb
39
+ - lib/beet/logging.rb
40
+ - lib/beet/rails.rb
41
+ - lib/beet/scm.rb
42
+ - lib/beet/scm/git.rb
43
+ - lib/beet/scm/svn.rb
44
+ - lib/beet/templates/rails/clean_files.rb
45
+ - lib/beet/templates/rails/git.rb
46
+ - lib/beet/templates/rails/jquery.rb
47
+ - spec/beet_spec.rb
48
+ - spec/spec_helper.rb
49
+ has_rdoc: false
50
+ homepage: http://github.com/jackdempsey/beet
51
+ post_install_message:
52
+ rdoc_options:
53
+ - --charset=UTF-8
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.2.0
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: A gem to help with easily generating projects
75
+ test_files:
76
+ - spec/beet_spec.rb
77
+ - spec/spec_helper.rb