├── lib ├── quarry.yml ├── quarry │ ├── cli │ │ ├── save.rb │ │ ├── init.rb │ │ ├── update.rb │ │ ├── remove.rb │ │ ├── bank.rb │ │ ├── copy.rb │ │ ├── undo.rb │ │ ├── list.rb │ │ ├── help.rb │ │ ├── abstract.rb │ │ ├── new.rb │ │ └── ore.rb │ ├── error.rb │ ├── version.rb │ ├── template │ │ ├── script │ │ │ ├── extensions │ │ │ │ ├── dotruby.rb │ │ │ │ ├── color.rb │ │ │ │ ├── gemdo.rb │ │ │ │ └── logo.rb │ │ │ └── metadata.rb │ │ ├── readme.rb │ │ ├── context.rb │ │ ├── config.rb │ │ ├── directory.rb │ │ └── management.rb │ ├── core_ext.rb │ ├── cli.rb │ ├── config.rb │ ├── template.rb │ └── generator.rb └── quarry.rb ├── work ├── defunct │ ├── data │ │ └── quarry │ │ │ ├── hoe │ │ │ ├── bin │ │ │ │ └── __name__ │ │ │ ├── test │ │ │ │ └── test___name__.rb │ │ │ ├── lib │ │ │ │ └── __name__.rb │ │ │ ├── History.txt │ │ │ ├── Manifest.txt │ │ │ ├── Rakefile │ │ │ ├── .mine │ │ │ │ ├── copy.rb │ │ │ │ └── README │ │ │ └── README.txt │ │ │ └── gemdo │ │ │ ├── top │ │ │ ├── VERSION │ │ │ └── PROFILE │ │ │ ├── meta │ │ │ └── meta │ │ │ │ ├── package │ │ │ │ ├── profile │ │ │ │ └── data.rb │ │ │ ├── .seed │ │ │ ├── copy.rb │ │ │ └── README │ │ │ └── README │ ├── qed │ │ ├── 01_cli │ │ │ ├── applique │ │ │ │ ├── helpers.rb │ │ │ │ └── setup.rb │ │ │ ├── samples │ │ │ │ ├── foo_seed │ │ │ │ │ ├── foo.txt │ │ │ │ │ └── Sowfile │ │ │ │ └── sow_home │ │ │ │ │ └── bank │ │ │ │ │ └── seeds.repo.somehub.com │ │ │ │ │ ├── default │ │ │ │ │ ├── Sowfile │ │ │ │ │ ├── Sowfile.ronn │ │ │ │ │ ├── LICENSE │ │ │ │ │ └── README │ │ │ │ │ └── demo │ │ │ │ │ ├── Sowfile.ronn │ │ │ │ │ ├── Sowfile │ │ │ │ │ ├── README │ │ │ │ │ └── LICENSE │ │ │ ├── 04_help.rdoc │ │ │ ├── 02_silo.rdoc │ │ │ ├── 01_banks.rdoc │ │ │ └── 03_seed.rdoc │ │ └── 02_api │ │ │ ├── applique │ │ │ ├── helpers.rb │ │ │ ├── sources.rb │ │ │ └── layout.rb │ │ │ ├── miner.md │ │ │ └── layout.md │ └── mine │ │ └── version │ │ ├── template.yml │ │ └── lib │ │ └── quarry │ │ └── version.rb.erb ├── reference │ ├── seeds │ │ ├── bin │ │ │ ├── .meta │ │ │ │ ├── license │ │ │ │ ├── requires │ │ │ │ ├── version │ │ │ │ ├── package │ │ │ │ ├── title │ │ │ │ ├── description │ │ │ │ └── created │ │ │ ├── template │ │ │ │ └── bin │ │ │ │ │ └── command.rb │ │ │ └── SCRIPT.rb │ │ ├── aquaweb │ │ │ ├── template │ │ │ │ ├── cssink │ │ │ │ │ ├── font.css │ │ │ │ │ ├── color.css │ │ │ │ │ ├── reset.css │ │ │ │ │ ├── struct.css │ │ │ │ │ └── index.css │ │ │ │ ├── jquery │ │ │ │ │ ├── jquery.js │ │ │ │ │ ├── jquery-ui.js │ │ │ │ │ └── css │ │ │ │ │ │ └── ui-lightness │ │ │ │ │ │ └── images │ │ │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ │ │ ├── ui-icons_228ef1_256x240.png │ │ │ │ │ │ ├── ui-icons_ef8c08_256x240.png │ │ │ │ │ │ ├── ui-icons_ffd27a_256x240.png │ │ │ │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ │ │ │ ├── ui-bg_flat_10_000000_40x100.png │ │ │ │ │ │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ │ │ │ │ │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ │ │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ │ │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ │ │ │ │ │ ├── ui-bg_highlight-soft_75_ffe45c_1x100.png │ │ │ │ │ │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ │ │ │ │ │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ │ │ │ │ │ └── ui-bg_highlight-soft_100_eeeeee_1x100.png │ │ │ │ └── index.html │ │ │ └── USAGE.txt │ │ ├── monash │ │ │ ├── template │ │ │ │ ├── assets │ │ │ │ │ └── styles │ │ │ │ │ │ ├── color.css │ │ │ │ │ │ ├── font.css │ │ │ │ │ │ ├── reset.css │ │ │ │ │ │ ├── struct.css │ │ │ │ │ │ └── index.css │ │ │ │ └── index.html │ │ │ └── USAGE │ │ ├── website │ │ │ ├── template │ │ │ │ ├── assets │ │ │ │ │ ├── cssink │ │ │ │ │ │ ├── color.css │ │ │ │ │ │ ├── font.css │ │ │ │ │ │ ├── reset.css │ │ │ │ │ │ ├── struct.css │ │ │ │ │ │ └── index.css │ │ │ │ │ └── jquery │ │ │ │ │ │ ├── jquery.js │ │ │ │ │ │ ├── jquery-ui.js │ │ │ │ │ │ └── css │ │ │ │ │ │ └── ui-lightness │ │ │ │ │ │ └── images │ │ │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ │ │ ├── ui-icons_228ef1_256x240.png │ │ │ │ │ │ ├── ui-icons_ef8c08_256x240.png │ │ │ │ │ │ ├── ui-icons_ffd27a_256x240.png │ │ │ │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ │ │ │ ├── ui-bg_flat_10_000000_40x100.png │ │ │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ │ │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ │ │ │ │ │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ │ │ │ │ │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ │ │ │ │ │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ │ │ │ │ │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ │ │ │ │ │ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png │ │ │ │ │ │ └── ui-bg_highlight-soft_75_ffe45c_1x100.png │ │ │ │ └── index.html │ │ │ └── USAGE.txt │ │ ├── cucumber-feature │ │ │ ├── support │ │ │ │ ├── fs.rb │ │ │ │ ├── ae.rb │ │ │ │ ├── tmp.rb │ │ │ │ └── env.rb │ │ │ ├── __feature__.feature │ │ │ └── step_definitions │ │ │ │ └── common_steps.rb │ │ ├── testunit │ │ │ ├── COPY.yml │ │ │ ├── USAGE.txt │ │ │ ├── template │ │ │ │ ├── test │ │ │ │ │ └── test_template.rb │ │ │ │ └── form │ │ │ │ │ └── testunit │ │ │ ├── DATA.yml │ │ │ └── _SCRIPT.rb │ │ └── github │ │ │ └── MANIFEST.sow │ ├── test │ │ ├── features │ │ │ ├── step_definitions │ │ │ │ ├── cli_steps.rb │ │ │ │ └── fixture_steps.rb │ │ │ ├── scaffold.feature │ │ │ └── support │ │ │ │ └── env.rb │ │ └── cucumber.yml │ ├── mint │ │ ├── bin │ │ │ └── mint │ │ ├── .gitignore │ │ ├── README │ │ ├── test │ │ │ └── fixtures │ │ │ │ ├── tryme.rb │ │ │ │ └── loremipsum.txt │ │ ├── work │ │ │ └── deprecated │ │ │ │ ├── command-old.rb │ │ │ │ ├── lazyfile.rb │ │ │ │ └── mint.xml │ │ ├── LICENSE │ │ ├── lib │ │ │ └── mint │ │ │ │ ├── command.rb │ │ │ │ └── generators │ │ │ │ ├── update.rb │ │ │ │ ├── delete.rb │ │ │ │ └── create.rb │ │ └── site │ │ │ └── cp-m.xml │ ├── fnctl.rb │ ├── directory.rb │ └── hoe ├── TODO ├── notes │ ├── 2012-03-04-copy-types.rdoc │ ├── 2010-06-03-cli-and-destination.rdoc │ └── 2009-08-30-cli-and-plugins.rdoc ├── consider │ └── quarry.rb └── quickstart.rdoc ├── data └── quarry │ ├── cucumber │ ├── 0RE │ │ ├── config.yml │ │ ├── copy.rb │ │ └── README │ ├── features │ │ ├── support │ │ │ ├── env.rb │ │ │ └── ae.rb │ │ └── step_definitions │ │ │ └── common_steps.rb │ └── mine │ │ └── feature.cucumber │ │ ├── features │ │ └── [feature_name].feature │ │ └── 0RE │ │ ├── copy.rb │ │ └── README │ ├── license │ ├── 0RE │ │ ├── config.yml │ │ ├── copy.rb │ │ └── README │ ├── mit │ │ └── LICENSE │ └── lgpl │ │ └── COPYING.LESSER │ ├── readme │ ├── 0RE │ │ ├── config.yml │ │ ├── copy.rb │ │ └── README │ ├── README.md.erb │ ├── README.tt.erb │ └── README.rdoc.erb │ └── ruby │ ├── 0RE │ ├── config.yml │ ├── README │ └── copy.rb │ ├── Rakefile │ ├── lib │ └── [name].rb.erb │ ├── bin │ └── [name].erb │ ├── HISTORY.md.erb │ └── README.md.erb ├── bin └── quarry ├── .gitignore ├── test ├── fixtures │ └── home │ │ └── templates │ │ └── example │ │ ├── example.txt.erb │ │ └── 0RE │ │ └── README ├── helper.rb ├── samples │ └── source │ │ └── README ├── case_management.rb └── case_copier.rb ├── mine └── testcase │ ├── 0RE │ ├── copy.rb │ └── README │ └── test │ └── case_[case_name].rb.erb ├── HISTORY.rdoc ├── .test ├── man └── man1 │ ├── quarry.1.ronn │ ├── quarry.1 │ └── quarry.1.html ├── Assembly ├── Index.yml ├── .index ├── COPYING.rdoc ├── MANIFEST ├── .gemspec └── README.rdoc /lib/quarry.yml: -------------------------------------------------------------------------------- 1 | ../.index -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/bin/__name__: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/quarry/cucumber/0RE/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | -------------------------------------------------------------------------------- /data/quarry/license/0RE/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | -------------------------------------------------------------------------------- /data/quarry/readme/0RE/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | -------------------------------------------------------------------------------- /data/quarry/ruby/0RE/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/applique/helpers.rb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/.meta/license: -------------------------------------------------------------------------------- 1 | GPL 2 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/.meta/requires: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/.meta/version: -------------------------------------------------------------------------------- 1 | 1.0.0 2 | -------------------------------------------------------------------------------- /work/defunct/mine/version/template.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/cssink/font.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/quarry/ruby/Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/test/test___name__.rb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/cssink/color.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/cssink/reset.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/cssink/struct.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/.meta/package: -------------------------------------------------------------------------------- 1 | <%= package %> 2 | -------------------------------------------------------------------------------- /work/reference/test/features/step_definitions/cli_steps.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/monash/template/assets/styles/color.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/monash/template/assets/styles/font.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/monash/template/assets/styles/reset.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/monash/template/assets/styles/struct.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/cssink/color.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/cssink/font.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/cssink/reset.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/cssink/struct.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/.meta/title: -------------------------------------------------------------------------------- 1 | <%= package.capitalize %> 2 | -------------------------------------------------------------------------------- /work/reference/seeds/cucumber-feature/support/fs.rb: -------------------------------------------------------------------------------- 1 | include FileUtils 2 | -------------------------------------------------------------------------------- /bin/quarry: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'quarry' 3 | Quarry.cli(*ARGV) 4 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/foo_seed/foo.txt: -------------------------------------------------------------------------------- 1 | Just some random text. 2 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/jquery.js: -------------------------------------------------------------------------------- 1 | js/jquery-1.3.2.min.js -------------------------------------------------------------------------------- /work/reference/seeds/bin/.meta/description: -------------------------------------------------------------------------------- 1 | <%= package %> is a __FIX__. 2 | -------------------------------------------------------------------------------- /work/defunct/qed/02_api/applique/helpers.rb: -------------------------------------------------------------------------------- 1 | require 'facets/kernel/silence' 2 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/.meta/created: -------------------------------------------------------------------------------- 1 | <%= Time.now.strftime("%Y-%M-%D") %> 2 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/jquery.js: -------------------------------------------------------------------------------- 1 | js/jquery-1.3.2.min.js -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | log 3 | pkg 4 | ri 5 | tmp 6 | site/docs 7 | work/sandbox 8 | web -------------------------------------------------------------------------------- /work/reference/seeds/website/USAGE.txt: -------------------------------------------------------------------------------- 1 | This is an expiremental website template. 2 | -------------------------------------------------------------------------------- /data/quarry/ruby/lib/[name].rb.erb: -------------------------------------------------------------------------------- 1 | module <%= title %> 2 | # start coding ... 3 | end 4 | -------------------------------------------------------------------------------- /test/fixtures/home/templates/example/example.txt.erb: -------------------------------------------------------------------------------- 1 | This is the tilte: <%= title %>. 2 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/foo_seed/Sowfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | copy '*' 4 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/jquery-ui.js: -------------------------------------------------------------------------------- 1 | js/jquery-ui-1.7.2.custom.min.js -------------------------------------------------------------------------------- /data/quarry/cucumber/features/support/env.rb: -------------------------------------------------------------------------------- 1 | #require 'fileutils' 2 | #require 'tmpdir' 3 | 4 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/jquery-ui.js: -------------------------------------------------------------------------------- 1 | js/jquery-ui-1.7.2.custom.min.js -------------------------------------------------------------------------------- /mine/testcase/0RE/copy.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | argument :case_name 4 | 5 | copy all 6 | 7 | -------------------------------------------------------------------------------- /test/helper.rb: -------------------------------------------------------------------------------- 1 | ENV['QUARRY_HOME'] = File.dirname(__FILE__) + '/fixtures/home' 2 | 3 | require 'quarry' 4 | 5 | -------------------------------------------------------------------------------- /work/reference/mint/bin/mint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'mint/command' 3 | Mint::Command.main(*ARGV) 4 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/lib/__name__.rb: -------------------------------------------------------------------------------- 1 | class <%= unixname.capitalize %> 2 | VERSION = '1.0.0' 3 | end 4 | 5 | -------------------------------------------------------------------------------- /work/defunct/mine/version/lib/quarry/version.rb.erb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | VERSION = "<%= project.version %>" 3 | end 4 | -------------------------------------------------------------------------------- /data/quarry/ruby/bin/[name].erb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require '<%= name %>' 3 | <%= name.capitalize %>.cli(*ARGV) 4 | 5 | -------------------------------------------------------------------------------- /work/reference/mint/.gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | log 3 | doc/rdoc 4 | doc/ri 5 | pkg 6 | site/log 7 | work/sandbox 8 | MANIFEST 9 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/cssink/index.css: -------------------------------------------------------------------------------- 1 | @import reset.css 2 | @import struct.css 3 | @import font.css 4 | @import color.css 5 | -------------------------------------------------------------------------------- /work/reference/seeds/monash/template/assets/styles/index.css: -------------------------------------------------------------------------------- 1 | @import reset.css 2 | @import struct.css 3 | @import font.css 4 | @import color.css 5 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/cssink/index.css: -------------------------------------------------------------------------------- 1 | @import reset.css 2 | @import struct.css 3 | @import font.css 4 | @import color.css 5 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/History.txt: -------------------------------------------------------------------------------- 1 | === 1.0.0 / <%= Time.new.strftime("%Y-%m-%d") %> 2 | 3 | * 1 major enhancement 4 | 5 | * Birthday! 6 | 7 | 8 | -------------------------------------------------------------------------------- /data/quarry/cucumber/features/step_definitions/common_steps.rb: -------------------------------------------------------------------------------- 1 | #Given /^$/ do || 2 | #end 3 | 4 | #When /^$/ do || 5 | #end 6 | 7 | #Then /^$/ do || 8 | #end 9 | 10 | -------------------------------------------------------------------------------- /data/quarry/cucumber/features/support/ae.rb: -------------------------------------------------------------------------------- 1 | # Use Assertive Expressive 2 | begin 3 | require 'ae' 4 | require 'ae/should' 5 | rescue LoadError 6 | # no AE 7 | end 8 | 9 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/Sowfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | argument :name, :default => 'anonymous' 4 | 5 | copy '**/*' 6 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | Manifest.txt 3 | README.txt 4 | Rakefile 5 | bin/<%= name %> 6 | lib/<%= name %>.rb 7 | test/test_<%= name %>.rb 8 | 9 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/Sowfile.ronn: -------------------------------------------------------------------------------- 1 | Sample seed will create a sample project layout 2 | suitable for testing by Sow's test suite. -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/Sowfile.ronn: -------------------------------------------------------------------------------- 1 | Sample seed will create a sample project layout 2 | suitable for testing by Sow's test suite. -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/top/VERSION: -------------------------------------------------------------------------------- 1 | name : <%= name %> 2 | date : <%= Time.now.strftime('%Y-%m-%d') %> 3 | version : 0.0.1 4 | 5 | requires: 6 | - gemdo (build) 7 | 8 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/meta/meta/package: -------------------------------------------------------------------------------- 1 | name : <%= name %> 2 | date : <%= Time.now.strftime('%Y-%m-%d') %> 3 | version : 0.0.1 4 | 5 | requires: 6 | - gemdo (build) 7 | 8 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/Sowfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | argument :name, :default => 'anonymous' 4 | 5 | copy '*', :render=>'erb' 6 | 7 | -------------------------------------------------------------------------------- /mine/testcase/0RE/README: -------------------------------------------------------------------------------- 1 | # quarry mine/testcase 2 | 3 | ## SYNOPSIS 4 | 5 | `quarry mine/testcase ` 6 | 7 | ## DESCRIPTION 8 | 9 | Create a simple test case skeleton. 10 | 11 | -------------------------------------------------------------------------------- /work/reference/seeds/cucumber-feature/support/ae.rb: -------------------------------------------------------------------------------- 1 | # Use Assertive Expressive 2 | begin 3 | require 'ae' 4 | require 'ae/expect' 5 | require 'ae/should' 6 | rescue LoadError 7 | # no AE 8 | end 9 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/README: -------------------------------------------------------------------------------- 1 | Welcome to <%= name %>. 2 | 3 | FIXME: Describe you project here. 4 | 5 | Copyright (c) <%= Time.now.strftime('%Y') %> <%= name %> -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/LICENSE: -------------------------------------------------------------------------------- 1 | Pancake License 2 | 3 | You can do whatever the hell you want with this software 4 | just so long as lawyers do not become involved. -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/README: -------------------------------------------------------------------------------- 1 | Welcome to <%= name %>. 2 | 3 | FIXME: Describe you project here. 4 | 5 | Copyright (c) <%= Time.now.strftime('%Y') %> <%= name %> -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/LICENSE: -------------------------------------------------------------------------------- 1 | Pancake License 2 | 3 | You can do whatever the hell you want with this software 4 | just so long as lawyers do not become involved. -------------------------------------------------------------------------------- /work/reference/test/cucumber.yml: -------------------------------------------------------------------------------- 1 | default : --format progress test/features 2 | debug : --format pretty test/features 3 | log : --format progress --format html --out=log/cucumber/index.html test/features 4 | 5 | -------------------------------------------------------------------------------- /work/TODO: -------------------------------------------------------------------------------- 1 | = TODO List 2 | 3 | == Partial Scaffolding 4 | 5 | Can scaffolds support partial scaffolding? For instance how might 6 | we scaffold just the Rakefile of the `ruby` template? 7 | 8 | $ sow ruby/Rakefile 9 | 10 | -------------------------------------------------------------------------------- /test/samples/source/README: -------------------------------------------------------------------------------- 1 | This is a fake project, for Sow to run tests on. 2 | While using a FileMock would probably be a better 3 | approach, at the moment it is easier to get some 4 | tests in here based on a simple mock project. 5 | 6 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_228ef1_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_228ef1_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_ef8c08_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_ef8c08_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_ffd27a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_ffd27a_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /work/defunct/qed/02_api/applique/sources.rb: -------------------------------------------------------------------------------- 1 | require 'sow/manager' 2 | Sow::Manager.instance_eval do 3 | @bank_folder = Pathname.new(File.expand_path('tmp/qed/bank')) 4 | @silo_folder = Pathname.new(File.expand_path('tmp/qed/silo')) 5 | end 6 | 7 | -------------------------------------------------------------------------------- /mine/testcase/test/case_[case_name].rb.erb: -------------------------------------------------------------------------------- 1 | covers "<%= case_name %>" 2 | 3 | test_case <% case_name.capitalize %> do 4 | 5 | method :some_method do 6 | 7 | test 'describe test' do 8 | 9 | end 10 | 11 | end 12 | 13 | end 14 | 15 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_228ef1_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_228ef1_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_ef8c08_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_ef8c08_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_ffd27a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_ffd27a_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/aquaweb/template/jquery/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png -------------------------------------------------------------------------------- /work/reference/seeds/monash/USAGE: -------------------------------------------------------------------------------- 1 | The monash seed is website layout based on the Monash University 2 | Web Style Guide. This style uses an assets/ directory for 3 | images, styles, scripts, includes, etc. 4 | 5 | See: http://www.monash.edu.au/staff/web/pages/file-names.html 6 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png -------------------------------------------------------------------------------- /work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyworks/quarry/master/work/reference/seeds/website/template/assets/jquery/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png -------------------------------------------------------------------------------- /work/notes/2012-03-04-copy-types.rdoc: -------------------------------------------------------------------------------- 1 | There a six different "copy" functions: 2 | 3 | * copy, but if present ignore 4 | * copy, and if present overwrite 5 | * append, if not present write 6 | * append, if not present ignore 7 | * merge, if not present write 8 | * merge, if not present ignore 9 | 10 | -------------------------------------------------------------------------------- /work/reference/seeds/testunit/COPY.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - from : test 3 | to : <%= test_dir %> 4 | 5 | - from : form/testunit 6 | to : <%= form_dir %>/testunit 7 | chmod: 0754 8 | 9 | - from : test/test_template.rb 10 | to : <%= test_dir %>/test_<%= test_name %>.rb 11 | if : name 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/home/templates/example/0RE/README: -------------------------------------------------------------------------------- 1 | # quarry-example - an example template 2 | 3 | ## SYNOPSIS 4 | 5 | `quarry-example` 6 | 7 | ## DESCRIPTION 8 | 9 | This is an example template. 10 | 11 | ## COPYRIGHT 12 | 13 | Copyright (c) 2012 Rubyworks. 14 | 15 | ## SEE ALSO 16 | 17 | quarry(1) 18 | -------------------------------------------------------------------------------- /HISTORY.rdoc: -------------------------------------------------------------------------------- 1 | = RELEASE HISTORY 2 | 3 | == 1.0.0 // 2009-08-30 4 | 5 | Initial release of brand spanking new system. 6 | 7 | Changes: 8 | 9 | * 3 Major Enhancements 10 | 11 | * Use spiffy new interface design. 12 | * Promotes the use of "micro" plugins. 13 | * Added new built-in plugins. 14 | 15 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/USAGE.txt: -------------------------------------------------------------------------------- 1 | Website directory structure design based on the concept of aquasition. 2 | Assets are stored in the directory where they are used. If an assest 3 | is shared it ise move up the directory hierarchy until it reaches the 4 | common parent directory between the files sharing the resource. 5 | -------------------------------------------------------------------------------- /work/reference/seeds/testunit/USAGE.txt: -------------------------------------------------------------------------------- 1 | Generate Test::Unit Scaffolding 2 | 3 | Usage: 4 | --testunit 5 | --testunit.dir= 6 | --testunit.name= 7 | 8 | Generates scaffolding for using Test::Unit in your 9 | Ruby project. If a test name is given will also 10 | template a test by that name. 11 | 12 | -------------------------------------------------------------------------------- /work/reference/seeds/monash/template/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= name.capitalize %> 4 | 5 | 6 | 7 |
8 | 9 |

<%= name %>

10 | 11 |

Welcome to you new website

12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /data/quarry/license/0RE/copy.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | licenses = %w{apache gpl lpgl mit ruby} 4 | 5 | argument :license 6 | 7 | if data.license && (template.path + data.license).directory? 8 | copy '*', :from=>data.license 9 | else 10 | abort "License not found -- #{data.license}. Try:\n " + licenses.join("\n ") 11 | end 12 | 13 | -------------------------------------------------------------------------------- /work/reference/seeds/testunit/template/test/test_template.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/test_helper' 2 | 3 | class Test<%= class_name %> < Test::Unit::TestCase 4 | def setup 5 | end 6 | 7 | def teardown 8 | end 9 | 10 | # Replace this with your real tests. 11 | def test_truth 12 | assert true 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /.test: -------------------------------------------------------------------------------- 1 | require 'lemon' 2 | require 'ae' 3 | require './test/helper' 4 | 5 | Test.run(:default) do |run| 6 | run.files << 'test/case_*.rb' 7 | end 8 | 9 | Test.run(:cov) do |run| 10 | require 'lemon' 11 | require 'ae' 12 | 13 | run.files << 'test/case_*.rb' 14 | SimpleCov.start do |cov| 15 | cov.coverage_dir = 'log/coverage' 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /data/quarry/readme/0RE/copy.rb: -------------------------------------------------------------------------------- 1 | case config.markup 2 | when 'textile' 3 | render 'README.tt.erb', 'README.textile' 4 | when 'tt' 5 | render 'README.tt.erb' 6 | when 'rdoc' 7 | render 'README.rdoc.erb' 8 | when 'markdown' 9 | render 'README.md.erb', 'README.markdown' 10 | when 'md' 11 | render 'README.md.erb' 12 | else 13 | render 'README.rdoc.erb' # or markdown ? 14 | end 15 | 16 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/Rakefile: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | 3 | require 'rubygems' 4 | require 'hoe' 5 | require './lib/<%= unixname %>.rb' 6 | 7 | Hoe.new('<%= unixname %>', <%= unixname.capitalize %>::VERSION) do |p| 8 | # p.rubyforge_name = '<%= unixname %>' # if different than lowercase project name 9 | # p.developer('FIX', 'FIX@example.com') 10 | end 11 | 12 | # vim: syntax=Ruby 13 | 14 | -------------------------------------------------------------------------------- /work/reference/mint/README: -------------------------------------------------------------------------------- 1 | = Mint 2 | 3 | Mint is a manged copy tool. It's a low-level utility 4 | for copy a set of files from one location to another 5 | in a highly managed way. 6 | 7 | * http://proutils.github.com/mint 8 | * http://github.com/proutils/mint 9 | 10 | == SYNOPSIS 11 | 12 | $ mint src/ dest/ 13 | 14 | 15 | == COPYRIGHT 16 | 17 | Copyright (c) 2008 Thomas Sawyer 18 | 19 | -------------------------------------------------------------------------------- /work/reference/seeds/cucumber-feature/support/tmp.rb: -------------------------------------------------------------------------------- 1 | require 'tmpdir' 2 | 3 | $TEMP_DIR = File.join(Dir.tmpdir, "cucumber", File.basename($PROJECT_ROOT)) 4 | 5 | puts "[$TEMP_DIR] #{$TEMP_DIR}" 6 | 7 | Before do 8 | FileUtils.rm_rf $TEMP_DIR 9 | FileUtils.mkdir_p $TEMP_DIR 10 | end 11 | 12 | def in_temporary_directory(&block) 13 | Dir.chdir($TEMP_DIR) do 14 | block.call 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /work/reference/seeds/cucumber-feature/__feature__.feature: -------------------------------------------------------------------------------- 1 | Feature: Your Feature Title 2 | 3 | FIXME: As a (something) I want to (do something) 4 | So that I can (achieve some goal) 5 | 6 | Scenario: Your Scenario Title 7 | Given I have (something) 8 | And I have (something else) 9 | When I do (somthing) 10 | And I do (something else) 11 | Then I get (something) 12 | And (something else) 13 | 14 | -------------------------------------------------------------------------------- /man/man1/quarry.1.ronn: -------------------------------------------------------------------------------- 1 | sow-new(1) -- germinate a new seed 2 | ================================== 3 | 4 | ## SYNOPSIS 5 | 6 | `sow new` [...] 7 | 8 | ## DESCRIPTION 9 | 10 | Germinate a new seed. 11 | 12 | ## OPTIONS 13 | 14 | These options control whether output is written to file(s). 15 | 16 | * `-f`, `--force`: 17 | Force overwrites of any destination files that already exist. 18 | 19 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/template/bin/command.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # Created <%= "by #{author} " if author %>on <%= (now = Time.now).year %>-<%= now.month %>-<%= now.day %>. 4 | # Copyright (c) <%= now.year %>. All rights reserved. 5 | # 6 | # TODO: write executable 7 | # 8 | # It might be something like the following. 9 | 10 | require '<%= package %>/command.rb' 11 | <%= title %>::Command.execute 12 | 13 | -------------------------------------------------------------------------------- /data/quarry/cucumber/mine/feature.cucumber/features/[feature_name].feature: -------------------------------------------------------------------------------- 1 | Feature: Your Feature Title 2 | 3 | As a (something) I want to (do something) 4 | So that I can (achieve some goal) 5 | 6 | Scenario: Your Scenario Title 7 | Given I have (something) 8 | And I have (something else) 9 | When I do (somthing) 10 | And I do (something else) 11 | Then I get (something) 12 | And (something else) 13 | 14 | -------------------------------------------------------------------------------- /data/quarry/cucumber/0RE/copy.rb: -------------------------------------------------------------------------------- 1 | # TODO: add starter cucumber.yaml config file 2 | 3 | argument :features_directory 4 | 5 | # if directory is not set by argument, then try to figure it out, 6 | # else fallback to `features`. 7 | let :features_directory do 8 | file = output.glob('*/*.feature').first 9 | file ? File.dirname(file) : 'features' 10 | end 11 | 12 | copy "mine/*", :verbatim=>true 13 | copy "features", features_directory 14 | 15 | -------------------------------------------------------------------------------- /lib/quarry/cli/save.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | class Save < Abstract 6 | 7 | command 'save' 8 | 9 | # 10 | def call(argv) 11 | Quarry.save(*argv) 12 | end 13 | 14 | # 15 | def opts 16 | super do |o| 17 | o.banner = "Usage: quarry save [file ...]" 18 | o.separator "Save directory/files to named mine." 19 | end 20 | end 21 | 22 | end 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /data/quarry/cucumber/mine/feature.cucumber/0RE/copy.rb: -------------------------------------------------------------------------------- 1 | argument :feature_name 2 | argument :features_directory 3 | 4 | # if directory is not set by argument, then try to figure it out, 5 | # else fallback to `features`. 6 | let :features_directory do 7 | file = output.glob('*/*.feature').first 8 | file ? File.dirname(file) : 'features' 9 | end 10 | 11 | raise "Feature name is a required argument." unless feature_name 12 | 13 | copy 'features', feature_directory 14 | 15 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/top/PROFILE: -------------------------------------------------------------------------------- 1 | title : <%= name.capitalize %> 2 | summary: <%= summary %> # one-line description 3 | contact: <%= contact %> # name 4 | created: <%= Time.now %> 5 | 6 | authors: 7 | - <%= author %> 8 | 9 | description: 10 | ___describe your project here___ 11 | 12 | resources: 13 | homepage : <%= homepage %> 14 | repository: <%= repository %> 15 | 16 | copyright: 17 | Copyright (c) <%= Time.now.strftime('%Y') %> <%= author %> 18 | 19 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/meta/meta/profile: -------------------------------------------------------------------------------- 1 | title : <%= name.capitalize %> 2 | summary: <%= summary %> # one-line description 3 | contact: <%= contact %> # name 4 | created: <%= Time.now %> 5 | 6 | authors: 7 | - <%= author %> 8 | 9 | description: 10 | ___describe your project here___ 11 | 12 | resources: 13 | homepage : <%= homepage %> 14 | repository: <%= repository %> 15 | 16 | copyright: 17 | Copyright (c) <%= Time.now.strftime('%Y') %> <%= author %> 18 | 19 | -------------------------------------------------------------------------------- /work/reference/seeds/bin/SCRIPT.rb: -------------------------------------------------------------------------------- 1 | module Sow::Plugins 2 | 3 | # Scaffold a ruby bin/ file. 4 | # 5 | class Bin < Script 6 | 7 | option :name 8 | 9 | setup do 10 | @name = argument || destination 11 | abort "Exectuable name is required." unless name 12 | abort "Executable name must be a single word." if /\w/ !~ name 13 | end 14 | 15 | manifest do 16 | copy 'bin/command.rb', "bin/#{@name}", :chmod => 0754 17 | end 18 | 19 | end 20 | 21 | end 22 | 23 | -------------------------------------------------------------------------------- /work/reference/seeds/testunit/DATA.yml: -------------------------------------------------------------------------------- 1 | # Test::Unit Template 2 | 3 | validate: 4 | abort "Test name must ba a single word" if name =~ /\s+/ 5 | 6 | name: 7 | options['name'] || metadata.package 8 | 9 | test_dir: 10 | argument #dir if dir 11 | 12 | class_name: 13 | name.modulize if name 14 | 15 | test_name: 16 | name.pathize if name 17 | 18 | test_dir: 19 | (Dir['{test/unit,test}/'].first || 'test').chomp('/') 20 | 21 | form_dir: 22 | (Dir['{form{,s}/'].first || 'form/').chomp('/') 23 | 24 | -------------------------------------------------------------------------------- /lib/quarry/cli/init.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | # 6 | class Init < Abstract 7 | 8 | command 'init' 9 | 10 | # 11 | def call(argv) 12 | output = options.output || Dir.pwd 13 | Quarry.init(output) 14 | end 15 | 16 | # 17 | def opts 18 | super do |o| 19 | o.banner = "Usage: quarry init" 20 | o.on('--output', '-o PATH'){ |path| options.output = path } 21 | end 22 | end 23 | 24 | end 25 | 26 | end 27 | 28 | -------------------------------------------------------------------------------- /work/reference/mint/test/fixtures/tryme.rb: -------------------------------------------------------------------------------- 1 | # Foo classes are powerful stuff. 2 | 3 | class Foo 4 | 5 | # This is the infamous Foo#bar method. 6 | # 7 | def bar 8 | "FOOBAR!!!" 9 | end 10 | 11 | end 12 | 13 | 14 | =begin demo 15 | 16 | puts Foo.bar.new 17 | 18 | =end 19 | 20 | 21 | =begin test 22 | 23 | require 'test/unit' 24 | 25 | class TestThis < Test::Unit::TestCase 26 | 27 | def test_foo 28 | assert_equal("FOOBAR!!!", Foo.new.bar) 29 | end 30 | 31 | end 32 | 33 | =end 34 | -------------------------------------------------------------------------------- /work/reference/fnctl.rb: -------------------------------------------------------------------------------- 1 | require 'fcntl' 2 | require 'facets/string/tabto' 3 | 4 | opts.on('--extend', '-x', 'output copylist') do 5 | @action = :print 6 | end 7 | 8 | 9 | # If an optional copylist is padded in via a stdin or a pipe. 10 | def extended_copylist 11 | list = [] 12 | if STDIN.fcntl(Fcntl::F_GETFL, 0) == 0 13 | val = STDIN.read 14 | if !val.empty? 15 | list = YAML.load(val) 16 | end 17 | end 18 | list 19 | end 20 | 21 | -------------------------------------------------------------------------------- /work/reference/seeds/cucumber-feature/support/env.rb: -------------------------------------------------------------------------------- 1 | 2 | __DIR__ = File.dirname(__FILE__) 3 | 4 | require __DIR__ + '/ae' 5 | require __DIR__ + '/tmp' 6 | require __DIR__ + '/fs' 7 | 8 | $PROJECT_ROOT = ( 9 | dir = File.dirname(__FILE__) 10 | until Dir[dir + '/README*'].first do 11 | dir = File.expand_path(File.join(dir, '..')) 12 | end 13 | raise "no project root" unless dir 14 | dir 15 | ) 16 | 17 | def in_project_directory(*name, &block) 18 | Dir.chdir(File.join($TEMP_DIR, *name)) do 19 | block.call 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /work/reference/seeds/testunit/template/form/testunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'fileutils' 4 | 5 | force = ARGV.delete('-f') || ARGV.delete('--force') 6 | name = ARGV.first 7 | file = "test/test_#{name}" 8 | 9 | content = <<-END 10 | require 'test_helper.rb' 11 | 12 | class TC_#{name} < Test::Unit::TestCase 13 | def test_#{name} 14 | end 15 | end 16 | END 17 | 18 | if File.exist?(file) && !force 19 | puts "overwrite -- #{file}" 20 | else 21 | mkdir_p("test") 22 | File.open("test/test_#{name}", 'w'){ |f| f << content } 23 | end 24 | 25 | -------------------------------------------------------------------------------- /man/man1/quarry.1: -------------------------------------------------------------------------------- 1 | .\" generated with Ronn/v0.7.3 2 | .\" http://github.com/rtomayko/ronn/tree/0.7.3 3 | . 4 | .TH "SOW\-NEW" "1" "October 2010" "RubyWorks" "" 5 | . 6 | .SH "NAME" 7 | \fBsow\-new\fR \- germinate a new seed 8 | . 9 | .SH "SYNOPSIS" 10 | \fBsow new\fR \fIpath\fR \fIname\fR [\fIargs\fR\.\.\.] 11 | . 12 | .SH "DESCRIPTION" 13 | Germinate a new seed\. 14 | . 15 | .SH "OPTIONS" 16 | These options control whether output is written to file(s)\. 17 | . 18 | .TP 19 | \fB\-f\fR, \fB\-\-force\fR 20 | Force overwrites of any destination files that already exist\. 21 | 22 | -------------------------------------------------------------------------------- /lib/quarry/cli/update.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | # Update a scm-based mine. 6 | # 7 | class Update < Abstract 8 | 9 | command 'update' 10 | 11 | # 12 | def call(argv) 13 | if trial? 14 | $stderr.puts("Dryrun: cd #{path}; scm #{pull}") 15 | else 16 | name = argv.first 17 | manager.update(name) 18 | end 19 | end 20 | 21 | # 22 | def opts 23 | super do |o| 24 | o.banner = "Usage: quarry update [name]" 25 | end 26 | end 27 | 28 | end 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /Assembly: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | qedoc: 4 | files: qed/**/*.md 5 | title: Qaurry Demonstrations 6 | output: 7 | - DEMO.md 8 | #- web/demo.html 9 | 10 | dnote: 11 | labels: ~ 12 | output: log/notes.html 13 | 14 | locat: 15 | output: log/locat.html 16 | 17 | vclog: 18 | service: VClog 19 | output: 20 | - log/changes.html 21 | - log/history.html 22 | 23 | github: 24 | gh_pages: web 25 | 26 | gem: 27 | active: true 28 | 29 | email: 30 | file : ~ 31 | subject : ~ 32 | mailto : 33 | - ruby-talk@ruby-lang.org 34 | - rubyworks-mailinglist@googlegroups.com 35 | 36 | -------------------------------------------------------------------------------- /data/quarry/readme/0RE/README: -------------------------------------------------------------------------------- 1 | quarry-readme(1) - generate starter README file 2 | =============================================== 3 | 4 | ## SYNOPSIS 5 | 6 | `quarry readme` 7 | 8 | ## DESCRIPTION 9 | 10 | Generate a starter README file for a project. This seed utilizes 11 | project metadata, if available, to fill out the README more 12 | extensively. 13 | 14 | The README can be in either RDoc, Markdown or Textitle format, 15 | depending on the project's or user's `markup` config setting. 16 | 17 | ## COPYRIGHT 18 | 19 | Copyright (c) 2010 Rubyworks 20 | 21 | ## SEE ALSO 22 | 23 | quarry(1) 24 | 25 | -------------------------------------------------------------------------------- /work/reference/test/features/scaffold.feature: -------------------------------------------------------------------------------- 1 | Feature: Scaffold new projects 2 | 3 | As a developer I want to quickly scaffold new projects 4 | So that I can skip the tedium of recreating standard directory structures 5 | 6 | Scenario: Scaffold a new project 7 | Given I want to create a new "ruby" project 8 | And I want the project to be called "new_project" 9 | And I want to place it in a directory with the same name 10 | Given there is no project directory by that name 11 | When I execute sow 12 | Then a standard ruby project will be generated 13 | And with the proper project name 14 | -------------------------------------------------------------------------------- /lib/quarry/error.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | 3 | # Mix this in with raised errors. 4 | module Error 5 | def self.exception(err,msg=nil) 6 | case err 7 | when String 8 | msg = err 9 | err = ($! || RuntimeError) 10 | when Class 11 | raise ArgumentError unless err < Exception 12 | err = err.new(msg) 13 | end 14 | err.extend self 15 | err 16 | end 17 | end 18 | 19 | class ArgumentError < ::ArgumentError 20 | include Error 21 | end 22 | 23 | # 24 | class MissingTemplate < ArgumentError 25 | end 26 | 27 | # 28 | class DuplicateTemplate < ArgumentError 29 | end 30 | 31 | end 32 | -------------------------------------------------------------------------------- /data/quarry/license/0RE/README: -------------------------------------------------------------------------------- 1 | quarry-license(1) - provide a license file 2 | ========================================== 3 | 4 | ## SYNOPSIS 5 | 6 | `quarry license ` 7 | 8 | ## DESCRIPTION 9 | 10 | Add a specified license to your project. Usually the file created 11 | is called `LICENSE`. But the `gpl` license uses `COPYING` instead. 12 | The `apache` license also provides a `NOTICE` file. 13 | 14 | Available licenses inclide `mit`, `lgpl`, `bsd`, and so on. 15 | 16 | If no license name is given, a list of available licenses will be 17 | shown. 18 | 19 | ## COPYRIGHT 20 | 21 | Copyright (c) Thomas Sawyer 2010 22 | 23 | ## SEE ALSO 24 | 25 | quarry(1) 26 | 27 | -------------------------------------------------------------------------------- /data/quarry/ruby/HISTORY.md.erb: -------------------------------------------------------------------------------- 1 | == ChangeLog 2 | 3 | == 0.0.0 // 2008-03-04 4 | 5 | * Started project. 6 | 7 | 8 | # Keep a running list of changes by version and date here. 9 | # This is uploaded as the ChangeLog in the release process. 10 | # It's better to keep a manual log, rather then use the log 11 | # generated by the SCM because the SCM log will have gritty 12 | # details with which end-users will not be concerned. 13 | # 14 | # If you want to use the SCM log anyway, you can of course 15 | # do so. Just "cp log/Changelog.txt CHANGES" prior to release. 16 | # (We might provide an automated option for this in the 17 | # future, but for now its a manual task.) 18 | 19 | -------------------------------------------------------------------------------- /data/quarry/ruby/0RE/README: -------------------------------------------------------------------------------- 1 | quarry-basic-ruby(1) - create a basic Ruby project layout 2 | ========================================================= 3 | 4 | ## SYNOPSIS 5 | 6 | `sow basic.ruby ` 7 | 8 | ## DESCRIPTION 9 | 10 | Traditional Ruby project scaffolding. This provides the common structure 11 | for a standard Ruby project. This seed takes a single argument for the 12 | project's name. The name must a single alphanumeric word --what is often 13 | called a "unixname". If the name is not given the basename of the destination 14 | directory will be used. 15 | 16 | ## COPYRIGHT 17 | 18 | Copyright (c) 2010 Thomas Sawyer 19 | 20 | ## SEE ALSO 21 | 22 | quarry(1) 23 | -------------------------------------------------------------------------------- /work/reference/seeds/aquaweb/template/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= name.capitalize %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 |
20 | 21 |

<%= name %>

22 | 23 |

Welcome to your new website!

24 | 25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /data/quarry/ruby/0RE/copy.rb: -------------------------------------------------------------------------------- 1 | #utilize 'pom' 2 | 3 | #ensure_empty('PROFILE', 'VERSION') 4 | 5 | #argument :name, :default => File.basename(output).chomp('/') 6 | 7 | data.name ||= File.basename(output).chomp('/') 8 | 9 | #let :name, destname 10 | 11 | raise "Name is required." unless data.name 12 | raise "Name must be single word." unless data.name =~ /\w+/ 13 | 14 | #metadata.name = name # TODO 15 | data.title = data.title || data.name.capitalize 16 | data.contact = data.contact || ENV['EMAIL'] 17 | 18 | copy "**/*", :render=>'erb' 19 | copy "bin/*", :mode=>0744 20 | 21 | # TODO: Should we protect certain files from ever being overwrite? 22 | #skip('PROFILE', 'VERSION') 23 | 24 | -------------------------------------------------------------------------------- /work/reference/seeds/website/template/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= name.capitalize %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 |
20 | 21 |

<%= name %>

22 | 23 |

Welcome to your new website!

24 | 25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/04_help.rdoc: -------------------------------------------------------------------------------- 1 | = Getting Help 2 | 3 | The `sow` command provides a fair amount of help information. 4 | You can get general help about the commands available simply 5 | by using the +help+ command. 6 | 7 | `sow help` 8 | 9 | In additon, each sow command will provide help information 10 | about what it does and what options it accepts by putting 11 | the --help flag after the command. 12 | 13 | `sow bank --help` 14 | 15 | Finally, each seed will provide help information about it's 16 | purpose and accepted arguments, so long as the author did his or 17 | her duty and provided a `.ronn` file. Simply provide the name of 18 | the seed after the +help+ command. 19 | 20 | `sow help ruby` 21 | 22 | -------------------------------------------------------------------------------- /lib/quarry/cli/remove.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | # Remove a mine. 6 | # 7 | class Remove < Abstract 8 | 9 | command 'remove' 10 | command 'rm' 11 | 12 | # 13 | def call(argv) 14 | name = argv.first 15 | mine = Quarry.find(name) 16 | if mine 17 | if confirm?("remove #{mine.name}") 18 | Quarry.remove(name) 19 | end 20 | else 21 | raise "no such mine -- #{name}" 22 | end 23 | end 24 | 25 | # 26 | def opts 27 | super do |o| 28 | o.banner = "Usage: quarry remove [name]" 29 | o.separator "Remove a mine." 30 | end 31 | end 32 | 33 | end 34 | 35 | end 36 | 37 | -------------------------------------------------------------------------------- /lib/quarry/version.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | 3 | # 4 | # Local library directory. 5 | # 6 | def self.__DIR__ 7 | File.dirname(__FILE__) 8 | end 9 | 10 | # 11 | # Access to project metadata. 12 | # 13 | def self.metadata 14 | @metadata ||= ( 15 | require 'yaml' 16 | YAML.load(File.new(__DIR__ + '/../quarry.yml')) 17 | ) 18 | end 19 | 20 | # 21 | # Try missing constants as metadata lookups. 22 | # 23 | def self.const_missing(name) 24 | key = name.to_s.downcase 25 | metadata[key] || super(name) 26 | end 27 | 28 | end 29 | 30 | # Remove VERSION constant becuase Ruby 1.8~ gets in the way of Quarry::VERSION. 31 | Object.__send__(:remove_const, :VERSION) if Object.const_defined?(:VERSION) 32 | 33 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/meta/meta/data.rb: -------------------------------------------------------------------------------- 1 | module <%= name.capitalize %> 2 | 3 | def self.__DIR__ 4 | File.dirname(__FILE__) 5 | end 6 | 7 | def self.package 8 | @package ||= ( 9 | require 'yaml' 10 | YAML.load(File.new(__DIR__ + '/package')) 11 | ) 12 | end 13 | 14 | def self.profile 15 | @profile ||= ( 16 | require 'yaml' 17 | YAML.load(File.new(__DIR__ + '/profile')) 18 | ) 19 | end 20 | 21 | def self.const_missing(name) 22 | key = name.to_s.downcase 23 | package[key] || profile[key] || super(name) 24 | end 25 | 26 | end 27 | 28 | # Remove VERSION constant becuase Ruby 1.8~ gets in the way of Sow::VERSION. 29 | Object.__send__(:remove_const, :VERSION) if Object.const_defined?(:VERSION) 30 | 31 | -------------------------------------------------------------------------------- /data/quarry/readme/README.md.erb: -------------------------------------------------------------------------------- 1 | # <%= title %> 2 | 3 | [Website](<%= homepage %>) / 4 | [Source Code](<%= devsite %>) 5 | 6 | 7 | ## DESCRIPTION 8 | 9 | <%= description %> 10 | 11 | 12 | ## INSTALLATION 13 | 14 | To install with RubyGems simply open a console and type: 15 | 16 | gem install <%= name %> 17 | 18 | To manually installation, download the tgz package and type: 19 | 20 | $ tar -xvzf <%= name %>-x.y.z.tgz 21 | $ cd <%= name %>-x.y.z.tgz 22 | $ setup.rb 23 | 24 | 25 | ## INSTRUCTION 26 | 27 | Describe how to use your library or application here. __FIX__ 28 | 29 | 30 | ## COPYRIGHTS 31 | 32 | Copyright (c) 2012 <%= author %> 33 | 34 | This program is ditributed unser the terms of the <%= license %> license. 35 | 36 | Please see COPYING file. 37 | 38 | -------------------------------------------------------------------------------- /data/quarry/readme/README.tt.erb: -------------------------------------------------------------------------------- 1 | h1. <%= title %> 2 | 3 | [Website](<%= homepage %>) / 4 | [Source Code](<%= devsite %>) 5 | 6 | 7 | h2. DESCRIPTION 8 | 9 | <%= description %> 10 | 11 | 12 | h2. INSTALLATION 13 | 14 | To install with RubyGems simply open a console and type: 15 | 16 | gem install <%= name %> 17 | 18 | To manually installation, download the tgz package and type: 19 | 20 | $ tar -xvzf <%= name %>-x.y.z.tgz 21 | $ cd <%= name %>-x.y.z.tgz 22 | $ setup.rb 23 | 24 | 25 | h2. INSTRUCTION 26 | 27 | Describe how to use your library or application here. __FIX__ 28 | 29 | 30 | h2. COPYRIGHTS 31 | 32 | Copyright (c) 2012 <%= author %> 33 | 34 | This program is ditributed unser the terms of the <%= license %> license. 35 | 36 | Please see COPYING file. 37 | 38 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/.mine/copy.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # Hoe seed makes up for the fact the Sow clobber's 4 | # Hoe's +sow+ command. 5 | # 6 | # Usage: 7 | # 8 | # sow hoe [-o pathname | name] 9 | # 10 | # Note the usage is slighly different from the original 11 | # hoe command. To put the scaffolding in a subdirectory 12 | # you need to supply the --output option. 13 | # 14 | # Hoe plugin, to make up for the fact the Sow clobber's 15 | # Hoe's +sow+ command. Isn't it a bit silly to have a 16 | # command called +sow+ when it could just as well be 17 | # called +hoe+ anyway? 18 | 19 | abort "For new projects only." unless empty? #_or_managed 20 | 21 | data.name = arguments.shift || output.basename.to_s 22 | 23 | #abort "Project name argument required." unless metadata.name 24 | 25 | copy "**/*", :from=>'template' 26 | 27 | -------------------------------------------------------------------------------- /data/quarry/readme/README.rdoc.erb: -------------------------------------------------------------------------------- 1 | = <%= title %> 2 | 3 | {Website}[<%= homepage %>] / 4 | {Source Code}[<%= devsite %>] 5 | 6 | 7 | == DESCRIPTION 8 | 9 | <%= description %> 10 | 11 | 12 | == RELEASE NOTES 13 | 14 | Please see HISTORY file. 15 | 16 | 17 | == HOW TO INSTALL 18 | 19 | To install with RubyGems simply open a console and type: 20 | 21 | gem install <%= name %> 22 | 23 | To manually installation, download the tgz package and type: 24 | 25 | $ tar -xvzf <%= name %>-x.y.z.tgz 26 | $ cd <%= name %>-x.y.z.tgz 27 | $ setup.rb 28 | 29 | 30 | == SYNOPSIS 31 | 32 | Describe how to use your library or application here. __FIX__ 33 | 34 | 35 | == LICENSE 36 | 37 | Copyright (c) 2012 <%= author %> 38 | 39 | This program is ditributed unser the terms of the <%= license %> license. 40 | 41 | Please see COPYING file. 42 | 43 | -------------------------------------------------------------------------------- /work/defunct/qed/02_api/applique/layout.rb: -------------------------------------------------------------------------------- 1 | Before :document do 2 | FileUtils.rm_r('tmp/qed') if File.exist?('tmp/qed') 3 | end 4 | 5 | When 'seed is a directory' do 6 | @tmpdir = File.join('tmp/qed/bank/demo/') 7 | withsow = @tmpdir + '.sow' 8 | FileUtils.mkdir_p(withsow) 9 | end 10 | 11 | When 'A simple example of a README might read' do |quote| 12 | file = @tmpdir + '.sow/README' 13 | File.open(file, 'w'){ |f| f << quote } 14 | end 15 | 16 | When 'An example Sowfile might look something like this' do |quote| 17 | file = @tmpdir + '.sow/Sowfile' 18 | File.open(file, 'w'){ |f| f << quote } 19 | end 20 | 21 | When "seed directory holds" do 22 | FileUtils.mkdir_p(@tmpdir) 23 | end 24 | 25 | When 'seed directory might', 'have a', 'file called (((\S+)))' do |fname, quote| 26 | file = @tmpdir + "#{fname}" 27 | File.open(file, 'w'){ |f| f << quote } 28 | end 29 | 30 | -------------------------------------------------------------------------------- /lib/quarry/cli/bank.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | # Clone a mine and place it into the "bank". 6 | # 7 | # TODO: Now that `mine` is used over `seed` we need to a new term for "bank". 8 | # 9 | class Bank < Abstract 10 | 11 | # 12 | command 'bank' 13 | 14 | # 15 | def call(argv) 16 | uri = argv.shift 17 | name = argv.shift 18 | 19 | abort opts.to_s if argv.shift 20 | 21 | if trial? 22 | #$stderr.puts(" mkdir -p #{dir}") 23 | #$stderr.puts(" cd #{dir}") 24 | #$stderr.puts(" #{cmd}") 25 | $stderr.puts "Dryrun: scm clone #{uri}" 26 | else 27 | manager.clone(uri, :name=>name) 28 | end 29 | end 30 | 31 | # 32 | def opts 33 | super do |o| 34 | o.banner = "Usage: quarry bank [name]" 35 | end 36 | end 37 | 38 | end 39 | 40 | end 41 | 42 | -------------------------------------------------------------------------------- /data/quarry/ruby/README.md.erb: -------------------------------------------------------------------------------- 1 | = <%= title %> 2 | 3 | * home: <%= homepage %> 4 | 5 | 6 | == DESCRIPTION 7 | 8 | <%= description %> 9 | 10 | 11 | == RELEASE NOTES 12 | 13 | Please see HISTORY file. 14 | 15 | 16 | == SYNOPSIS 17 | 18 | <%= title %> does what it does! 19 | 20 | 21 | == INSTALATION 22 | 23 | To install with RubyGems simply open a console and type: 24 | 25 | $ gem install <%= package %> 26 | 27 | For a site install you will need Ruby Setup and the compressed 28 | packages (tar.gz or zip usually). Uncompress the package 29 | cd into it and run setup.rb, e.g. 30 | 31 | $ tar -xvzf <%= name %>-x.y.z.tgz 32 | $ cd <%= name %>-x.y.z.tgz 33 | $ sudo setup.rb 34 | 35 | 36 | == LICENSE 37 | 38 | Copyright (c) <%= Time.now.strftime('%Y') %> <%= author %> 39 | 40 | This program is ditributed unser the terms of the <%= license %> license. 41 | 42 | See the LICENSE or COPYING file for details. 43 | 44 | -------------------------------------------------------------------------------- /Index.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: quarry 3 | version: 0.1.0 4 | 5 | title: Quarry 6 | summary: Rock-solid file scaffolding 7 | created: 2009-10-17 8 | 9 | description: 10 | Quarry is a flexible and straight-forward file scaffolding system. 11 | 12 | requirements: 13 | - facets >=2.4.3 14 | - finder 15 | - scm 16 | - detroit (build) 17 | - ronn (build) # or md2man ? 18 | - lemon (test) 19 | - ae (test) 20 | 21 | resources: 22 | home: https://rubyworks.github.com/quarry 23 | code: https://github.com/rubyworks/quarry 24 | bugs: https://github.com/rubyworks/quarry/issues 25 | wiki: https://github.com/rubyworks/quarry/wiki 26 | gem: http://rubygems.org/gems/quarry 27 | 28 | repositories: 29 | upstream: git://github.com/rubyworks/quarry.git 30 | 31 | authors: 32 | - Trans 33 | 34 | organization: rubyworks 35 | 36 | copyrights: 37 | - Copyright (c) 2006 Rubyworks (BSD-2-Clause) 38 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/.mine/README: -------------------------------------------------------------------------------- 1 | sow-hoe-ruby(1) - generate a Ruby project for use with Hoe 2 | ========================================================== 3 | 4 | ## SYNOPSIS 5 | 6 | `sow hoe.ruby ` 7 | 8 | ## DESCRIPTION 9 | 10 | Thye `hoe` seed is one way in which Sow makes up for the fact 11 | that it clobbers the Hoe project's `sow` command. 12 | 13 | Note the usage is slighly different from the original hoe command. 14 | To put the scaffolding in a subdirectory you need to supply the 15 | `--output`/`-o` option. 16 | 17 | Isn't it a bit silly to have a command called `sow` when it could 18 | just as well be called `hoe` anyway? And in fact Sow provides 19 | exactly that. So you DON'T REALLY NEED THIS SEED. Simply use the 20 | `hoe` command like you used to use the Hoe's `sow` command. 21 | 22 | ## COPYRIGHT 23 | 24 | Copyright (c) 2010 Thomas Sawyer 25 | 26 | ## SEE ALSO 27 | 28 | sow(1), hoe(1) 29 | 30 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/.seed/copy.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This seed creates GEM DO POM metadata files. By default, or 4 | # selecting the `meta` type, the files generated are: 5 | # 6 | # meta/data.rb 7 | # meta/package 8 | # meta/profile 9 | # 10 | # If the `top` selection is made the files are: 11 | # 12 | # PROFILE 13 | # VERSION 14 | # 15 | # The default is highly recommeded. 16 | 17 | utilize 'gemdo' 18 | 19 | argument :name 20 | 21 | name = data.name 22 | 23 | #name = arguments.first || metadata['name'] #|| destination.basename.to_s 24 | 25 | abort "Name is required." unless name 26 | abort "Name must be single word." unless name =~ /\w+/ 27 | 28 | data.title = data['title'] || name.capitalize 29 | data.contact = data['contact'] || data['email'] 30 | 31 | if data.top 32 | copy "**/*", :render=>'erb', :from=>'top' 33 | else 34 | copy "**/*", :render=>'erb', :from=>'meta' 35 | end 36 | 37 | -------------------------------------------------------------------------------- /data/quarry/cucumber/mine/feature.cucumber/0RE/README: -------------------------------------------------------------------------------- 1 | quarry-feature.cucumber(1) - setup for using cucumber 2 | ===================================================== 3 | 4 | ## SYNOPSIS 5 | 6 | `quarry feature.cucumber [features_directory] 7 | 8 | ## DESCRIPTION 9 | 10 | Create a new cucumber feature. 11 | 12 | ## ARGUMENTS 13 | 14 | The cucumber feature template takes two arguments. 15 | 16 | * `feature_name` 17 | The name of the feature (required). 18 | 19 | * `features_directory` 20 | The features directory (default `features/`). 21 | 22 | If you are using a non-standard location for features, it's best 23 | to provide the directory argument, but if not given an intelligent 24 | guess is made by looking to pre-existing `.feature` files. If none 25 | found then it will fallback to `features`. 26 | 27 | ## COPYRIGHT 28 | 29 | Copyright (c) 2012 Rubyworks 30 | 31 | ## SEE ALSO 32 | 33 | quarry(1), quarry-cucumber(1) 34 | 35 | -------------------------------------------------------------------------------- /lib/quarry/cli/copy.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | # Managed copy. 6 | class Copy < Abstract 7 | 8 | command 'copy' 9 | 10 | # 11 | def call(argv) 12 | from = argv.shift 13 | to = argv.shift 14 | Quarry.copy(from, to, options) 15 | end 16 | 17 | # 18 | def opts 19 | OptionParser.new{ |o| 20 | o.banner = "Usage: quarry copy " 21 | #o.on('--output', '-o PATH'){ |path| options.output = path } 22 | o.on('--write' , '-w'){ options.mode = :write } 23 | o.on('--prompt', '-p'){ options.mode = :prompt } 24 | o.on('--skip' , '-s'){ options.mode = :skip } 25 | o.on('--force' , '-f'){ $FORCE = true } 26 | o.on('--dryrun' ){ $DRYRUN = true } 27 | o.on('--debug' ){ $DEBUG = true } 28 | o.on('--help', '-h' ){ puts o; exit } 29 | } 30 | end 31 | 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /work/reference/directory.rb: -------------------------------------------------------------------------------- 1 | module Sow 2 | 3 | # 4 | class Directory 5 | 6 | attr :pathname 7 | 8 | # 9 | def initialize(pathname) 10 | @pathname = Pathname.new(pathname) 11 | end 12 | 13 | # 14 | def glob(*patterns) 15 | found = [] 16 | patterns.each do |pattern| 17 | found.concat(pathname.glob(pattern)) 18 | end 19 | found.map{ |f| f.sub(path,'') 20 | end 21 | 22 | # 23 | def size(path) 24 | (pathname + path).size 25 | end 26 | 27 | # 28 | def md5(path) 29 | (pathname + path).md5 30 | end 31 | 32 | # 33 | def mtime(path) 34 | (pathname + path).mtime 35 | end 36 | 37 | # 38 | def ctime(path) 39 | (pathname + path).ctime 40 | end 41 | 42 | # 43 | def atime(path) 44 | (pathname + path).atime 45 | end 46 | 47 | # 48 | def read(path) 49 | (pathname + path).read 50 | end 51 | 52 | end 53 | 54 | end 55 | -------------------------------------------------------------------------------- /work/reference/seeds/testunit/_SCRIPT.rb: -------------------------------------------------------------------------------- 1 | # Test::Unit Scaffold 2 | 3 | module Sow::Plugins 4 | 5 | class TestUnit < Script 6 | 7 | attr_accessor :dir 8 | 9 | attr_accessor :name 10 | 11 | # 12 | def setup 13 | @dir ||= argument 14 | 15 | if name 16 | abort "Test name must ba a single word" if name =~ /\s+/ 17 | 18 | metadata.class_name = name.modulize 19 | metadata.test_name = name.pathize 20 | end 21 | end 22 | 23 | # 24 | def manifest 25 | test_dir = (Dir['{test/unit,test}/'].first || 'test').chomp('/') 26 | form_dir = (Dir['{form{,s}/'].first || 'form').chomp('/') 27 | 28 | test_dir = dir if dir 29 | 30 | copy "test" , test_dir 31 | copy "form/testunit", form_dir + "/testunit", :chmod => 0755 32 | 33 | if name 34 | copy "test/test_template.rb", "#{test_dir}/test_#{metadata.test_name}.rb" 35 | end 36 | end 37 | 38 | end 39 | 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/README: -------------------------------------------------------------------------------- 1 | sow-gemdo(1) - create GEM DO POM metadata files 2 | =============================================== 3 | 4 | ## SYNOPSIS 5 | 6 | `sow gemdo ` 7 | `sow gemdo top=true` 8 | 9 | ## DESCRIPTION 10 | 11 | This seed creates GEM DO POM metadata files. By default, or 12 | selecting the `meta` type, the files generated are: 13 | 14 | meta/data.rb 15 | meta/package 16 | meta/profile 17 | 18 | If the `top` selection is made the files are: 19 | 20 | PROFILE 21 | VERSION 22 | 23 | The default is highly recommeded. 24 | 25 | ## NAME 26 | 27 | The name argument is used to fill in some of the metadata fields. 28 | Other fields are filed in via common environment variables if 29 | they exist. Is with all Sow templates, if a field is not found 30 | an `______` entry is used to make it easier to find and 31 | edit unfinished files. 32 | 33 | ## COPYRIGHT 34 | 35 | Copyright (c) 2010 Thamas Sawyer 36 | 37 | ## SEE ALSO 38 | 39 | sow(1) 40 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/gemdo/.seed/README: -------------------------------------------------------------------------------- 1 | sow-gemdo(1) - create GEM DO POM metadata files 2 | =============================================== 3 | 4 | ## SYNOPSIS 5 | 6 | `sow gemdo ` 7 | `sow gemdo top=true` 8 | 9 | ## DESCRIPTION 10 | 11 | This seed creates GEM DO POM metadata files. By default, or 12 | selecting the `meta` type, the files generated are: 13 | 14 | meta/data.rb 15 | meta/package 16 | meta/profile 17 | 18 | If the `top` selection is made the files are: 19 | 20 | PROFILE 21 | VERSION 22 | 23 | The default is highly recommeded. 24 | 25 | ## NAME 26 | 27 | The name argument is used to fill in some of the metadata fields. 28 | Other fields are filed in via common environment variables if 29 | they exist. Is with all Sow templates, if a field is not found 30 | an `______` entry is used to make it easier to find and 31 | edit unfinished files. 32 | 33 | ## COPYRIGHT 34 | 35 | Copyright (c) 2010 Thamas Sawyer 36 | 37 | ## SEE ALSO 38 | 39 | sow(1) 40 | -------------------------------------------------------------------------------- /work/consider/quarry.rb: -------------------------------------------------------------------------------- 1 | require 'scm' 2 | 3 | module Quarry 4 | 5 | # 6 | # 7 | # 8 | def self.cli(*argv) 9 | 10 | Shellwords.run argv, 11 | '--debug' => ->{ $DEBUG = true } 12 | 13 | uri = argv.shift 14 | name = File.basename(uri).chomp(File.extname(uri)) 15 | repo = nil 16 | 17 | Dir.chdir(conf_dir) do 18 | repo = SCM.clone(uri, :dest=>name) 19 | end 20 | 21 | location = Dir.pwd #TODO: option for dir 22 | scaffold = File.join(conf_dir, name) 23 | 24 | template = stage(location) 25 | 26 | render(scaffold, template) 27 | 28 | merge(template, location) 29 | end 30 | 31 | # 32 | # 33 | # 34 | def self.stage(dir=Dir.pwd) 35 | session = Time.now.strftime("%Y%m%d%H%M%S") # FIXME 36 | tmpdir = File.join(Dir.tmpdir, 'quarry', session) 37 | 38 | FileUtils.cp_r(dir, tmpdir) 39 | 40 | return tmpdir 41 | end 42 | 43 | # 44 | # 45 | # 46 | def conf_dir 47 | File.expand_path('~/.quarry') 48 | end 49 | 50 | end 51 | -------------------------------------------------------------------------------- /work/reference/test/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # Use Assertive Expressive 2 | require 'ae' 3 | require 'ae/expect' 4 | require 'ae/should' 5 | 6 | require 'tmpdir' 7 | 8 | include FileUtils 9 | 10 | $PROJECT_ROOT = ( 11 | dir = File.dirname(__FILE__) 12 | until Dir[dir + '/README*'].first do 13 | dir = File.expand_path(File.join(dir, '..')) 14 | end 15 | raise "no project root" unless dir 16 | dir 17 | ) 18 | 19 | $TEMP_DIR = Dir.tmpdir + '/cucumber/sow' 20 | 21 | puts "[tmp] #{$TEMP_DIR}" 22 | 23 | Before do 24 | rm_rf $TEMP_DIR 25 | mkdir_p $TEMP_DIR 26 | end 27 | 28 | def in_temporary_directory(&block) 29 | Dir.chdir($TEMP_DIR) do 30 | block.call 31 | end 32 | end 33 | 34 | def in_project_directory(*name, &block) 35 | Dir.chdir(File.join($TEMP_DIR, *name)) do 36 | block.call 37 | end 38 | end 39 | 40 | def plugin_scaffolding(name) 41 | files = [] 42 | Dir.chdir($PROJECT_ROOT + "/plug/sow/seeds/#{name}/template/") do 43 | files = Dir["**/*"] 44 | end 45 | files.sort 46 | end 47 | 48 | -------------------------------------------------------------------------------- /data/quarry/cucumber/0RE/README: -------------------------------------------------------------------------------- 1 | quarry-cucumber(1) - setup for using cucumber 2 | ============================================= 3 | 4 | ## SYNOPSIS 5 | 6 | `quarry cucumber [features_directory] 7 | 8 | ## DESCRIPTION 9 | 10 | Setup project for using cumcumber and place cucumber feature template 11 | in project's mine for creating new cucumber feature files. 12 | 13 | ## ARGUMENTS 14 | 15 | The cucuumber template takes one arguments. 16 | 17 | * `features_directory` 18 | The features directory (default `features/`). 19 | 20 | This see will create the step_features and support directories 21 | each with some minimal starter files to get up moving quickly. 22 | 23 | If you are using a non-standard location for features, it's best 24 | to provide the directory as an argument, but if not given an 25 | intelligent guess will be made by loolking to pre-existing `.feature` 26 | files. If not found then it will fallback to `features`. 27 | 28 | ## COPYRIGHT 29 | 30 | Copyright (c) 2012 Rubyworks 31 | 32 | ## SEE ALSO 33 | 34 | quarry(1) 35 | 36 | -------------------------------------------------------------------------------- /work/reference/mint/work/deprecated/command-old.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'ratchets/scaffold/controller' 4 | 5 | module ProUtils 6 | 7 | class ScaffoldCommand #< Console::Command 8 | 9 | def self.start 10 | new.start 11 | end 12 | 13 | def initialize 14 | args, opts = Console::Arguments.new.parse 15 | 16 | help if opts['help'] 17 | 18 | @type = args[0].to_s.downcase 19 | 20 | exit -1 if @type == '' 21 | 22 | @dryrun = opts['dryrun'] || opts['noharm'] || opts['n'] 23 | end 24 | 25 | def __help 26 | $stdout << File.read(File.join(File.dirname(__FILE__), 'help.txt')) 27 | exit 0 28 | end 29 | 30 | def __dryrun 31 | @dryrun = true 32 | end 33 | alias :__noharm, :__dryrun 34 | alias :_n, :__dryrun 35 | 36 | def start 37 | Architect.scaffold(@type, :dryrun => @dryrun) 38 | end 39 | 40 | def help 41 | $stdout << File.read(File.join(File.dirname(__FILE__), 'help.txt')) 42 | exit 0 43 | end 44 | 45 | end #class Command 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /lib/quarry/template/script/extensions/dotruby.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | 3 | class Script 4 | 5 | # 6 | # Access to .ruby project metadata. This is useful for scaffoling 7 | # Ruby project's that use .ruby. 8 | # 9 | # Keep in mind that this data comes from the temporary duplicate 10 | # of the project and not the actual project. 11 | # 12 | # @return [Hash] Metadata from .ruby file, if available. 13 | # 14 | def dotruby 15 | @dotruby ||= ( 16 | file = File.join(output, '.ruby') 17 | File.exist?(file) ? YAML.load(file) : {} 18 | ) 19 | end 20 | 21 | # 22 | # List of resources that metadata can be drawn from. Each entry must 23 | # respond to #[]. 24 | # 25 | def resources 26 | [template_settings, work_settings, dotruby, user_settings] 27 | end 28 | 29 | class Context 30 | # 31 | # Access to .ruby project metadata. This is useful for scaffoling 32 | # Ruby project's that ise .ruby. 33 | # 34 | def dotruby 35 | @copy_script.doturby 36 | end 37 | end 38 | 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /lib/quarry/core_ext.rb: -------------------------------------------------------------------------------- 1 | # Facets Core 2 | require 'facets/kernel/ask' 3 | require 'facets/dir/recurse' 4 | require 'facets/hash/to_h' 5 | require 'facets/hash/rekey' 6 | 7 | # Facets Standard 8 | require 'facets/pathname' 9 | require 'facets/ostruct' 10 | 11 | class OpenStruct #:nodoc: 12 | # Missing from early version of Facets 13 | def to_ostruct 14 | self 15 | end 16 | end 17 | 18 | =begin 19 | require 'erb' 20 | require 'fileutils' 21 | 22 | # Facets Core 23 | require 'facets/kernel/ask' 24 | require 'facets/hash/rekey' 25 | require 'facets/dir/multiglob' 26 | require 'facets/file/rootname' 27 | require 'facets/file/split_root' 28 | require 'facets/module/basename' 29 | require 'facets/string/tab' 30 | require 'facets/string/pathize' 31 | require 'facets/string/modulize' 32 | require 'facets/string/methodize' 33 | 34 | # ARE THESE NEEDED? 35 | #require 'facets/yaml' # for to_yamlfrag 36 | #require 'facets/string/snakecase' 37 | #require 'facets/string/camelcase' 38 | #require 'quarry/openext' 39 | 40 | class String 41 | 42 | def to_list 43 | split(/[:;\n]/).collect{ |e| e.strip } 44 | end 45 | 46 | end 47 | =end 48 | 49 | -------------------------------------------------------------------------------- /lib/quarry/template/script/extensions/color.rb: -------------------------------------------------------------------------------- 1 | # This extension adds some color manipulation via the color gem, 2 | # which is useful for generating websites. 3 | 4 | require 'color' 5 | 6 | module Quarry 7 | 8 | class Script 9 | 10 | #class Context 11 | 12 | # Returns an instance of Color given an HTML color string. 13 | # Simply use #html on the color to get an HTML valid color string. 14 | def color(color) 15 | Color::RGB.from_html(color) 16 | end 17 | 18 | # Take a +keyword+ and calculate a unique color from it. 19 | # Simply use #html on the color to get an HTML valid color string. 20 | def color_from_keyword(word) 21 | key = (word+"ZZZ").sub(/[aeiou]/,'')[0,3].upcase.sub(/\W/,'') 22 | rgb = key.each_byte.to_a.map{ |i| (i-65)*10 } 23 | Color::RGB.new(*rgb) 24 | end 25 | 26 | # Return a random instance of Color. 27 | # Simply use #html on the color to get an HTML valid color string. 28 | def color_random 29 | Color::RGB.new(rand(255),rand(255),rand(255)) 30 | end 31 | 32 | #end 33 | 34 | end 35 | 36 | end 37 | 38 | -------------------------------------------------------------------------------- /lib/quarry/cli/undo.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | require 'quarry/copier' 3 | 4 | module Quarry::CLI 5 | 6 | # Utilize backup and undo previous quarrying. 7 | # 8 | class Undo < Abstract 9 | 10 | command 'undo' 11 | 12 | # 13 | def call(argv) 14 | abort "not functional yet" 15 | options.backup = false 16 | output = options.output || Dir.pwd 17 | backup = Dir[File.join(output, '.quarry/undo/*')].sort.last 18 | copier = Quarry::Copier.new(backup, output, options) 19 | copier.copy 20 | FileUtils.rm_r(backup) 21 | end 22 | 23 | # 24 | def opts 25 | OptionParser.new{ |o| 26 | o.banner = "Usage: quarry undo" 27 | o.on('--output', '-o PATH'){ |path| options.output = path } 28 | o.on('--write' , '-w'){ options.mode = :write } 29 | o.on('--prompt', '-p'){ options.mode = :prompt } 30 | o.on('--skip' , '-s'){ options.mode = :skip } 31 | o.on('--dryrun' ){ $DRYRUN = true } 32 | o.on('--debug' ){ $DEBUG = true } 33 | o.on('--help', '-h' ){ puts o; exit } 34 | } 35 | end 36 | 37 | end 38 | 39 | end 40 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/02_silo.rdoc: -------------------------------------------------------------------------------- 1 | = Working with Personal Seeds 2 | 3 | You personal seeds are stored in a "silo". 4 | 5 | == Saving Personal Seeds 6 | 7 | Seeds can easily be created from a working directory using the `sow silo save` 8 | command. You need only give it a name, and the current directory or a given 9 | target directory will be saved to the user's personal "silo" of seeds. 10 | 11 | `sow silo save foo tmp/qed/system/foo_seed` 12 | 13 | We can verify the seed exists. 14 | 15 | assert seed_silo_exists?('foo') 16 | 17 | == Listing Personal Seeds 18 | 19 | Silo seeds can be lists indendently of all other seeds via a bare `sow silo` 20 | command. 21 | 22 | `sow silo` 23 | 24 | The output will look like this ... 25 | 26 | * foo 27 | 28 | == Removing Personal Seeds 29 | 30 | To remove a silo seed, use the `sow silo remove` command. Simply provide 31 | the name, or closest uniquely identifying match. We use the --force option 32 | in the following example to bypass the confirmation prompt. 33 | 34 | `sow silo remove foo --force` 35 | 36 | We can verify the seed no longer exists. 37 | 38 | refute seed_silo_exists?('foo') 39 | 40 | -------------------------------------------------------------------------------- /work/reference/mint/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2009 Thomas Sawyer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /data/quarry/license/mit/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) <%= Time.now.strftime("%Y") %> <%= authors %> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /work/reference/mint/lib/mint/command.rb: -------------------------------------------------------------------------------- 1 | require 'optparse' 2 | require 'mint/copier' 3 | 4 | module Mint 5 | 6 | class Command 7 | 8 | # 9 | def self.main(*argv) 10 | new.run(*argv) 11 | end 12 | 13 | # 14 | def initialize 15 | @options = {} 16 | end 17 | 18 | # 19 | def options 20 | @options 21 | end 22 | 23 | # 24 | def option_parser 25 | OptionParser.new do |opt| 26 | 27 | opt.on('--skip', 'skip all overwrites') do 28 | options[:skip] = true 29 | end 30 | 31 | opt.on('--force', 'force overwrites') do 32 | options[:force] = true 33 | end 34 | 35 | opt.on('--dryrun', 'only pretend to copy files') do 36 | options[:pretend] = true 37 | end 38 | 39 | opt.on('--debug' , 'provide debuggin information') do 40 | $VERBOSE = true 41 | $DEBUG = true 42 | end 43 | end 44 | end 45 | 46 | # 47 | def run(*argv) 48 | option_parser.parse!(argv) 49 | 50 | source, destination = *argv 51 | 52 | copier = Copier.new(source, destination, options) 53 | copier.copy 54 | end 55 | 56 | end 57 | 58 | end 59 | -------------------------------------------------------------------------------- /work/reference/mint/lib/mint/generators/update.rb: -------------------------------------------------------------------------------- 1 | require 'sow/generators/create' 2 | 3 | #-- 4 | # TODO: Could we use an "environment" settings file to specify environment variables to check for template variables? 5 | #++ 6 | 7 | module Sow 8 | 9 | module Generators 10 | 11 | # = Update Generator 12 | # 13 | # Update is the same as the Create Generator with the exception 14 | # that it pulls all metadata from the destination. 15 | # 16 | class Update < Create 17 | 18 | =begin 19 | ### Copy the file, processing it with ERB if 20 | ### it has an .erb extension. Unlike Create's 21 | ### this will skip pre-existant non-erb files. 22 | def copy_doc(src, dest) 23 | tmp = File.join(source, src) 24 | ext = File.extname(src) 25 | case ext 26 | when '.erb' 27 | text = erb(tmp) 28 | how = (File.exist?(dest) ? 'update' : 'create') 29 | write(dest, text) 30 | else 31 | if File.exist?(dest) 32 | how = 'skip' 33 | else 34 | how = 'create' 35 | cp(tmp, dest) 36 | end 37 | end 38 | return how, dest 39 | end 40 | =end 41 | 42 | end 43 | 44 | end 45 | 46 | end 47 | 48 | -------------------------------------------------------------------------------- /lib/quarry/cli/list.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | # List available "ore". 6 | # 7 | class List < Abstract 8 | 9 | command 'list' 10 | command 'ls' 11 | 12 | # 13 | #def self.cli 14 | # ['mine'] 15 | #end 16 | 17 | # 18 | # List all available ore. 19 | # 20 | def call(argv) 21 | templates = Quarry::Template.templates 22 | groups = templates.group_by{ |t| t.type } 23 | 24 | groups.each do |group, tmpls| 25 | puts "#{group}" 26 | tmpls.each do |tmpl| 27 | puts " * #{tmpl.name}" 28 | end 29 | end 30 | end 31 | 32 | # 33 | #def call(argv) 34 | # mines = manager.mine_list 35 | # mines.each do |mine| 36 | # puts " * #{bank}" 37 | # end 38 | #end 39 | 40 | # 41 | def opts 42 | super do |o| 43 | o.banner = "Usage: quarry mine" 44 | o.separator "List all available mines." 45 | end 46 | end 47 | 48 | # 49 | #def call(argv) 50 | # silos = manager.silos 51 | # if silos.empty? 52 | # puts "No personal mines found." 53 | # else 54 | # silos.each do |s| 55 | # puts " * #{s}" 56 | # end 57 | # end 58 | #end 59 | 60 | end 61 | 62 | end 63 | 64 | -------------------------------------------------------------------------------- /work/reference/mint/lib/mint/generators/delete.rb: -------------------------------------------------------------------------------- 1 | require 'sow/generators/base' 2 | 3 | module Sow 4 | 5 | module Generators 6 | 7 | # = Delete Generator 8 | # 9 | #-- 10 | # TODO: should force option be require to do this? 11 | # And without force it just reports what would be deleted? 12 | #++ 13 | class Delete < Base 14 | 15 | def mark; 'delete'; end 16 | 17 | # 18 | def actionlist_check(list) 19 | list 20 | end 21 | 22 | # Sort the manifest files before directory. 23 | # This is opposite of Construct::Create. 24 | def actionlist_sort(list) 25 | list.reverse 26 | #dirs, files = *list.partition{ |src, dest, opts| (source + src).directory? } 27 | #files.sort{|a,b| a[1]<=>b[1]} + dirs.sort{|a,b| a[1]<=>b[1]} 28 | end 29 | 30 | # Delete template file. 31 | def delete(loc, src, dest, opts) 32 | if File.exist?(dest) 33 | how = 'delete' 34 | begin 35 | rm(dest) 36 | rescue Errno::ENOTEMPTY 37 | how = 'skip' 38 | end 39 | else 40 | how = 'missing' 41 | end 42 | return how, dest 43 | end 44 | 45 | end#class Delete 46 | 47 | end#module Generators 48 | 49 | end#module Sow 50 | 51 | -------------------------------------------------------------------------------- /lib/quarry/cli/help.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | class Help < Abstract 6 | 7 | command 'help' 8 | 9 | # 10 | def call(argv) 11 | if name = argv.first 12 | puts Quarry.help(name) 13 | else 14 | puts "quarry ... # quarry a mine" 15 | puts "quarry mine ... # quarry a mine (same as `quarry `)" 16 | puts "quarry new ... # quarry a mine to a new location" 17 | puts "quarry list # list available mines" 18 | puts "quarry save [file ...] # save files to a mine" 19 | puts "quarry remove # remove mine from mine bank" 20 | puts "quarry update [name] # update mine(s) that were cloned" 21 | puts "quarry bank [name] # clone mine into bank" 22 | puts "quarry copy # perform a quarry managed copy" 23 | puts "quarry help # show this help message" 24 | end 25 | end 26 | 27 | # 28 | def opts 29 | OptionParser.new{ |o| 30 | o.banner = "Usage: quarry help" 31 | o.on('--dryrun' ){ $DRYRUN = true } 32 | o.on('--debug' ){ $DEBUG = true } 33 | } 34 | end 35 | 36 | end 37 | 38 | end 39 | 40 | -------------------------------------------------------------------------------- /work/reference/seeds/github/MANIFEST.sow: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # Takes one option which can either be public or private. 4 | # The default is public. 5 | 6 | help "Create a new GitHub repository for this project." 7 | 8 | option :privately, "make the repository private" 9 | 10 | #argument :privacy, 'public or private' do 11 | # privacy 12 | #end 13 | 14 | manifest do 15 | #copy "test.rb", "test/test_#{metadata.test_name}.rb" #, 16 | # :test_name => name.pathize, 17 | # :class_name => name.modulize 18 | end 19 | 20 | delete do 21 | # before delete 22 | super 23 | # after delete 24 | end 25 | 26 | create do 27 | file = XDG.config_select('github.user') 28 | 29 | about "missing .config/github.user" unless file 30 | 31 | config = config(file) 32 | 33 | abort "must at least have meta/package" unless metadata.package 34 | abort "missing 'login' entry in .config/github.user" unless config.login 35 | abort "missing 'token' entry in .config/github.user" unless config.token 36 | 37 | super 38 | 39 | post("http://github.com/api/v2/yaml/repos/create") do |p| 40 | p.login = github_config.login 41 | p.token = github_config.token 42 | p.name = metadata.package 43 | p.description = metadata.description 44 | p.homepage = metadata.homepage 45 | p.public = privately ? 0 : 1 # O is private 46 | end 47 | end 48 | 49 | -------------------------------------------------------------------------------- /lib/quarry/template/readme.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | class Template 3 | 4 | # Handles README files of a template. 5 | # 6 | class Readme 7 | 8 | GLOB = TEMPLATE_DIRECTORY + "/README{,.*}" 9 | 10 | # 11 | # 12 | # 13 | def initialize(template) 14 | @template = template 15 | @files = Dir.glob(template.path + GLOB) 16 | 17 | @lang = {} 18 | @files.each do |file| 19 | ext = File.extname(file) 20 | ext = '.en' if ext.empty? 21 | @lang[ext[1..-1]] = file 22 | end 23 | end 24 | 25 | # 26 | # @todo Appropriate way to handle language? 27 | # 28 | def to_s(lang='en') 29 | if @files.empty? 30 | construct_readme 31 | else 32 | File.read(@text[lang]) 33 | end 34 | end 35 | 36 | private 37 | 38 | # 39 | # Generate a README from template configuration. This is used if no README 40 | # file is provided. 41 | # 42 | def contstruct_readme 43 | config = template.config 44 | 45 | s = [] 46 | s << "# %s - %s" % [config[:name], config[:summary]] 47 | s << "## SYNOPSIS" 48 | s << Array(usage).join("\n") 49 | s << "## DESCRIPTION" 50 | s << config[:description] 51 | s << "## COPYRIGHT" 52 | s << config[:copyright] 53 | s.join("\n\n") 54 | end 55 | 56 | end 57 | 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/quarry/cli.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | 3 | # Command line interface. 4 | # 5 | module CLI 6 | 7 | # 8 | # Entry point for commandline interface. 9 | # 10 | def self.run(*argv) 11 | argv.shift if argv.first == '-' 12 | 13 | # if not command given, then display help 14 | # in future this might look for an "auto template" 15 | # in Dir.pwd first 16 | argv << 'help' if argv.empty? 17 | 18 | cls, argv = parse(argv) 19 | 20 | if $DEBUG 21 | cls.run(*argv) 22 | else 23 | begin 24 | cls.run(*argv) 25 | rescue => error 26 | $stderr << error.to_s + "\n" 27 | #$stderr.puts error.backtrace 28 | end 29 | end 30 | end 31 | 32 | # 33 | # Parse arguments into command class and remaining arguments. 34 | # 35 | def self.parse(argv) 36 | args = argv.join(' ') 37 | lookup = registry.sort_by{ |cmd, cls| cmd.size }.reverse 38 | cmd, cls = lookup.find do |(cmd, cls)| 39 | args.start_with?(cmd) 40 | end 41 | 42 | size = cmd.split(/\s+/).size 43 | argv = argv[size..-1] 44 | 45 | return cls, argv 46 | end 47 | 48 | # 49 | # Load command subclasses. 50 | # 51 | def self.require_commands 52 | Dir[File.dirname(__FILE__) + '/cli/*'].each do |file| 53 | require file 54 | end 55 | end 56 | 57 | end 58 | 59 | end 60 | 61 | # Load command subclasses. 62 | Quarry::CLI.require_commands 63 | 64 | -------------------------------------------------------------------------------- /.index: -------------------------------------------------------------------------------- 1 | --- 2 | type: ruby 3 | revision: 2013 4 | sources: 5 | - Index.yml 6 | authors: 7 | - name: Trans 8 | email: transfire@gmail.com 9 | organizations: 10 | - name: rubyworks 11 | requirements: 12 | - version: ! '>=2.4.3' 13 | name: facets 14 | - name: finder 15 | - name: scm 16 | - groups: 17 | - build 18 | development: true 19 | name: detroit 20 | - groups: 21 | - build 22 | development: true 23 | name: ronn 24 | - groups: 25 | - test 26 | development: true 27 | name: lemon 28 | - groups: 29 | - test 30 | development: true 31 | name: ae 32 | conflicts: [] 33 | alternatives: [] 34 | resources: 35 | - type: home 36 | uri: https://rubyworks.github.com/quarry 37 | label: Homepage 38 | - type: code 39 | uri: https://github.com/rubyworks/quarry 40 | label: Source Code 41 | - type: bugs 42 | uri: https://github.com/rubyworks/quarry/issues 43 | label: Issue Tracker 44 | - type: wiki 45 | uri: https://github.com/rubyworks/quarry/wiki 46 | label: User Guide 47 | - type: gem 48 | uri: http://rubygems.org/gems/quarry 49 | repositories: 50 | - name: upstream 51 | scm: git 52 | uri: git://github.com/rubyworks/quarry.git 53 | categories: [] 54 | load_path: 55 | - lib 56 | copyrights: 57 | - holder: Rubyworks 58 | year: '2006' 59 | license: BSD-2-Clause 60 | name: quarry 61 | title: Quarry 62 | version: 0.1.0 63 | summary: Rock-solid file scaffolding 64 | created: '2009-10-17' 65 | description: Quarry is a flexible and straight-forward file scaffolding system. 66 | date: '2012-12-08' 67 | -------------------------------------------------------------------------------- /work/defunct/qed/02_api/miner.md: -------------------------------------------------------------------------------- 1 | # Generator 2 | 3 | The Generator class is the primary controller of the Sow system. By setting 4 | up a Generator object, it can be used to "germinate" new seeds. 5 | 6 | require 'quarry/generator' 7 | 8 | Given that we have a seed as defined in layout.rdoc[qed://layout.rdoc]. 9 | To create a generator we need a seed, the +destination+ for the new scaffolding, 10 | and any general options that control operation, such as +write+, +skip+, etc. 11 | 12 | dir = 'tmp/qed/myapp' 13 | 14 | opts = {:skip=>true, :output=>dir} 15 | 16 | ore = Sow::Scaffold.new('demo', ['myapp'], {'name'=>'Sow Demo'}, opts) 17 | 18 | gen = Sow::Generator.new([seed], opts) 19 | 20 | With the instantiation of a Generator, a fair amount of information is 21 | setup. 22 | 23 | gen.output.assert == 'tmp/qed/myapp' 24 | 25 | We will not go into the Seed class here (see seed.rdoc for that), but to point 26 | out that it extecutes the seed's Sowfile which updates a stagged copy of 27 | the destination. It is this staged set of files that is ultimately copied back 28 | to the output directory. 29 | 30 | silently do 31 | gen.generate 32 | end 33 | 34 | Now if we look in the designated output directory, we will find our demo files. 35 | 36 | File.assert.exist?(dir + '/README') 37 | File.assert.exist?(dir + '/LICENSE') 38 | 39 | And we will likewise see that README has been filled in with the settings 40 | metadata. 41 | 42 | File.read(dir + '/README').include?('Sow Demo') 43 | 44 | -------------------------------------------------------------------------------- /lib/quarry/template/script/extensions/gemdo.rb: -------------------------------------------------------------------------------- 1 | begin 2 | # TODO: Or is it pom ? 3 | require 'gemdo' 4 | require 'gemdo/readme' 5 | 6 | module Quarry 7 | 8 | class Script 9 | 10 | # Access to POM project object. Thus is useful for scaffoling 11 | # Ruby project's that conform to POM specs. Keep in mind that 12 | # this POM object points to the temporary duplicate of the project 13 | # and not the actual project. 14 | # 15 | # Returns an instance of Gemdo::Project, if available. 16 | def project 17 | @project ||= Gemdo::Project.lookup(work.to_s) #working_directory) 18 | end 19 | 20 | # List of resources that metadata can be drawn from. Each entry must 21 | # respond to #[]. 22 | def resources 23 | [mine_settings, work_settings, project.package, project.profile, user_settings] 24 | end 25 | 26 | class Context 27 | # Access to POM project object. Thus is useful for scaffoling 28 | # Ruby project's that conform to POM specs. Keep in mind that 29 | # this POM object points to the temporary duplicate of the project 30 | # and not the actual project. 31 | # 32 | # Returns an instance of POM::Project, if available. 33 | def project 34 | @copy_script.project 35 | end 36 | end 37 | 38 | end 39 | 40 | end 41 | 42 | rescue LoadError 43 | 44 | # Hey, where's the POM? 45 | # TODO: raise error? better would be an #availabilty validator for extensions. 46 | warn 'Gemdo is not installed.' 47 | 48 | end 49 | -------------------------------------------------------------------------------- /work/defunct/data/quarry/hoe/README.txt: -------------------------------------------------------------------------------- 1 | = <%= name %> 2 | 3 | * FIX (url) 4 | 5 | == DESCRIPTION: 6 | 7 | FIX (describe your package) 8 | 9 | == FEATURES/PROBLEMS: 10 | 11 | * FIX (list of features or problems) 12 | 13 | == SYNOPSIS: 14 | 15 | FIX (code sample of usage) 16 | 17 | == REQUIREMENTS: 18 | 19 | * FIX (list of requirements) 20 | 21 | == INSTALL: 22 | 23 | * FIX (sudo gem install, anything else) 24 | 25 | == LICENSE: 26 | 27 | (The MIT License) 28 | 29 | Copyright (c) <%= Time.new.strftime("%Y") %> FIX 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining 32 | a copy of this software and associated documentation files (the 33 | 'Software'), to deal in the Software without restriction, including 34 | without limitation the rights to use, copy, modify, merge, publish, 35 | distribute, sublicense, and/or sell copies of the Software, and to 36 | permit persons to whom the Software is furnished to do so, subject to 37 | the following conditions: 38 | 39 | The above copyright notice and this permission notice shall be 40 | included in all copies or substantial portions of the Software. 41 | 42 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 43 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 44 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 45 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 46 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 47 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 48 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 49 | 50 | -------------------------------------------------------------------------------- /test/case_management.rb: -------------------------------------------------------------------------------- 1 | covers 'quarry/template/management' 2 | 3 | test_case Quarry::Template do 4 | 5 | class_method :output do 6 | Quarry::Template.output.assert == Pathname.new(Dir.pwd) 7 | end 8 | 9 | class_method :templates do 10 | test 'returns list of templates' do 11 | Quarry::Template.templates.size.assert = 1 12 | Quarry::Template.templates.first.class.assert == Quarry::Template 13 | end 14 | end 15 | 16 | class_method :list do 17 | test 'returns sorted list of template names' do 18 | Quarry::Template.list.assert = ['example'] 19 | end 20 | end 21 | 22 | class_method :find do 23 | test "can find template with full name" do 24 | Quarry::Template.find('example') 25 | end 26 | 27 | test "can find template with unique first portion of name" do 28 | Quarry::Template.find('ex') 29 | end 30 | end 31 | 32 | class_method :search do 33 | 34 | end 35 | 36 | class_method :save do 37 | 38 | end 39 | 40 | class_method :update do 41 | 42 | end 43 | 44 | class_method :remove do 45 | 46 | end 47 | 48 | class_method :help do 49 | 50 | end 51 | 52 | class_method :uri_to_name do 53 | test 'for git uri' do 54 | path = Quarry::Template.uri_to_name('git://trans.github.com/seeds.git') 55 | path.assert == "seeds.trans.github.com" 56 | end 57 | 58 | test 'for svn uri' do 59 | path = Quarry::Template.uri_to_name('svn+ssh://mt-example.com@mt-example.com/home/joe/data/svn/repo-name/website1/trunk') 60 | path.assert == "website1.repo-name.svn.data.joe.home.mt-example.com" 61 | end 62 | end 63 | 64 | end 65 | -------------------------------------------------------------------------------- /COPYING.rdoc: -------------------------------------------------------------------------------- 1 | = COPYRIGHT 2 | 3 | == NOTICES 4 | 5 | === Quarry 6 | 7 | Copyright:: (c) 2012 RubyWorks 8 | License:: (r) BSD-2-Clause 9 | Website:: http://rubyworks.github.com/quarry 10 | 11 | == LICENSES 12 | 13 | === BSD-2-Clause License 14 | 15 | Quarry 16 | 17 | Copyright (c) 2012 Rubyworks. All rights reserved. 18 | 19 | Redistribution and use in source and binary forms, with or without 20 | modification, are permitted provided that the following conditions are met: 21 | 22 | 1. Redistributions of source code must retain the above copyright notice, 23 | this list of conditions and the following disclaimer. 24 | 25 | 2. Redistributions in binary form must reproduce the above copyright 26 | notice, this list of conditions and the following disclaimer in the 27 | documentation and/or other materials provided with the distribution. 28 | 29 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 30 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 31 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 32 | COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 33 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 34 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 36 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 38 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | -------------------------------------------------------------------------------- /lib/quarry/cli/abstract.rb: -------------------------------------------------------------------------------- 1 | require 'optparse' 2 | 3 | module Quarry 4 | module CLI 5 | 6 | # 7 | def self.registry 8 | @registry ||= {} 9 | end 10 | 11 | # 12 | class Abstract 13 | 14 | # 15 | def self.command(string) 16 | CLI.registry[string] = self 17 | end 18 | 19 | # 20 | #def self.cli 21 | # [name.split('::').last.downcase] 22 | #end 23 | 24 | # 25 | #def self.inherited(subclass) 26 | # CLI.registry << subclass 27 | #end 28 | 29 | # 30 | def self.run(*argv) 31 | new.run(*argv) 32 | end 33 | 34 | # 35 | def options 36 | @options 37 | end 38 | 39 | # 40 | def initialize() 41 | @options = {} 42 | end 43 | 44 | # 45 | def run(*argv) 46 | opts.parse!(argv) 47 | call(argv) 48 | end 49 | 50 | # 51 | def manager 52 | @manager ||= Manager.new(options) 53 | end 54 | 55 | # Get a confirmation from the user. If $FORCE is true, 56 | # assume the answer it 'yes'. 57 | def confirm?(message) 58 | ans = $FORCE ? 'y' : ask("Confirm #{message} (y/N)? ") 59 | case ans.strip.downcase 60 | when 'y', 'yes' 61 | true 62 | else 63 | false 64 | end 65 | end 66 | 67 | # 68 | def opts(&block) 69 | opt = OptionParser.new(&block) 70 | opt.on('--dryrun' ){ $DRYRUN = true } 71 | opt.on('--force' ){ $FORCE = true } 72 | opt.on('--debug' ){ $DEBUG = true } 73 | opt.on('--help', '-h' ){ puts opt; exit } 74 | opt 75 | end 76 | 77 | end 78 | 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /work/defunct/qed/02_api/layout.md: -------------------------------------------------------------------------------- 1 | # Layout 2 | 3 | The layout of an "ore" directory, whcih contains a set of template files 4 | along with an .ore directory which contains a README file and a copy.rb file. 5 | 6 | The README document simply consists of text describing the seed and 7 | any special arguments if handles that the user will want to know about. 8 | It is expetect to be markdown, and optionally ronn-style markdown. 9 | 10 | A simple example of a README might read: 11 | 12 | quarry-myore - simple ore example 13 | ================================= 14 | 15 | ## SYNOPSIS 16 | 17 | Sample ore will create a sample project layout 18 | suitable for testing by Quarry's test suite. 19 | 20 | The `copy.rb` file is a script that collects any information the ore needs 21 | and copies the files from the ore to a staging ground, which is later copied 22 | to the output destination. An example copy.rb file might look something like: 23 | 24 | argument :name, :default => 'anonymous' 25 | 26 | copy '**/*' 27 | 28 | The ore directory holds all the ERB templates and static files that may 29 | be copied. For example, the seed directory might have a template file 30 | called README: 31 | 32 | # <%= name %> - <%= summary %> 33 | 34 | <%= description %> 35 | 36 | Copyright (c) <%= Time.now.strftime('%Y') %> <%= name %> 37 | 38 | The ore directory might also have a static file called LICENSE: 39 | 40 | Pancake License 41 | 42 | You can do whatever the hell you want with this software 43 | just so long as lawyers do not become involved. 44 | 45 | And that's really all there is to it. That is the basic outline of Quarry ore. 46 | The nice thing about ore is that the layout is straight-forward and the 47 | copy.rb DSL is very easy to use. 48 | 49 | -------------------------------------------------------------------------------- /lib/quarry/cli/new.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/ore' 2 | 3 | module Quarry::CLI 4 | 5 | # Mine us a new project. 6 | # 7 | class New < Ore 8 | 9 | command 'new' 10 | 11 | # 12 | def call(argv) 13 | if argv.empty? 14 | #FileUtils.mkdir_p(File.join(options[:output] || Dir.pwd, '.quarry')) 15 | FileUtils.mkdir_p(options[:output] || Dir.pwd) 16 | else 17 | super(argv) 18 | end 19 | end 20 | 21 | # 22 | def run(*argv) 23 | opts.parse!(argv) 24 | options[:output] = argv.shift 25 | raise "Directory #{options[:output]} already exists." if File.exist?(options[:output]) 26 | call(argv) 27 | end 28 | 29 | # 30 | def opts 31 | OptionParser.new{ |o| 32 | o.banner = "Usage: quarry new [*args]" 33 | o.separator "Copy min files into new directory." 34 | #o.on('--output', '-o PATH'){ |path| options[:output] = path } 35 | #o.on('--write' , '-w'){ options[:mode] = :write } 36 | #o.on('--prompt', '-p'){ options[:mode] = :prompt } 37 | #o.on('--skip' , '-s'){ options[:mode] = :skip } 38 | o.on('-i', '--interactive'){ options[:interactive] = true } 39 | o.on('-f', '--force' ){ $FORCE = true } 40 | o.on('--dryrun' ){ $DRYRUN = true } 41 | o.on('--debug' ){ $DEBUG = true } 42 | o.on('-h', '--help' ){ puts o; exit } 43 | } 44 | end 45 | 46 | # Parse out the metadata setting given on the commandline. 47 | def parse_settings(argv) 48 | env = {} 49 | sets, args = *argv.partition{ |x| /=/ =~ x } 50 | sets.each do |x| 51 | k, *v = *x.split('=') 52 | env[k] = v.join('=') 53 | end 54 | return env, args 55 | end 56 | 57 | end 58 | 59 | end 60 | -------------------------------------------------------------------------------- /lib/quarry/template/context.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | class Template 3 | 4 | # Templates are all rendered within the scope of a context object. 5 | # This limits access to only pertinent information. All metadata 6 | # can be accessed by name, as this object delegates missing methods 7 | # to a Metadata instance. 8 | # 9 | class Context 10 | 11 | # Remove all non-essential methods. 12 | instance_methods.each{ |m| undef_method(m) unless m.to_s =~ /^(__|object_id$|respond_to\?$)/ } 13 | 14 | # 15 | def initialize(script) 16 | @script = script 17 | @metadata = script.metadata 18 | end 19 | 20 | # 21 | # TODO: Should template scope have render method ? 22 | # 23 | #def render(file, options={}) 24 | # options[:file] = file 25 | # options[:data] = self #binding 26 | # Malt.render(options) 27 | #end 28 | 29 | # 30 | #def working_directory 31 | # @metadata.mine.working_directory 32 | #end 33 | 34 | # 35 | # 36 | # 37 | def method_missing(s,*a,&b) 38 | if result = @metadata[s] 39 | result 40 | elsif @script.interactive? 41 | @metadata[s] = ask("#{s}: ") 42 | else 43 | @metadata[s] = "___#{s}___" 44 | #super(s,*a,&b) 45 | end 46 | end 47 | 48 | # 49 | # 50 | # 51 | def to_h 52 | @metadata.to_h 53 | end 54 | 55 | # 56 | # Clean binding. 57 | # 58 | # @return [Binding] clean binding 59 | def to_binding 60 | binding 61 | end 62 | 63 | # 64 | # Concise inspect string. 65 | # 66 | def inspect 67 | "#" 68 | end 69 | end 70 | 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /work/reference/test/features/step_definitions/fixture_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^I want to create a new "(.*)" project$/ do |type| 2 | @type = type 3 | end 4 | 5 | And /^I want the project to be called "(.*)"$/ do |name| 6 | @name = name 7 | end 8 | 9 | And /^I want to place it in a directory with the same name$/ do 10 | @path = @name 11 | end 12 | 13 | And /^I want to place it in a directory "(.*)"$/ do |path| 14 | @path = path 15 | end 16 | 17 | Given /^there is no project directory/ do 18 | in_temporary_directory do 19 | rm_r(@path) if File.exist?(@path) 20 | end 21 | end 22 | 23 | Given /^a command option "(.*)"$/ do |opt| 24 | @option = opt 25 | if /=/ =~ @option 26 | @name = @option.split('=').last 27 | end 28 | end 29 | 30 | And /^a command argument$/ do |arg| 31 | @argument = arg 32 | if /=/ !~ @option 33 | @name = arg 34 | end 35 | end 36 | 37 | When /^I execute sow$/ do 38 | if @path = @name 39 | cmd = %|sow --#{@type} #{@path}| 40 | else 41 | cmd = %|sow --#{@type}=#{@name} #{@path}| 42 | end 43 | in_temporary_directory do 44 | system cmd 45 | end 46 | end 47 | 48 | Then /^a standard ruby project will be generated$/ do 49 | in_temporary_directory do 50 | File.assert.exist?(@path) 51 | 52 | entries =[] 53 | Dir.chdir(@path) do 54 | entries = Dir.glob("**/*", File::FNM_DOTMATCH) 55 | end 56 | entries = entries.reject{ |d| File.basename(d) == '.' or File.basename(d) == '..' } # this sucks! 57 | entries = entries.sort 58 | 59 | files = plugin_scaffolding('ruby') 60 | files = files.map{ |d| d.sub('meta', '.meta') } 61 | files = files.map{ |d| d.sub('__package__', @name) } 62 | files = files.sort 63 | entries.assert == files 64 | end 65 | end 66 | 67 | And /^with the proper project name$/ do 68 | in_project_directory(@path) do 69 | File.read('README.rdoc').assert.index(@name) 70 | end 71 | end 72 | 73 | -------------------------------------------------------------------------------- /work/reference/seeds/cucumber-feature/step_definitions/common_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^I want to create a new "(.*)" project$/ do |type| 2 | @type = type 3 | end 4 | 5 | And /^I want the project to be called "(.*)"$/ do |name| 6 | @name = name 7 | end 8 | 9 | And /^I want to place it in a directory with the same name$/ do 10 | @path = @name 11 | end 12 | 13 | And /^I want to place it in a directory "(.*)"$/ do |path| 14 | @path = path 15 | end 16 | 17 | Given /^there is no project directory/ do 18 | in_temporary_directory do 19 | rm_r(@path) if File.exist?(@path) 20 | end 21 | end 22 | 23 | Given /^a command option "(.*)"$/ do |opt| 24 | @option = opt 25 | if /=/ =~ @option 26 | @name = @option.split('=').last 27 | end 28 | end 29 | 30 | And /^a command argument$/ do |arg| 31 | @argument = arg 32 | if /=/ !~ @option 33 | @name = arg 34 | end 35 | end 36 | 37 | When /^I execute sow$/ do 38 | if @path = @name 39 | cmd = %|sow --#{@type} #{@path}| 40 | else 41 | cmd = %|sow --#{@type}=#{@name} #{@path}| 42 | end 43 | in_temporary_directory do 44 | system cmd 45 | end 46 | end 47 | 48 | Then /^a standard ruby project will be generated$/ do 49 | in_temporary_directory do 50 | File.assert.exist?(@path) 51 | 52 | entries =[] 53 | Dir.chdir(@path) do 54 | entries = Dir.glob("**/*", File::FNM_DOTMATCH) 55 | end 56 | entries = entries.reject{ |d| File.basename(d) == '.' or File.basename(d) == '..' } # this sucks! 57 | entries = entries.sort 58 | 59 | files = plugin_scaffolding('ruby') 60 | files = files.map{ |d| d.sub('meta', '.meta') } 61 | files = files.map{ |d| d.sub('__package__', @name) } 62 | files = files.sort 63 | entries.assert == files 64 | end 65 | end 66 | 67 | And /^with the proper project name$/ do 68 | in_project_directory(@path) do 69 | File.read('README.rdoc').assert.index(@name) 70 | end 71 | end 72 | 73 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/applique/setup.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift('lib') 2 | 3 | require 'sow' 4 | require 'shellwords' 5 | require 'stringio' 6 | require 'fileutils' 7 | 8 | SAMPLES = File.dirname(File.dirname(__FILE__)) + '/samples' 9 | TEMPDIR = 'tmp/qed/system' 10 | 11 | SOW_HOME = TEMPDIR + '/sow_home' 12 | 13 | # redirect sow home to tmp location 14 | Sow::Manager::SOW_CONFIG.replace(SOW_HOME) 15 | 16 | def `(command) # comment here b/c of dumb syntax highligters` 17 | command.sub!(/^sow/,'') 18 | argv = Shellwords.shellwords(command) 19 | $stdout, $stderr = StringIO.new, StringIO.new 20 | Sow.cli(*argv) 21 | $stdout.rewind; $stderr.rewind 22 | @out, @err = $stdout.read, $stderr.read 23 | $stdout, $stderr = STDOUT, STDERR 24 | @out 25 | end 26 | 27 | Before :demo do 28 | FileUtils.rm_rf('tmp/qed') if File.exist?('tmp/qed') 29 | FileUtils.mkdir_p(File.dirname(TEMPDIR)) 30 | FileUtils.cp_r(SAMPLES, TEMPDIR) 31 | end 32 | 33 | When "given an empty temporary directory '(((.*?)))'" do |name| 34 | FileUtils.rm_r("tmp/qed/#{name}") if File.exist?("tmp/qed/#{name}") 35 | FileUtils.mkdir_p("tmp/qed/#{name}") 36 | end 37 | 38 | When "'(((.*?)))' project already has a README file" do |name| 39 | FileUtils.rm_r("tmp/qed/#{name}") if File.exist?("tmp/#{name}") 40 | #FileUtils.mkdir_p('tmp/foo/.sow') 41 | FileUtils.mkdir_p("tmp/qed/#{name}") 42 | File.open("tmp/qed/#{name}/README", 'w'){ |f| f << "ipso\n" * 10 } 43 | end 44 | 45 | #When "we have a seed bank at '(((.*?)))'" do |path| 46 | # FileUtils.mkdir_p(File.join(SOW_HOME, path)) 47 | #end 48 | 49 | When "output will look like this" do |text| 50 | @out.tabto(0).strip.assert == text.tabto(0).strip 51 | end 52 | 53 | # Some helper methods 54 | 55 | def seed_bank_exists?(name) 56 | File.directory?(File.join(SOW_HOME, 'bank', name)) 57 | end 58 | 59 | def seed_silo_exists?(name) 60 | File.directory?(File.join(SOW_HOME, 'silo', name)) 61 | end 62 | 63 | -------------------------------------------------------------------------------- /lib/quarry/cli/ore.rb: -------------------------------------------------------------------------------- 1 | require 'quarry/cli/abstract' 2 | 3 | module Quarry::CLI 4 | 5 | # Quarry ore(s). This is the deafult commandline interface. 6 | # 7 | class Ore < Abstract 8 | 9 | command '' 10 | command 'ore' 11 | 12 | # 13 | def call(argv) 14 | templates = parse_arguments(argv) 15 | generator = Quarry::Generator.new(templates, options) 16 | generator.run! 17 | end 18 | 19 | # 20 | def opts 21 | OptionParser.new{ |o| 22 | o.banner = "Usage: quarry [arg ...] [key=val ...] [- ...]" 23 | o.separator "Mine ore." 24 | o.on('-o', '--output PATH'){ |path| options[:output] = path } 25 | o.on('-w', '--write' ){ options[:mode] = :write } 26 | o.on('-p', '--prompt' ){ options[:mode] = :prompt } 27 | o.on('-s', '--skip' ){ options[:mode] = :skip } 28 | o.on('-i', '--interactive'){ options[:interactive] = true } 29 | o.on('-f', '--force' ){ $FORCE = true } 30 | o.on('--dryrun' ){ $DRYRUN = true } 31 | o.on('--debug' ){ $DEBUG = true } 32 | o.on('-h', '--help' ){ puts o; exit } 33 | } 34 | end 35 | 36 | # 37 | def parse_arguments(argv) 38 | groups = [[]] 39 | argv.each do |arg| 40 | if arg == '-' 41 | next if groups.last.empty? 42 | groups << [] 43 | else 44 | groups.last << arg 45 | end 46 | end 47 | groups.map do |args| 48 | settings, arguments = parse_settings(args) 49 | uri = arguments.shift 50 | [uri, arguments, settings] 51 | end 52 | end 53 | 54 | # Parse out the metadata setting given on the commandline. 55 | def parse_settings(argv) 56 | env = {} 57 | sets, args = *argv.partition{ |x| /=/ =~ x } 58 | sets.each do |x| 59 | k, *v = *x.split('=') 60 | env[k] = v.join('=') 61 | end 62 | return env, args 63 | end 64 | 65 | end 66 | 67 | end 68 | -------------------------------------------------------------------------------- /lib/quarry/template/script/metadata.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | class Template 3 | class Script 4 | 5 | # Metdata access for filing in template slots. 6 | # 7 | class Metadata 8 | alias_method :object_class, :class 9 | 10 | instance_methods.each{ |m| undef_method(m) unless m.to_s =~ /^(__|object_id$|object_class$)/ } 11 | 12 | # 13 | # 14 | # 15 | def initialize(script) 16 | @script = script 17 | @settings = script.settings 18 | @data = {} 19 | end 20 | 21 | # 22 | # Get metadata entry. 23 | # 24 | def [](name) 25 | name = name.to_s 26 | return @data[name] if @data.key?(name) 27 | @settings.each do |s| 28 | result = s[name] 29 | return(@data[name] = result) if result 30 | end 31 | nil 32 | end 33 | 34 | # Set metadata entry. 35 | def []=(name, value) 36 | @data[name.to_s] = value 37 | end 38 | 39 | # 40 | def method_missing(sym, *args) 41 | sym = sym.to_s 42 | case sym 43 | when /\=$/ 44 | name = sym.chomp('=') 45 | self[name] = args.first 46 | when /\?$/ 47 | self[sym.chomp('?')] 48 | when /\!$/ 49 | # TODO: if method_missing ends in '!' 50 | else 51 | self[sym] 52 | end 53 | end 54 | 55 | # 56 | # Merge all settings resources into a single hash. 57 | # 58 | # @return [Hash] 59 | # 60 | def to_h 61 | @settings.reverse.inject({}){ |h,r| h.merge!(r.to_h) }.merge!(@data) 62 | end 63 | 64 | # 65 | # Clean binding, useful for rending in this context with ERB. 66 | # 67 | # @return [Binding] 68 | # 69 | def to_binding 70 | binding 71 | end 72 | 73 | end 74 | 75 | end 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /lib/quarry/config.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | 3 | # 4 | # Template indicator. 5 | # 6 | TEMPLATE_DIRECTORY = '0RE' 7 | 8 | # 9 | # Basenames of files to ignore in templates. 10 | # 11 | #IGNORE_FILES = %w{. .. .svn} 12 | 13 | # Files to remove in template files. 14 | #REMOVE_FILES = [CTRL] 15 | 16 | # Location of Quarry user configuration. This directory defaults 17 | # to '~/.quarry', but it can be changed with the `$QUARRY_HOME` 18 | # environment variable. For example, if you want to use XDG base 19 | # directory standard, you can set that with: 20 | # 21 | # export QUARRY_HOME="$XDG_CONFIG_HOME/quarry" 22 | # 23 | HOME = ENV['QUARRY_HOME'] || File.expand_path('~/.quarry') 24 | 25 | # Location relative to destination/project directory. If this needs 26 | # to be a hidden location trhen use `.quarry`, if not use `admin/quarry`. 27 | # 28 | WORK = '{.quarry,admin/quarry}' 29 | 30 | # 31 | # File pattern for looking up user matadata. 32 | # 33 | HOME_METADATA = File.join(HOME,'metadata.{yml,yaml}') 34 | 35 | # 36 | # File pattern for looking up desination matadata. 37 | # 38 | # FIXME: 39 | # 40 | WORK_METADATA = '{.quarry,.config/quarry,config/quarry}/metadata.{yml,yaml}' 41 | 42 | # 43 | # Where to install templates. By default this is `$QUARRY_HOME/templates`. 44 | # 45 | QUARRY_BANK = ENV['QUARRY'] || File.join(HOME, 'templates') 46 | 47 | # 48 | # Where to store personal mines. This default to `$SOW_BANK/silo`. 49 | # 50 | #SOW_SILO = ENV['SOW_SILO'] || SOW_BANK + '/silo' 51 | 52 | # 53 | # Edit marker. 54 | # 55 | EDIT_MARKER = /___(.*?)___/ 56 | 57 | ## 58 | ## Full path to directory in which quarry stores local ore. 59 | ## 60 | #def self.bank_folder 61 | # @bank_folder ||= Pathname.new(File.expand_path(QUARRY_BANK)) 62 | #end 63 | 64 | # 65 | #def self.read_setting(name, default=nil) 66 | # file = SOW_CONFIG + "/settings/#{name}" 67 | # if File.exist?(file) 68 | # File.read(file).strip 69 | # else 70 | # default 71 | # end 72 | #end 73 | 74 | end 75 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/01_banks.rdoc: -------------------------------------------------------------------------------- 1 | = Working with Seed Banks 2 | 3 | == Installing a Seed Bank 4 | 5 | We can install a seed bank using the +install+ command. A seed bank 6 | is simply a source control repository or a local file path. If a local 7 | file path is used, Sow will soft link the path into the bank store. 8 | 9 | # TODO 10 | 11 | If a repository URI is given, Sow will clone or checkout the repository 12 | into the bank store. 13 | 14 | `sow bank install git://github.com/trans/seeds.git` 15 | 16 | Sow will convert the URI into a flat directory name to store the repository. 17 | We can verify the bank was in fact installed. 18 | 19 | assert seed_bank_exists?('seeds.trans.github.com') 20 | 21 | If we wish to use a different name for the seed bank, we can supply 22 | the name in a second argument. 23 | 24 | `sow bank install git://github.com/trans/seeds.git seeds.trans` 25 | 26 | assert seed_bank_exists?('seeds.trans') 27 | 28 | == Listing Installed Banks 29 | 30 | A listing of installed seed banks can be printed with a plain `sow bank` 31 | command. 32 | 33 | `sow bank` 34 | 35 | The output will look like this ... 36 | 37 | * seeds.repo.somehub.com 38 | * seeds.trans 39 | * seeds.trans.github.com 40 | 41 | == Updating Seed Banks 42 | 43 | A seed bank and be updated, if it is from a repo, using the `sow update` 44 | command. 45 | 46 | `sow bank update seeds.trans` 47 | 48 | You can see from this that referencing an installed bank (or seed for that 49 | matter) can be done with only a portion of the actual name, as long 50 | as it uniquely identifies the bank. 51 | 52 | == Uninstalling a Seed Bank 53 | 54 | We can uninstall seed bank via the +uninstall+ command. For instance, in 55 | this case let's uninstall the 'seeds.trans' bank. Again we do not have to 56 | give the full name of the bank, only enough to uniquely identify it. We 57 | use the the force option to bypass the confirmation prompt. 58 | 59 | `sow bank uninstall --force seeds.trans` 60 | 61 | We can verify the bank was in fact uninstalled. 62 | 63 | refute seed_bank_exists?('seeds.trans') 64 | 65 | -------------------------------------------------------------------------------- /lib/quarry/template/config.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | class Template 3 | 4 | # Models the `template.yml` file. 5 | # 6 | class Config 7 | 8 | # Lookup glob for `config.yml` file. 9 | GLOB = TEMPLATE_DIRECTORY + '/config.{yml,yaml}' 10 | 11 | # 12 | def initialize(template) 13 | @template = template 14 | @file = Dir.glob(template.path + GLOB).first 15 | 16 | if @file 17 | @config = YAML.load_file(@file.to_s) || {} 18 | else 19 | @config = {} 20 | end 21 | end 22 | 23 | # 24 | attr :template 25 | 26 | # 27 | # The `template.yml` as a Pathname instance. 28 | # 29 | # @return [Pathname] The `template.yml` file. 30 | # 31 | attr :file 32 | 33 | # 34 | # 35 | # 36 | def [](key) 37 | @config[key.to_s] 38 | end 39 | 40 | # 41 | # Project files to use as metadata resources, if they exist. 42 | # Supported formats are YAML and JSON. YAML is assumed if the 43 | # file lacks an extension. 44 | # 45 | # @example 46 | # resource: 47 | # - .ruby 48 | # 49 | def resource 50 | self[:resource] || self[:resources] 51 | end 52 | 53 | # 54 | # Get `arguments` from config file. 55 | # 56 | def arguments 57 | self['arguments'] 58 | end 59 | 60 | # Take arguments from config and transform 61 | # them into `name, options` form. 62 | # 63 | def script_arguments 64 | @script_arguments ||= name_and_options(arguments) 65 | end 66 | 67 | private 68 | 69 | # 70 | def name_and_options(arguments) 71 | case arguments 72 | when Hash 73 | args.map do |name, default| 74 | [name, {:default=>default}] 75 | end 76 | else # Array 77 | args.map do |entry| 78 | case entry 79 | when Hash 80 | entry = entry.rekey 81 | name = entry.delete(:name) 82 | [name, entry] 83 | when Array 84 | [entry.first, :default=>entry.last] 85 | else 86 | [entry, {}] 87 | end 88 | end 89 | end 90 | end 91 | 92 | end #class Config 93 | 94 | end #class Template 95 | end #module Quarry 96 | -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | #!mast -x Syckfile -x man/ronn bin lib man meta qed test [A-Z]* 2 | bin/quarry 3 | lib/quarry/cli/abstract.rb 4 | lib/quarry/cli/bank.rb 5 | lib/quarry/cli/copy.rb 6 | lib/quarry/cli/help.rb 7 | lib/quarry/cli/init.rb 8 | lib/quarry/cli/list.rb 9 | lib/quarry/cli/new.rb 10 | lib/quarry/cli/ore.rb 11 | lib/quarry/cli/remove.rb 12 | lib/quarry/cli/save.rb 13 | lib/quarry/cli/undo.rb 14 | lib/quarry/cli/update.rb 15 | lib/quarry/cli.rb 16 | lib/quarry/constants.rb 17 | lib/quarry/copier.rb 18 | lib/quarry/copy_script/commit.rb 19 | lib/quarry/copy_script/context.rb 20 | lib/quarry/copy_script/metadata.rb 21 | lib/quarry/copy_script.rb 22 | lib/quarry/core_ext.rb 23 | lib/quarry/extensions/color.rb 24 | lib/quarry/extensions/dotruby.rb 25 | lib/quarry/extensions/gemdo.rb 26 | lib/quarry/extensions/logo.rb 27 | lib/quarry/manager.rb 28 | lib/quarry/mine.rb 29 | lib/quarry/miner.rb 30 | lib/quarry/version.rb 31 | lib/quarry.rb 32 | man/sow-basic-ruby.1 33 | man/sow-basic-ruby.1.html 34 | man/sow-cucumber.1 35 | man/sow-cucumber.1.html 36 | man/sow-gemdo.1 37 | man/sow-gemdo.1.html 38 | man/sow-hoe-ruby.1 39 | man/sow-hoe-ruby.1.html 40 | man/sow-license.1 41 | man/sow-license.1.html 42 | man/sow-new.1 43 | man/sow-new.1.html 44 | man/sow-readme.1 45 | man/sow-readme.1.html 46 | qed/01_cli/01_banks.rdoc 47 | qed/01_cli/02_silo.rdoc 48 | qed/01_cli/03_seed.rdoc 49 | qed/01_cli/04_help.rdoc 50 | qed/01_cli/applique/helpers.rb 51 | qed/01_cli/applique/setup.rb 52 | qed/01_cli/samples/foo_seed/Sowfile 53 | qed/01_cli/samples/foo_seed/foo.txt 54 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/LICENSE 55 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/README 56 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/Sowfile 57 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/default/Sowfile.ronn 58 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/LICENSE 59 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/README 60 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/Sowfile 61 | qed/01_cli/samples/sow_home/bank/seeds.repo.somehub.com/demo/Sowfile.ronn 62 | qed/02_api/applique/helpers.rb 63 | qed/02_api/applique/layout.rb 64 | qed/02_api/applique/sources.rb 65 | qed/02_api/layout.md 66 | qed/02_api/miner.md 67 | test/copier_case.rb 68 | test/manager_case.rb 69 | test/samples/source/README 70 | HISTORY.rdoc 71 | LICENSE 72 | README.rdoc 73 | Assembly 74 | -------------------------------------------------------------------------------- /work/reference/mint/site/cp-m.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

cp-m

9 | 10 |

IMPORTANT cp-m is still in early stages of development. Becuase of this 11 | the following documentation might not refect the actualy state of functionailty.

12 | 13 |

Managed Copy

14 | 15 |

cp-m is a managed copy tool. It much like the standard cp command with the interacive 16 | -i option set, but goes even further, by allowing the end user to see diffs and to 17 | commit or abort the entire copy procedure before actually making and writes to disk.

18 | 19 |

Basic Usage

20 | 21 |

Using cp-m is super easy. Here is the most basic example:

22 | 23 |
24 |     $ cp-m FROM.txt TO.txt
25 |   
26 | 27 |

This simply copies FROM.txt file to TO.txt. Just like using cp. 28 | Of course we assume FROM.txt already exits, and TO.txt does not. If FROM.txt 29 | doesn't exit it will report an error, as expected. But if TO.txt already exits?

30 | 31 |
32 |     $ cp-m FROM.txt TO.txt
33 |     KEY (d)iff (c)opy (s)kip (a)ll (q)uit?
34 |       exits: TO.txt ?
35 |   
36 | 37 |

Now we have a choice. We can examine the difference between what the current file 38 | looks like and what it will become, or we can choose to go ahead and copy the file, 39 | overwriting the current file, or we can skip it and not copy it after all.

40 | 41 |

The last two options only mater if you're copying more that one file at a time, 42 | in which case 'all' allows you to skip all remaining files that already exist, 43 | and 'quit' allows you to abort any copying altogether. There is an option to copy all 44 | remaining files irregardless, but we only get thet by passing the --force option to 45 | to the cp-m command. This is an added precaution. We don't want to delete 46 | important files on accident!

47 | 48 |

Finally, after we have made out choice we we be asked if we wish to commit out 49 | selections.

50 | 51 |
52 |     $ cp-m FROM.txt TO.txt
53 |     KEY (d)iff (c)opy (s)kip (a)ll (q)uit?
54 |       exits: TO.txt ?
55 |     Commit (y/N)? 
56 |   
57 | 58 |

Only by entering 'y' here is the copy made.

59 | 60 |
61 | 62 |
63 | 64 | -------------------------------------------------------------------------------- /work/notes/2010-06-03-cli-and-destination.rdoc: -------------------------------------------------------------------------------- 1 | = 2010.06.03 2 | 3 | The question of destination. 4 | 5 | sow ruby myappd 6 | 7 | Should the destination be a required argument of all seeds. 8 | If so, then a seed like a test generator would be kind of odd. 9 | 10 | sow testunit . foo 11 | 12 | But what about all the supporting files vs. just the test 13 | itself? Does creating one test build the support files if they 14 | are not there? But what if someone is using a variant style, 15 | but still wants the test itself? It would seem there would need 16 | to be two scaffolds. 17 | 18 | sow testunit-setup 19 | sow testunit-test 20 | 21 | If we allowed for scaffold options we might do: 22 | 23 | sow testunit 24 | sow testunit --test 25 | 26 | Though that seems a bit long winded. 27 | 28 | What we really have here is the difference between 29 | a scaffolding and a reusable form. 30 | 31 | Now it is not uncommon to want to customize a reusable form 32 | (such as our test form). So in that case it makes sense 33 | that a form would be added to the project somewhere and 34 | utilized from there. Let say a form/ directory. 35 | 36 | If this directory was just anouth template source, but 37 | one that too precedence. Then we could have both private 38 | and share "forms". 39 | 40 | We might ease the typinh involved using an inverse reference 41 | and matching by "best match of first characters", e.g. 42 | 43 | sow testunit 44 | sow test.testunit 45 | sow test.lemon 46 | 47 | If our forms directory had a testunit/test scaffolding and 48 | no other "test" scaffolds and we only put 49 | 50 | sow test 51 | 52 | Then if would assume test.testunit. Only question is how 53 | to store testunit. Let's see. 54 | 55 | plugins/ 56 | sow/ 57 | testunit/ 58 | README 59 | Sowfile 60 | templates/ 61 | test.testunit/ 62 | README 63 | Sowfile 64 | templates/ 65 | 66 | And hence 67 | 68 | forms/ 69 | test.testunit/ 70 | README 71 | Sowfile 72 | templates/ 73 | 74 | We might evn go a step further to ensure distinction between different 75 | seeds witht he same names but form different vendors. 76 | 77 | ~/.config/sow/seeds/ 78 | seeds.trans.github.com/ 79 | testunit.seeds.trans.github.com/ 80 | README 81 | Sowfile 82 | templates/ 83 | test.testunit.seeds.trans.github.com/ 84 | README 85 | Sowfile 86 | templates/ 87 | 88 | 89 | -------------------------------------------------------------------------------- /work/reference/hoe: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby -ws 2 | 3 | $h ||= false 4 | $t ||= false 5 | $d ||= false 6 | 7 | require 'rubygems' 8 | require 'hoe' 9 | require 'fileutils' 10 | require 'erb' 11 | 12 | if $h || ARGV.empty? || ($t && $d) then 13 | puts "usage: #{File.basename $0} [-d|-t] project" 14 | puts " -t = add project to subdir under 'trunk'" 15 | puts " -d = add project to subdir under 'dev'" 16 | exit 17 | end 18 | 19 | project = ARGV.shift 20 | 21 | abort "Project #{project} seems to exist" if test ?d, project 22 | 23 | # variables for erb: 24 | XIF = 'FI' + 'X' # prevents extra hits on my TAG reporter 25 | project, file_name, klass = Hoe.normalize_names project 26 | template_path = File.expand_path("~/.hoe_template") 27 | source_path = File.join(File.dirname(File.dirname(__FILE__)), 28 | "template") 29 | 30 | unless File.directory? template_path then 31 | FileUtils.cp_r source_path, template_path, :verbose => true 32 | paths = (Dir["#{template_path}/**/*"] + 33 | Dir["#{template_path}/**/.*"]).select { |f| File.file? f } 34 | FileUtils.chmod 0644, paths, :verbose => true 35 | FileUtils.chmod 0755, paths.grep(/bin\//), :verbose => true 36 | end 37 | 38 | FileUtils.cp_r template_path, project, :verbose => true 39 | 40 | Dir.chdir project do 41 | dirs = Dir["**/*"].select { |f| File.directory? f }.sort 42 | dirs.grep(/file_name/).each do |file| 43 | FileUtils.mv file, file.gsub(/file_name/, file_name), :verbose => true 44 | end 45 | 46 | paths = (Dir["**/*"] + Dir["**/.*"]).select { |f| File.file? f }.sort 47 | paths.each do |path| 48 | file = File.read path 49 | 50 | warn "erb: #{path}" 51 | 52 | File.open path, "w" do |f| 53 | f.puts ERB.new(file).result(binding) 54 | end 55 | end 56 | 57 | paths.grep(/file_name|\.erb$/).each do |file| 58 | new_file = file.sub(/file_name/, file_name).sub(/\.erb$/, '') 59 | FileUtils.mv file, new_file, :verbose => true 60 | end 61 | end 62 | 63 | if $d || $t then 64 | temp_dir = "#{project}.#{$$}" 65 | FileUtils.mv project, temp_dir, :verbose => true 66 | FileUtils.mkdir project, :verbose => true 67 | FileUtils.mv temp_dir, "#{project}/#{$d ? 'dev' : 'trunk'}", :verbose => true 68 | end 69 | 70 | puts 71 | puts "... done, now go fix all occurrences of '#{XIF}':" 72 | if Hoe::WINDOZE then 73 | puts `findstr /N /S /C:#{XIF} #{project}\\*` 74 | else 75 | puts `find #{project} -type f | xargs grep -n #{XIF}`.gsub(/\A|\n/, "\n ") 76 | end 77 | 78 | -------------------------------------------------------------------------------- /lib/quarry/template/directory.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | class Template 3 | class Directory 4 | 5 | # 6 | IGNORE = [TEMPLATE_DIRECTORY, '.', '..', '.git', '.hg', '.svn', '_darcs'] 7 | 8 | # 9 | def initialize(template, path) 10 | @template = template 11 | @path = Pathname.new(path) 12 | end 13 | 14 | # 15 | # The template object for this directory. 16 | # 17 | # @return [Template] 18 | # 19 | attr :template 20 | 21 | # 22 | # The pathname for this directory. 23 | # 24 | # @return [Pathname] 25 | # 26 | attr :path 27 | 28 | # 29 | # List of directories to be scaffold. 30 | # 31 | def directoires 32 | read unless read? 33 | @directories 34 | end 35 | 36 | # 37 | # List of files to be scaffold. 38 | # 39 | def files 40 | read unless read? 41 | @files 42 | end 43 | 44 | # 45 | # Enumerates through the directories in the template directory. 46 | # 47 | # @yield [path] 48 | # The given block will be passed each directory path. 49 | # 50 | # @yieldparam [String] path 51 | # The relative path of a directory within the template directory. 52 | # 53 | def each_directory(&block) 54 | directories.each(&block) 55 | end 56 | 57 | # 58 | # Iterate over each file. 59 | # 60 | def each_file(&block) 61 | files.each(&block) 62 | end 63 | 64 | # 65 | # Directory path as string. 66 | # 67 | def to_s 68 | path.to_s 69 | end 70 | 71 | private 72 | 73 | def read? 74 | @read 75 | end 76 | 77 | def read 78 | @files = [] 79 | @directories = [] 80 | 81 | Dir.chdir(@path.to_s) do 82 | read_directory('.') 83 | end 84 | end 85 | 86 | def read_directory(dir) 87 | Dir.entries(dir).each do |name| 88 | 89 | # skip specific paths to be ignored 90 | next if IGNORE.include?(name) 91 | # skip partials 92 | next if name.start_with?('_') 93 | 94 | path = File.join(dir, name).sub('./', '') 95 | 96 | if File.directory?(path) 97 | @directories << path 98 | read_directory(path) 99 | else 100 | @files << path 101 | end 102 | end 103 | 104 | @read = true 105 | end 106 | 107 | end 108 | end 109 | end 110 | -------------------------------------------------------------------------------- /work/reference/mint/work/deprecated/lazyfile.rb: -------------------------------------------------------------------------------- 1 | # Scaffold Builder is a specialized class that acts 2 | # as a restricted space with a limited command set 3 | # for preforming scaffolding. 4 | # 5 | # The default behavior is simply to copy all the contents 6 | # of the selected scaffold to the currrent directory. 7 | # But if a scaffold.rb file is provided with the scaffolding 8 | # this script will be run in the Builder context instead. 9 | 10 | class Builder 11 | 12 | def self.create( folder, options=nil ) 13 | i = new 14 | Dir.chdir(folder) do 15 | if File.exist?('scaffold.rb') 16 | code = "def self.install( options=nil )\n" << File.read('scaffold.rb') << "\nend" 17 | i.instance_eval code 18 | end 19 | i.install( options.to_openobject ) 20 | end 21 | return *i.results 22 | end 23 | 24 | # FIXME Need to improve undefining most instance methods for this context. 25 | instance_methods.each{ |m| undef_method m unless m =~ /__|send|class|object|instance/ } 26 | 27 | def initialize( options=nil ) 28 | @note = [] 29 | @dirs = [] 30 | @copy = {} 31 | end 32 | 33 | # Return results. 34 | 35 | def results 36 | return @note, @dirs, @copy 37 | end 38 | 39 | # Change directory in project as it is being build. 40 | # This makes it easy to conditionally build tiers of 41 | # structure. 42 | 43 | def cd( dir ) 44 | if dir == '..' 45 | @cwd = File.dirname(@cdir) 46 | else 47 | @cwd = [@cwd,dir].to_path 48 | end 49 | end 50 | 51 | # Make a new project directory. 52 | 53 | def mkdir(dir) 54 | @dirs << [@cwd,dir].to_path 55 | end 56 | 57 | # Copy +glob+ of files from scaffolding +dir+ to project. 58 | # 59 | # If +to+ is omitted copies the files as named. 60 | # If +to+ is given then the files are renamed or 61 | # relocated accordingly. Use '*' in +to+ to substitute 62 | # for the file name. For example: 63 | # 64 | # copy 'standard', '**/*, 'src/*' 65 | # 66 | # This would copy all the files in the scaffoldings subdirectory, 67 | # +standard/+, to the project directory +src/+. 68 | 69 | def copy(dir, glob, to=nil) 70 | Dir.chdir(dir) do 71 | Dir.glob(glob).collect do |file| 72 | if File.file?(file) 73 | from = File.join(dir, file) 74 | if to 75 | tofile = [@cwd, to.gsub('*', file)].to_path 76 | else 77 | tofile = [@cwd, file].to_path 78 | end 79 | @copy[from] = tofile 80 | else 81 | @dirs << [@cwd, file].to_path 82 | end 83 | end 84 | end 85 | end 86 | 87 | def note( str ) 88 | @note << str 89 | end 90 | 91 | # default installation routine 92 | 93 | def install( options=nil ) 94 | copy '.', '**/*' 95 | end 96 | 97 | end 98 | -------------------------------------------------------------------------------- /lib/quarry/template/script/extensions/logo.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # The Loge extensions provide methods for utilizing any logo file with in 3 | # the destination directory, and a means for grabing a logo image from the 4 | # net if none is found. 5 | #++ 6 | 7 | module Quarry 8 | 9 | class Script 10 | 11 | # Fallback logo file (if all else fails). 12 | LOGO = "assets/logo.png" 13 | 14 | # Return the path to the logo file, which is the first file 15 | # found named `logo.*`. If not found, pull a randomly searched 16 | # image from the Internet for a logo. 17 | # 18 | # Currently the search feature uses BOSSMan to pull from Yahoo 19 | # Image Search, which requires a Yahoo App ID. Of course, it 20 | # would be better if it were generic, but we do what we can. 21 | def logo(options={}) 22 | @logo ||= ( 23 | if file = output.glob_relative('**/logo.*').first 24 | file #.relative_path_from(output) 25 | else 26 | keyword = options[:keyword] 27 | directory = options[:directory] 28 | keyword ||= (metadata.search || metadata.title || metadata.name) 29 | logo_search(keyword, directory) 30 | end 31 | ) 32 | end 33 | 34 | # Yahoo Application ID used by Bossman for finding a logo. 35 | # Yahoo Application ID is looked for in metadata as `yid`, 36 | # then `$HOME/.config/yahoo.id`, and failing this it looks 37 | # for 'YAHOO_ID' environment variable. 38 | def yahoo_id 39 | @yahoo_id ||= ( 40 | metadata.yid || ( 41 | home = Pathname.new(File.expand_path('~')) 42 | file = home.glob('.config/yahoo.id').first unless file 43 | file ? file.read.strip : ENV['YAHOO_ID'] 44 | ) 45 | ) 46 | end 47 | 48 | # Logo search using Bossman. 49 | def logo_search(keyword, dir='assets') 50 | return LOGO unless require_bossman 51 | return LOGO unless yahoo_id 52 | keyword = keyword.to_s 53 | begin 54 | BOSSMan.application_id = yahoo_id # 55 | boss = BOSSMan::Search.images(keyword, {:dimensions => "small"}) 56 | if boss.count == "0" 57 | boss = BOSSMan::Search.images("clipart", {:dimensions => "small"}) 58 | end 59 | url = boss.results[rand(boss.results.size)].url 60 | ext = File.extname(url) 61 | dir = output + dir 62 | out = dir + "logo#{ext}" 63 | fu.mkdir_p(dir) unless dir.exist? 64 | open(url) do |i| 65 | open(out, 'wb') do |o| 66 | o << i.read 67 | end 68 | end 69 | out.to_s 70 | rescue 71 | LOGO 72 | end 73 | end 74 | 75 | # Require Bossman library for Yahoo image search. 76 | def require_bossman 77 | begin 78 | require 'bossman' 79 | require 'open-uri' 80 | true 81 | rescue LoadError 82 | nil 83 | end 84 | end 85 | 86 | end 87 | 88 | end 89 | 90 | -------------------------------------------------------------------------------- /work/reference/mint/lib/mint/generators/create.rb: -------------------------------------------------------------------------------- 1 | require 'sow/generators/base' 2 | 3 | module Sow 4 | 5 | module Generators 6 | 7 | # = Create Generator 8 | # 9 | class Create < Base 10 | 11 | # 12 | def copy(loc, src, dest, opts) 13 | tmp = File.join(loc, src) 14 | if File.directory?(tmp) 15 | copy_dir(loc, src, dest, opts) 16 | else 17 | copy_doc(loc, src, dest, opts) 18 | end 19 | end 20 | 21 | # 22 | def copy_dir(loc, src, dest, opts) 23 | if File.exist?(dest) #&& src == dest 24 | how = 'same' 25 | else 26 | mkdir_p(dest) 27 | how = 'create' 28 | end 29 | return how, dest 30 | end 31 | 32 | # TODO: Can .stub be used to prevent erb? 33 | def copy_doc(loc, src, dest, opts) 34 | tmp = File.join(loc, src) 35 | #ext = File.extname(src) 36 | #case ext 37 | #when '.erb' 38 | if opts['verbatim'] 39 | how = (File.exist?(dest) ? 'update' : 'create') 40 | #file = tmp_file.chomp('.stub') 41 | cp(tmp, dest) 42 | else 43 | #file = tname.chomp('.erb') # old way 44 | text = erb(tmp) 45 | how = (File.exist?(dest) ? 'update' : 'create') 46 | write(dest, text) 47 | end 48 | if opts['chmod'] 49 | chmod(opts['chmod'], dest) 50 | end 51 | return how, dest 52 | end 53 | 54 | # 55 | #def erb(file) 56 | # plugin.erb(file) 57 | #end 58 | 59 | =begin 60 | ### 61 | def erb(file) 62 | text = nil 63 | temp = Context.new(plugin) 64 | begin 65 | text = temp.erb(file) 66 | rescue => e 67 | if trace? 68 | raise e 69 | else 70 | abort "template error -- #{file}" 71 | end 72 | end 73 | return text 74 | end 75 | 76 | 77 | ### Copy a directory varbatim; wich means 78 | ### just doing a mkdir. 79 | def verbatim_dir(tname, fname) 80 | if File.exist?(fname) 81 | #logger.report_create(fname, 'identical') 82 | 'identical' 83 | else 84 | #logger.report_create(fname, 'create') 85 | mkdir_p(fname) 86 | 'create' 87 | end 88 | end 89 | 90 | ### Copy a file verbatim. 91 | def verbatim_file(tname, fname) 92 | #ext = File.extname(tname) 93 | doc = File.join(source, tname) 94 | if File.exist?(fname) 95 | how = 'update' 96 | else 97 | how = 'create' 98 | end 99 | #file = tmp_file.chomp('.stub') 100 | #file = file.sub('__name__', name) 101 | cp(doc, fname) 102 | return how 103 | end 104 | =end 105 | 106 | end 107 | 108 | end 109 | 110 | end 111 | 112 | -------------------------------------------------------------------------------- /work/defunct/qed/01_cli/03_seed.rdoc: -------------------------------------------------------------------------------- 1 | = Planting Seeds 2 | 3 | == Getting a List of Available Seeds 4 | 5 | Before generating a seed, it is of course helpfule to know what seeds 6 | are available. This is easily done via the `sow list` command. 7 | 8 | `sow list` 9 | 10 | The output will look like something like this ... 11 | 12 | * cucumber 13 | * feature.cucumber 14 | * ruby 15 | 16 | == Creating New Projects 17 | 18 | The +new+ command is used to create a new project directory ready for new 19 | scaffolding to be added. Without providing a seed name following the directory 20 | argument, sow will simply create the directory. 21 | 22 | `sow new tmp/qed/foo` 23 | 24 | File.assert.directory?('tmp/qed/foo/.sow') 25 | 26 | By providing a seed name, +new+ is usefuly for quickly scaffold new project 27 | layouts from scratch. 28 | 29 | `sow new tmp/qed/bar demo name=CoolCat` 30 | 31 | We can verify the scaffoling was built as expected. 32 | 33 | File.assert.file?('tmp/qed/bar/README') 34 | File.assert.file?('tmp/qed/bar/LICENSE') 35 | readme = File.read('tmp/qed/bar/README') 36 | readme.assert.index('CoolCat') 37 | 38 | If the directory already exists, to which the new project will 39 | be made, then an error is reported. 40 | 41 | `sow new tmp/qed/bar` 42 | 43 | @err.assert.include?('already exists') 44 | 45 | == Seeding Existing Projects 46 | 47 | The +gen+ command allows the end-user to add new scaffoling to an already 48 | established project, or an empty directory. 49 | 50 | For example, given an empty temporary directory 'foo' we can generate 51 | the demo seed. 52 | 53 | Dir.chdir('tmp/qed/foo') { 54 | `sow seed demo name=CoolCat` 55 | } 56 | 57 | We will find the demo seed's files present. 58 | 59 | File.assert.file?('tmp/qed/foo/README') 60 | File.assert.file?('tmp/qed/foo/LICENSE') 61 | readme = File.read('tmp/qed/foo/README') 62 | readme.assert.index('CoolCat') 63 | 64 | Working from within a project that is already established, we will 65 | need to contend with possbile merge conflicts. 66 | 67 | For example, lets say the 'foo' project already has a README file. There 68 | are three ways to handle this. We can either instruct sow to automatically 69 | skip any conflicting files via the --skip option, leaving the original 70 | intact. 71 | 72 | Dir.chdir('tmp/qed/foo') { 73 | `sow seed demo name=CoolCat --skip` 74 | } 75 | 76 | We can verify, 77 | 78 | readme = File.read('tmp/qed/foo/README') 79 | readme.refute.index('CoolCat') 80 | 81 | Or we can instruct sow to automatically overwrite any conflicting files 82 | via the --write option. 83 | 84 | Dir.chdir('tmp/qed/foo') { 85 | `sow seed demo name=CoolCat --write` 86 | } 87 | 88 | We can verify, 89 | 90 | readme = File.read('tmp/qed/foo/README') 91 | readme.assert.index('CoolCat') 92 | 93 | Or we can use the --prompt option to have sow ask which to do for each 94 | overlapping file encountered. We will not test that here as it requires 95 | user input for each file in question. 96 | 97 | -------------------------------------------------------------------------------- /lib/quarry.rb: -------------------------------------------------------------------------------- 1 | # Quarry namespace in which all components are defined. 2 | # 3 | # Quarry does use a few core extensions, but these are 4 | # all managed by Ruby Facets to help promote standardization 5 | # in the area and reduce potential name conflicts. 6 | # 7 | module Quarry 8 | 9 | require 'erb' 10 | #require 'malt' 11 | require 'fileutils' 12 | require 'tmpdir' 13 | require 'uri' 14 | 15 | require 'finder' 16 | 17 | require 'quarry/version' 18 | require 'quarry/error' 19 | require 'quarry/cli' 20 | require 'quarry/config' 21 | require 'quarry/copier' 22 | require 'quarry/generator' 23 | require 'quarry/template' 24 | require 'quarry/template/management' 25 | require 'quarry/template/directory' 26 | require 'quarry/template/config' 27 | require 'quarry/template/readme' 28 | require 'quarry/template/script' 29 | require 'quarry/template/context' 30 | require 'quarry/template/script/metadata' 31 | require 'quarry/template/script/commit' # transaction? 32 | 33 | # 34 | # Run quarry command line interface. 35 | # 36 | def self.cli(*argv) 37 | CLI.run(*argv) 38 | end 39 | 40 | # 41 | # Returns a template matching +name+. 42 | # 43 | def self.find(name) 44 | Template.find(name) 45 | end 46 | 47 | # 48 | # Initialize a directory for use with Quarry. 49 | # 50 | # TODO: Do we really need this? 51 | # 52 | def self.init(output) 53 | FileUtils.mkdir_p(File.join(output, '.0re')) 54 | end 55 | 56 | # 57 | # Print a list of all available ore. 58 | # 59 | def self.list 60 | Template.list 61 | end 62 | 63 | # 64 | # Fetch template from remote location. 65 | # 66 | def self.fetch(uri, options={}) 67 | Template.fetch(uri, options) 68 | end 69 | 70 | # 71 | # Update scm based mine(s). 72 | # 73 | def self.update(name=nil) 74 | Template.update(name) 75 | end 76 | 77 | # 78 | # Save a directory as a mine to a user's personal mine bank, i.e. "silo". 79 | # 80 | def self.save(name, path=nil) 81 | Template.save(name, path) 82 | end 83 | 84 | # 85 | # Remove mine. 86 | # 87 | def self.remove(name) 88 | Template.remove(name) 89 | end 90 | 91 | # 92 | # Use Quarry's managed copy utility to copy the contents of one directory to 93 | # another. 94 | # 95 | def self.copy(from, to, options={}) 96 | copier = Quarry::Copier.new(from, to, options) 97 | copier.copy 98 | end 99 | 100 | # Undo the previous quarrying. 101 | # 102 | # FIXME: what is being restored? Also, while this will overwrite changed 103 | # files, it won't remove new files created by the mine. Need to fix! 104 | # 105 | # TODO: Use the underlying SCM to handle this!!! 106 | # 107 | def self.undo(output, options) 108 | backup = Dir[File.join(output, '.quarry/undo/*')].sort.last 109 | copier = Quarry::Copier.new(backup, output, options) 110 | copier.copy 111 | FileUtils.rm_r(backup) 112 | end 113 | 114 | # 115 | # 116 | # 117 | def self.help(name) 118 | Template.help(name) 119 | end 120 | 121 | end 122 | -------------------------------------------------------------------------------- /work/notes/2009-08-30-cli-and-plugins.rdoc: -------------------------------------------------------------------------------- 1 | = NOTES ON SOW 2 | 3 | == Commandline Interface of Plugins 4 | 5 | === Option 1 6 | 7 | The traditional approach is to allow a plugin to specify any commandline 8 | arguments and/or options it may want to generate scaffolding. 9 | For example, we might see something like: 10 | 11 | sow ruby myapp --no-bin --man 12 | 13 | Which would scaffold a Ruby project named 'myapp' with a manpage 14 | entry but no defualt executable. Allowing this flexibility in 15 | designatin plugin options, we can make our plugins quite feature 16 | rich. 17 | 18 | We wouldn't want to get too crazy though, as in many cases it would 19 | just as well to have an additional plugin. For example, we will 20 | want to have a cucumber plugin so we can create features, thus 21 | adding --cucumber option to the ruby plugin is purely a convenience. 22 | One could just as well do: 23 | 24 | $ sow ruby myapp 25 | $ sow cucumber myapp 26 | 27 | Instead of 28 | 29 | $ sow ruby --cucumber myapp 30 | 31 | (Note I am ignoring the issue of directory creation for the moment.) 32 | 33 | This has the benifit of saving the ruby plugin from having to 34 | support an almost endless steram of possbile options (rcov, flog, 35 | rake, testunit, rspec, bacon, setup.rb, and so on.), and of which 36 | one could reasonably argue deserves presence. 37 | 38 | === Option 2 39 | 40 | I've noticed that every *particular* scaffolding I can conceive can 41 | generally be accomplished with a single argument. That being the case 42 | each plugin could simply be invoked as a commandline switch. 43 | 44 | sow --ruby[=] [pathname] 45 | 46 | To copy ruby scaffolding into subdirectory +name+. 47 | 48 | sow --ruby 49 | 50 | In which case the name of the project and the subdirectory would be 51 | the same. 52 | 53 | This notation allows for multiple plugins to be invoked in the same 54 | command. For instance, lets use our cucumber plugin. We could build 55 | a ruby project with a cucumber test in one go. 56 | 57 | sow --ruby --cucumber 58 | 59 | The cucumber plugin defaults the name of the feature to the pathname, 60 | in the same fashion as the ruby project name. To make it different, 61 | 62 | sow --ruby --cucumber=myfeature 63 | 64 | We could even invoke the cucumber plugin multiple times in one line. 65 | 66 | So this brings about the notion of having many small plugins, rather 67 | then fewer more complex plugins like Option 1 encourages. For example, 68 | we might have a +bin+ plugin. 69 | 70 | sow --bin=foo 71 | 72 | In some respects that is rather nice, in that the units are small and 73 | tight. The dwonside however, is that we loose a great deal of flexibility 74 | in building "feature rich" scaffolds. 75 | 76 | So the question we must to ask is whether these numerous small scaffolds 77 | can cover the same range of usecases that larger more complex scaffolds 78 | can? Can we think of a case that would simply be too severly hampered by 79 | limited commandline options? Or, on the other hand, is there a way to 80 | offer some additional flexibity in options when it required? 81 | 82 | I like this later appraoch and I am going to rewrite Sow to use it, since 83 | it certainly will owrk well for most cases. Later I will return to 84 | question of offering additional option control and see if we can't add 85 | that capability into the system in some fashion. 86 | 87 | -------------------------------------------------------------------------------- /work/reference/mint/test/fixtures/loremipsum.txt: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce lorem tortor, cursus sit amet, pretium vitae, tristique non, enim. Vivamus in mauris vel ligula interdum vehicula. Etiam cursus est sit amet ipsum. Nulla viverra, ante eget aliquet sollicitudin, nisi eros rutrum diam, iaculis adipiscing quam sem nec enim. In non mi a tellus viverra sollicitudin. Nulla facilisi. Nulla hendrerit orci. In accumsan sagittis massa. Suspendisse nonummy vestibulum lacus. Sed scelerisque. Mauris magna ligula, pellentesque ac, venenatis vitae, volutpat et, nulla. Nunc a odio a elit viverra nonummy. Proin id lorem id lacus adipiscing posuere. Curabitur varius, nulla eget tincidunt euismod, nisi ligula aliquet augue, eget varius mauris nunc nec nunc. Nullam odio leo, laoreet eget, porttitor pharetra, scelerisque quis, augue. Sed ut elit sit amet dolor ultricies pretium. Duis volutpat ligula quis libero. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas consectetuer augue vel ipsum. 2 | 3 | In lectus. Ut feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum mi erat, gravida id, fringilla sit amet, faucibus nec, metus. Suspendisse aliquam tempus enim. Proin luctus. Sed tempor, lectus eget dapibus fringilla, nibh tortor accumsan leo, quis tincidunt magna enim ac tortor. Nunc nec elit ut ligula volutpat accumsan. Suspendisse congue tortor sit amet sapien. Nulla semper ligula eget neque. Vivamus porta facilisis nibh. Nunc in elit. Sed nunc. Phasellus cursus erat. 4 | 5 | Nulla mauris mi, consectetuer at, lobortis iaculis, feugiat non, quam. In ante. Donec imperdiet, purus eget hendrerit rutrum, tellus magna lobortis ligula, vel pharetra enim nisl eget nisi. Nulla et dolor. Curabitur lacinia. Proin at felis. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam vulputate imperdiet libero. Duis magna erat, viverra eget, vulputate eu, commodo vel, diam. Nam volutpat, ipsum nec placerat sagittis, purus leo facilisis dolor, a placerat lectus nisl vel lacus. Ut ut nulla. Nunc pede. Donec et nisl. 6 | 7 | Pellentesque adipiscing lectus id odio. Ut eu nulla. Vivamus dignissim. Nam est. Cras luctus sagittis magna. Nunc at odio. Nullam ultrices, pede id ultricies dignissim, turpis enim vehicula ipsum, a varius odio libero in neque. Sed consequat sollicitudin risus. Sed nec ante vitae tortor fringilla hendrerit. Fusce rhoncus sem dignissim velit. Curabitur a augue. Nulla hendrerit, velit eu condimentum feugiat, dolor dui fermentum dui, eu venenatis ante ipsum consequat orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras dapibus, metus in porttitor malesuada, dui turpis nonummy sapien, a dignissim enim urna non ante. Aliquam non felis. 8 | 9 | Vivamus risus magna, faucibus sed, vulputate hendrerit, hendrerit eu, metus. Mauris posuere. Vivamus in massa. In mollis mauris non diam. Nullam vestibulum consectetuer eros. Nulla facilisi. Nullam a quam in velit imperdiet dapibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Duis pulvinar condimentum arcu. Duis tempus tempus ligula. Fusce ac ipsum sed magna euismod auctor. Cras egestas, dui mattis sollicitudin vehicula, tortor dui viverra odio, eu commodo enim libero eu massa. Donec id nibh. Praesent hendrerit iaculis magna. Aliquam hendrerit felis ornare tellus. Morbi ultricies consequat magna. Duis faucibus facilisis odio. Suspendisse potenti. Integer ut sapien. 10 | -------------------------------------------------------------------------------- /test/case_copier.rb: -------------------------------------------------------------------------------- 1 | Covers 'sow/copier' 2 | 3 | TestCase Sow::Copier do 4 | 5 | source = 'test/samples/source' 6 | output = 'test/samples/output' 7 | 8 | Unit :source => '' do 9 | copier = Sow::Copier.new(source, output) 10 | copier.source.assert = Pathname.new(File.expand_path(source)) 11 | end 12 | 13 | Unit :output => '' do 14 | copier = Sow::Copier.new(source, output) 15 | copier.output.assert = Pathname.new(File.expand_path(output)) 16 | end 17 | 18 | Unit :options => '' do 19 | copier = Sow::Copier.new(source, output, :mode=>:skip) 20 | copier.options.assert.is_a?(Hash) 21 | copier.options[:mode] == :skip 22 | end 23 | 24 | Unit :skip? => 'is true if mode is skip' do 25 | copier = Sow::Copier.new(source, output, :mode=>:skip) 26 | copier.assert.skip? 27 | copier = Sow::Copier.new(source, output, :mode=>:write) 28 | copier.refute.skip? 29 | copier = Sow::Copier.new(source, output) 30 | copier.refute.skip? 31 | end 32 | 33 | Unit :write? => 'is ture if mode is write' do 34 | copier = Sow::Copier.new(source, output, :mode=>:write) 35 | copier.assert.write? 36 | copier = Sow::Copier.new(source, output, :mode=>:skip) 37 | copier.refute.write? 38 | copier = Sow::Copier.new(source, output) 39 | copier.refute.write? 40 | end 41 | 42 | Unit :prompt? => 'is true if mode is prompt' do 43 | copier = Sow::Copier.new(source, output, :mode=>:prompt) 44 | copier.assert.prompt? 45 | copier = Sow::Copier.new(source, output) 46 | copier.refute.prompt? 47 | end 48 | 49 | Unit :managed? => 'false if mode is nil' do 50 | copier = Sow::Copier.new(source, output) 51 | copier.refute.managed? 52 | end 53 | 54 | Unit :managed? => 'true if mode is write' do 55 | copier = Sow::Copier.new(source, output, :mode=>:write) 56 | copier.assert.managed? 57 | end 58 | 59 | Unit :managed? => 'true if mode is skip' do 60 | copier = Sow::Copier.new(source, output, :mode=>:skip) 61 | copier.assert.managed? 62 | end 63 | 64 | Unit :managed? => 'true if mode is prompt' do 65 | copier = Sow::Copier.new(source, output, :mode=>:prompt) 66 | copier.assert.managed? 67 | end 68 | 69 | Unit :debug? => 'is the same as $DEBUG' do 70 | copier = Sow::Copier.new(source, output) 71 | copier.debug?.assert == $DEBUG 72 | end 73 | 74 | Unit :trial? => 'is the same as $DRYRUN' do 75 | copier = Sow::Copier.new(source, output) 76 | copier.trial?.assert == $DRYRUN 77 | end 78 | 79 | Unit :backup? => 'true unless specifically set to false' do 80 | copier = Sow::Copier.new(source, output) 81 | copier.assert.backup? 82 | copier = Sow::Copier.new(source, output, :backup=>false) 83 | copier.refute.backup? 84 | end 85 | 86 | #Unit :logger => '' do 87 | # copier = Sow::Copier.new(source, output, :quiet=>true) 88 | # copier.logger.assert.is_a?(Sow::Logger) 89 | #end 90 | 91 | Unit :quiet? => '' do 92 | copier = Sow::Copier.new(source, output, :quiet=>true) 93 | copier.assert.quiet? 94 | copier = Sow::Copier.new(source, output, :quiet=>false) 95 | copier.refute.quiet? 96 | end 97 | 98 | Unit :copylist => '' do 99 | copier = Sow::Copier.new(source, output, :quiet=>true) 100 | copier.copylist.assert = ['README'] 101 | end 102 | 103 | Unit :copy => '' do 104 | raise Pending 105 | end 106 | 107 | Unit :identical? => '' do 108 | raise Pending 109 | end 110 | 111 | end 112 | 113 | -------------------------------------------------------------------------------- /man/man1/quarry.1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | sow-new(1) - germinate a new seed 7 | 44 | 45 | 52 | 53 |
54 | 55 | 61 | 62 |
    63 |
  1. sow-new(1)
  2. 64 |
  3. 65 |
  4. sow-new(1)
  5. 66 |
67 | 68 |

NAME

69 |

70 | sow-new - germinate a new seed 71 |

72 | 73 |

SYNOPSIS

74 | 75 |

sow new path name [args...]

76 | 77 |

DESCRIPTION

78 | 79 |

Germinate a new seed.

80 | 81 |

OPTIONS

82 | 83 |

These options control whether output is written to file(s).

84 | 85 |
86 |
-f, --force
Force overwrites of any destination files that already exist.
87 |
88 | 89 | 90 | 91 |
    92 |
  1. RubyWorks
  2. 93 |
  3. October 2010
  4. 94 |
  5. sow-new(1)
  6. 95 |
96 | 97 |
98 | 99 | 100 | -------------------------------------------------------------------------------- /work/quickstart.rdoc: -------------------------------------------------------------------------------- 1 | = Sow -- Quick Start Guide 2 | 3 | Tending Project Ecology 4 | 5 | http://sow.rubyforge.org 6 | 7 | 8 | == Introduction 9 | 10 | Sow is a project scaffolding generator. Techincally it is a simple templating system 11 | based on eRuby, but it is designed with project templating squarely in mind. 12 | 13 | 14 | == Installation 15 | 16 | Install using RubyGems as you would expect: 17 | 18 | $ gem install sow 19 | 20 | There is no manual install at the moment. This will be fixed in a future release. 21 | 22 | 23 | == Usage 24 | 25 | To scaffold a new project try: 26 | 27 | $ sow myapp 28 | 29 | You will see the following output: 30 | 31 | Transferring reap -> myapp: 32 | 33 | create CHANGES 34 | create COPYING 35 | create METADATA 36 | create NEWS 37 | create README 38 | create admin 39 | create admin/config 40 | create admin/pkg 41 | create admin/temps 42 | create admin/temps/lib 43 | create admin/temps/lib/myapp 44 | create admin/temps/lib/myapp/about.rb.erb 45 | create admin/web 46 | create bin 47 | create data 48 | create doc 49 | create doc/rdoc 50 | create doc/ri 51 | create lib 52 | create lib/my-app 53 | create test 54 | 55 | You need to fix the occurances of 'FIX' in the following files: 56 | 57 | README 58 | 59 | Note the mention of 'reap'. By default Sow scaffolds a project suitable 60 | for use with the Reap build system. This is a good project layout even 61 | if you aren't using Reap. But reap support other scaffold types as well. 62 | Simply sepcify the type before the project/directory name. For instance, 63 | if you prefere an old-fashioned Ruby project: 64 | 65 | $ sow ruby myapp 66 | 67 | With your project in place, be sure to go over the contents and fine-tune them. 68 | In particular, edit the files that contain 'FIX' entries. 69 | 70 | Sow operates in generation mode when you are in a "sow-ready" project. 71 | Sow idetifies such a project by a @.sow@ directory located in the projects 72 | root folder. 73 | 74 | We can use partial scaffolds too. For instance you may want to add a standard 75 | Rakefile. You can do that with Sow: 76 | 77 | $ cd myapp 78 | $ sow ruby Rakefile 79 | 80 | Sow can continue to be used for in-project templates. To do this, add templates 81 | to the temps/ or admin/temps directories, reflecting the same layout of your project. 82 | For example: 83 | 84 | myapp/ 85 | lib/ 86 | myapp/ 87 | myapp.rb 88 | temps/ 89 | lib/ 90 | myapp/ 91 | myapp.rb.erb 92 | meta/ 93 | ... 94 | 95 | Change into your project directory and run: 96 | 97 | $ sow 98 | 99 | Project files will be generated based on the templates and metadata entries. 100 | 101 | 102 | == Hoe Users 103 | 104 | Hoe users will notice that the sow command that comes with Hoe is overwritten by Sow. Sow support Hoe 105 | projects, so there is nothing lost. Simply use: 106 | 107 | $ sow hoe 108 | 109 | Note, that Hoe scaffolding does not support the in-project templating system. To get that you need to create a meta/ 110 | direcroty in your project, and a place to store templates, eg. temps/. 111 | 112 | 113 | == Copying 114 | 115 | Copyright (c) 2007, 2008 TigerOps 116 | 117 | This program is free software: you can redistribute it and/or modify 118 | it under the terms of the GNU General Public License as published by 119 | the Free Software Foundation, either version 3 of the License, or 120 | (at your option) any later version. 121 | 122 | This program is distributed in the hope that it will be useful, 123 | but WITHOUT ANY WARRANTY; without even the implied warranty of 124 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 125 | GNU General Public License for more details. 126 | 127 | You should have received a copy of the GNU General Public License 128 | along with this program. If not, see <http://www.gnu.org/licenses/>. 129 | 130 | -------------------------------------------------------------------------------- /lib/quarry/template.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | 3 | # Template encapsulates a directory to be used as scaffolding. 4 | # 5 | # In Quarry's colloquial terminology this may be called a *mine*. 6 | # 7 | class Template 8 | 9 | # 10 | # Initialize new template. 11 | # 12 | # @param [String] path 13 | # Location of the template in the file system. 14 | # 15 | def initialize(name, path, options={}) 16 | @name = polish(name) 17 | @directory = Directory.new(self, path) 18 | @type = options[:type] 19 | 20 | #raise "not a template - #{name}" unless @config_file 21 | end 22 | 23 | # 24 | # The name of a template is essentially the directory in which 25 | # it is stored, but modified to be more utlitilitarian to the 26 | # end-user when referencing it on the command line. This is done 27 | # by spliting the path at the path dividers (`/`) and rejoining 28 | # themin reverse order with a dot (`.`). 29 | # 30 | # @return [String] Name of template. 31 | # 32 | attr :name 33 | 34 | # 35 | # Instance of Template::Directory. 36 | # 37 | attr :directory 38 | 39 | # 40 | # Type of template: `:remote`, `:project`, `:plugin`. 41 | # 42 | attr :type 43 | 44 | # 45 | # Location of template as Pathname. 46 | # 47 | # @return [Pathname] Template path. 48 | # 49 | def path 50 | @directory.path 51 | end 52 | 53 | # 54 | # Template configuration. 55 | # 56 | def config 57 | @config ||= Config.new(self) 58 | end 59 | 60 | # 61 | # @deprecated Use `config.file` instead. 62 | # 63 | def config_file 64 | config.file 65 | end 66 | 67 | # 68 | # Copy script. Defaults to `copy all`. 69 | # 70 | def script 71 | @script ||= Script.new(self) 72 | end 73 | 74 | # 75 | # 76 | # 77 | def readme 78 | @readme ||= Readme.new(self) 79 | end 80 | 81 | # 82 | # Contents of the README file. 83 | # 84 | def help(lang='en') 85 | readme.to_s(lang) 86 | end 87 | 88 | # 89 | # Returns the list of template files, less files to be ignored 90 | # for scaffolding. 91 | # 92 | # @return [Array] List of scaffolding files. 93 | # 94 | def files 95 | directory.files 96 | 97 | #@files ||= ( 98 | # files = [] 99 | # Dir.recurse(directory.to_s) do |path| 100 | # next if IGNORE_FILES.include?(File.basename(path)) 101 | # files << path.sub(directory.to_s+'/','') 102 | # end 103 | # files.reject{ |f| File.match?(CONFIG_FILE) } 104 | #) 105 | end 106 | 107 | # 108 | # Returns the list of template directories, less those to be ignored 109 | # for scaffolding. 110 | # 111 | # @return [Array] List of scaffolding directories. 112 | # 113 | def directories 114 | directory.directoires 115 | end 116 | 117 | =begin 118 | def name 119 | @name ||= ( 120 | rpath = path.to_s.sub(/^#{location}/, '') 121 | rpath = rpath[1..-1] if rpath.start_with?('/') 122 | 123 | return rpath 124 | 125 | i = rpath.index('/') 126 | if i 127 | base = rpath.to_s[0...i] 128 | name = rpath.to_s[i+1..-1] 129 | "#{name}@#{base}" 130 | else 131 | rpath 132 | end 133 | #rpath = path.to_s.sub(/^#{location}/, '') 134 | #parts = rpath.split('/') 135 | #parts.reverse.join('.').chomp('.') 136 | ) 137 | end 138 | =end 139 | 140 | # Do it! 141 | #def quarry!(selection, arguments, settings, options) 142 | # Seeder.new(self, selection, arguments, settings, options) 143 | # mineer.call 144 | #end 145 | 146 | # 147 | # Same as template name. 148 | # 149 | def to_s 150 | name.to_s 151 | end 152 | 153 | # 154 | # 155 | # 156 | def update 157 | begin 158 | scm = SCM.new(directory.to_s) 159 | scm.pull(:force=>true) 160 | rescue ArgumentError 161 | # not a scm repo 162 | end 163 | end 164 | 165 | private 166 | 167 | def polish(name) 168 | name.split('/').reverse.join('.') 169 | end 170 | 171 | end 172 | 173 | end 174 | -------------------------------------------------------------------------------- /.gemspec: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'yaml' 4 | 5 | module DotRuby 6 | 7 | # 8 | class GemSpec 9 | 10 | # For which revision of .ruby is this gemspec intended? 11 | REVISION = 0 12 | 13 | # 14 | PATTERNS = { 15 | :bin_files => 'bin/*', 16 | :lib_files => 'lib/{**/}*.rb', 17 | :ext_files => 'ext/{**/}extconf.rb', 18 | :doc_files => '*.{txt,rdoc,md,markdown,tt,textile}', 19 | :test_files => '{test/{**/}*_test.rb,spec/{**/}*_spec.rb}' 20 | } 21 | 22 | # 23 | def self.instance 24 | new.to_gemspec 25 | end 26 | 27 | attr :metadata 28 | 29 | attr :manifest 30 | 31 | # 32 | def initialize 33 | @metadata = YAML.load_file('.ruby') 34 | @manifest = Dir.glob('manifest{,.txt}', File::FNM_CASEFOLD).first 35 | 36 | if @metadata['revision'].to_i != REVISION 37 | warn "You have the wrong revision. Trying anyway..." 38 | end 39 | end 40 | 41 | # 42 | def scm 43 | @scm ||= \ 44 | case 45 | when File.directory?('.git') 46 | :git 47 | end 48 | end 49 | 50 | # 51 | def files 52 | @files ||= \ 53 | #glob_files[patterns[:files]] 54 | case 55 | when manifest 56 | File.readlines(manifest). 57 | map{ |line| line.strip }. 58 | reject{ |line| line.empty? || line[0,1] == '#' } 59 | when scm == :git 60 | `git ls-files -z`.split("\0") 61 | else 62 | Dir.glob('{**/}{.*,*}') # TODO: be more specific using standard locations ? 63 | end.select{ |path| File.file?(path) } 64 | end 65 | 66 | # 67 | def glob_files(pattern) 68 | Dir.glob(pattern).select { |path| 69 | File.file?(path) && files.include?(path) 70 | } 71 | end 72 | 73 | # 74 | def patterns 75 | PATTERNS 76 | end 77 | 78 | # 79 | def executables 80 | @executables ||= \ 81 | glob_files(patterns[:bin_files]).map do |path| 82 | File.basename(path) 83 | end 84 | end 85 | 86 | def extensions 87 | @extensions ||= \ 88 | glob_files(patterns[:ext_files]).map do |path| 89 | File.basename(path) 90 | end 91 | end 92 | 93 | # 94 | def name 95 | metadata['name'] || metadata['title'].downcase.gsub(/\W+/,'_') 96 | end 97 | 98 | # 99 | def to_gemspec 100 | Gem::Specification.new do |gemspec| 101 | gemspec.name = name 102 | gemspec.version = metadata['version'] 103 | gemspec.summary = metadata['summary'] 104 | gemspec.description = metadata['description'] 105 | 106 | metadata['authors'].each do |author| 107 | gemspec.authors << author['name'] 108 | 109 | if author.has_key?('email') 110 | if gemspec.email 111 | gemspec.email << author['email'] 112 | else 113 | gemspec.email = [author['email']] 114 | end 115 | end 116 | end 117 | 118 | gemspec.licenses = metadata['copyrights'].map{ |c| c['license'] }.compact 119 | 120 | metadata['requirements'].each do |req| 121 | name = req['name'] 122 | version = req['version'] 123 | groups = req['groups'] || [] 124 | 125 | case version 126 | when /^(.*?)\+$/ 127 | version = ">= #{$1}" 128 | when /^(.*?)\-$/ 129 | version = "< #{$1}" 130 | when /^(.*?)\~$/ 131 | version = "~> #{$1}" 132 | end 133 | 134 | if groups.empty? or groups.include?('runtime') 135 | # populate runtime dependencies 136 | if gemspec.respond_to?(:add_runtime_dependency) 137 | gemspec.add_runtime_dependency(name,*version) 138 | else 139 | gemspec.add_dependency(name,*version) 140 | end 141 | else 142 | # populate development dependencies 143 | if gemspec.respond_to?(:add_development_dependency) 144 | gemspec.add_development_dependency(name,*version) 145 | else 146 | gemspec.add_dependency(name,*version) 147 | end 148 | end 149 | end 150 | 151 | # convert external dependencies into a requirements 152 | if metadata['external_dependencies'] 153 | ##gemspec.requirements = [] unless metadata['external_dependencies'].empty? 154 | metadata['external_dependencies'].each do |req| 155 | gemspec.requirements << req.to_s 156 | end 157 | end 158 | 159 | # determine homepage from resources 160 | homepage = metadata['resources'].find{ |key, url| key =~ /^home/ } 161 | gemspec.homepage = homepage.last if homepage 162 | 163 | gemspec.require_paths = metadata['load_path'] || ['lib'] 164 | gemspec.post_install_message = metadata['install_message'] 165 | 166 | # RubyGems specific metadata 167 | gemspec.files = files 168 | gemspec.extensions = extensions 169 | gemspec.executables = executables 170 | 171 | if Gem::VERSION < '1.7.' 172 | gemspec.default_executable = gemspec.executables.first 173 | end 174 | 175 | gemspec.test_files = glob_files(patterns[:test_files]) 176 | 177 | unless gemspec.files.include?('.document') 178 | gemspec.extra_rdoc_files = glob_files(patterns[:doc_files]) 179 | end 180 | end 181 | end 182 | 183 | end #class GemSpec 184 | 185 | end 186 | 187 | DotRuby::GemSpec.instance 188 | -------------------------------------------------------------------------------- /work/reference/mint/work/deprecated/mint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

IMPORTANT Mint is still in early stages of development. Becuase of this 7 | the following documentation might not refect the actualy state of functionailty.

8 | 9 | 10 | 11 |

Mint

12 | 13 |

Managed Copy

14 | 15 |

Mint is a copy tool. Really. The mint command is that simple. 16 | What makes it special is that 1) it copies interactively, verifying pontial 17 | overwrites, 2 it can readily copy from special mint-ready reppositories, and 18 | 3 dynamic behavior can be incorporated into threse repositories. These three 19 | small distictions allow mint to become a very powerful tool for 20 | managing file transfers that require "smarts" rather than just dumb copies.

21 | 22 |

Basic Usage

23 | 24 |

Using mint is super easy. Here is the most basic example:

25 | 26 |
 27 |   $ mint FROM.txt TO.txt
 28 | 
29 | 30 |

This simply copies FROM.txt file to TO.txt. Just like using cp. 31 | Of course we assume FROM.txt already exits, and TO.txt does not. If FROM.txt 32 | doesn't exit it will report an error, as expected. But if TO.txt already exits?

33 | 34 |
 35 |   $ mint FROM.txt TO.txt
 36 |   KEY (d)iff (c)opy (s)kip (a)ll (q)uit?
 37 |     exits: TO.txt ?
 38 | 
39 | 40 |

Now we have a choice. We can examine the difference between what the current file 41 | looks like and what it will become, or we can choose to go ahead and copy the file, 42 | overwriting the current file, or we can skip it and not copy it after all.

43 | 44 |

The last two options only mater if you're copying more that one file at a time, 45 | in which case 'all' allows you to skip all remaining files that already exist, 46 | and 'quit' allows you to stop copying altogether. There is an option to copy all 47 | remaining files irregardless, but we only get thet by passing the --force option to 48 | to the mint command. This is an added precaution. We don't want to delete 49 | important files on accident!

50 | 51 |
52 | 53 | 54 | 55 |

Project Generation

56 | 57 |

Creating a New Project

58 | 59 |

As mentioned, mint is useful for scaffolding projects. After all, 60 | the basis of any project scaffolding is just a copy of another directories 61 | contents. Mint can be used used to generate whole new project scaffoldings 62 | or add additional parts to an existing project.

63 | 64 |

Lets look at creating a new project. To do this, first create a directory for the 65 | new project, then invoke mint as follows.

66 | 67 |
 68 |   $ mkdir myproject
 69 |   $ mint -s website myproject/
 70 |   KEY: (d)iff (r)eplace (s)kip skip(a)ll (q)uit
 71 |       make img/
 72 |       copy index.html
 73 |       copy css/clean.css
 74 |   Commit y/N?
 75 |   
76 | 77 |

By answering Y here, these files will be copied to the myproject directory. 78 | And just like that, a fairly standard website project is created.

79 | 80 |

Let's try another type of project, a Ruby project.

81 | 82 |
 83 |   $ mkdir rubyproject
 84 |   $ mint -s ruby rubyproject/
 85 |   KEY: (d)iff (r)eplace (s)kip skip(a)ll (q)uit
 86 |     make bin/
 87 |     make data/
 88 |     make doc/note/
 89 |     make ext/
 90 |     make lib/
 91 |     make test/
 92 |     copy README.first
 93 |     copy README.license
 94 |     copy README
 95 |     copy doc/log/ChangeLog
 96 |     copy doc/log/TODO
 97 |     copy doc/index.html
 98 |     copy meta/name-1.0.0.roll
 99 |     copy meta/MANIFEST
100 |     copy script/setup
101 |     copy script/finish_scaffold
102 |   Commit y/N?
103 |   
104 | 105 |

If you commit, and look at the contents of the directory you will see conventional folders like 106 | bin/ lib/ and data/. The conventions followed are according 107 | to those established by Minero Akoi's setup.rb. 108 | If you are relatively new to Ruby it is a good idea to familiarize yourself with this material.

109 | 110 |

IMPORTANT From here on is not implemented yet. This is just the current conjecture 111 | on how this functionality will be added.

112 | 113 |

Besides the standard layout, new can also create a subversion layout which includes 114 | the associated branches tags trunk tier. Simply specify the option as --svn 115 | or --subversion after new.

116 | 117 |

Mint can create even better project scaffolding if we first provide some information about our 118 | project. To do that we must first mint a project information file. 119 | The information in this file can then be used by mint to enhance the new scaffolding. Information 120 | files are often per-scaffolding type. So you should specify the scaffolding you want.

121 | 122 |
123 |   $ mkdir myproject
124 |   $ cd myproject
125 |   $ mint -i ruby
126 |   KEY: (d)iff (r)eplace (s)kip skip(a)ll (q)uit
127 |     copy mint-ruby.yaml
128 |   Commit y/N?
129 |   
130 | 131 |

As you can see this creates a special file called mint.yaml. Once you have edited this file 132 | subsequnelty running the @mint@ and passing in thi file will create the project.

133 | 134 |
135 |   $ mint < mint-ruby.yaml
136 |   
137 | 138 |

The scaffolding will be as before, but it will now have enhanced details that further ease 139 | the creation of a the new project. For instance, in this case the lib/ subdirectory will already 140 | have been named appropriately.

141 | 142 |

The enhanced information scaffolding is barely implemented as of yet. But will continue to 143 | improve with future releases.

144 | 145 |
146 | -------------------------------------------------------------------------------- /lib/quarry/generator.rb: -------------------------------------------------------------------------------- 1 | require 'tmpdir' 2 | require 'quarry/core_ext' 3 | require 'quarry/template' 4 | 5 | module Quarry 6 | 7 | # You think of the Generator class as miner(s) working out the ore, i.e. it 8 | # renders each specified template to the desinated destination. 9 | # 10 | class Generator 11 | 12 | # 13 | # Initialize new Miner instance. 14 | # 15 | # @param [Array] operations 16 | # An array of parameters, `[[uri, args, data], ...]` for creating 17 | # Mine instances. 18 | # 19 | # @options [Hash] options 20 | # Mining options. 21 | # 22 | # @option options [String] :output 23 | # The output directory for the operations(s). 24 | # 25 | def initialize(operations, options) 26 | @operations = initialize_operations(operations) 27 | @options = options 28 | 29 | @options[:output] ||= Dir.pwd 30 | @options[:stage] ||= stage # FIXME ? 31 | end 32 | 33 | # 34 | # 35 | # 36 | def initialize_operations(operations) 37 | operations.map do |(uri, args, data)| 38 | uri = Template.fetch(uri) if url?(uri) 39 | template = Template.find(uri) 40 | [template, args, data] 41 | end 42 | end 43 | 44 | # 45 | # Is a URI a remote URL, as opposed to a local name. 46 | # 47 | def url?(uri) 48 | /\w+\:\/\// =~ uri 49 | end 50 | 51 | # 52 | # Quarry that Ore! Take a set of `operations` and `options`, setup the 53 | # staging ground for the operations and then run copy script to render 54 | # files to the destination. 55 | # 56 | def run! 57 | report_startup 58 | setup_stage 59 | stage_operations 60 | managed_copy 61 | remove_stage 62 | report_complete 63 | end 64 | 65 | # 66 | # Collect CopyScripts for operations. 67 | # 68 | def stage_operations 69 | operations.each do |(tmpl, args, data)| 70 | #Template::Script.run(tmpl, args, data, options) 71 | tmpl.script.setup(options).call(args, data) 72 | end 73 | end 74 | 75 | # # 76 | # #def parse_index(index) 77 | # # mine, pick = index.split(':') 78 | # # pick = 'default' if pick.nil? 79 | # # return mine, pick 80 | # #end 81 | # 82 | # # Add a mine. 83 | # #def mine(name, *args) 84 | # # @operations << Seed.new(name, *args) 85 | # #end 86 | 87 | # Seeds to germinate. 88 | def operations 89 | @operations 90 | end 91 | 92 | # 93 | def options 94 | @options 95 | end 96 | 97 | # 98 | # Job description. 99 | # 100 | # @return [Array] List of ore names joined by a comma. 101 | # 102 | def job 103 | operations.map{ |o| o.first }.join(',') 104 | end 105 | 106 | # 107 | # Temporary staging directory. 108 | # 109 | def stage 110 | @stage ||= ( 111 | name = File.basename(output).chomp('/') 112 | time = Time.now.to_i 113 | Dir.tmpdir + "/quarry/stage/#{name}/#{time}" 114 | ) 115 | end 116 | 117 | # Output directory. 118 | def output 119 | options[:output] 120 | end 121 | 122 | #alias_method :destination, :output 123 | 124 | # 125 | # Essentially, mute all standard output about operations. 126 | # 127 | def quiet? 128 | options[:quiet] 129 | end 130 | 131 | # 132 | # 133 | # 134 | def mode 135 | options[:mode] 136 | end 137 | 138 | # 139 | #def config 140 | # @config 141 | #end 142 | 143 | # 144 | # Create the staging directory. 145 | # 146 | def setup_stage 147 | fu.mkdir_p(stage) 148 | #fu.mkdir_p(output) unless File.exist?(output) 149 | #fu.cp_r(output+'/.', stage) 150 | end 151 | 152 | # 153 | def managed_copy 154 | copier.copy 155 | end 156 | 157 | # 158 | def copier 159 | Copier.new(stage, output, :quiet=>quiet?, :mode=>mode) 160 | end 161 | 162 | # Remove stage directory. 163 | def remove_stage 164 | #fu.rm_r(stage) unless $DEBUG 165 | end 166 | 167 | # 168 | def fu 169 | FileUtils 170 | end 171 | 172 | # 173 | # Output to provide on startup of generation. 174 | # 175 | def report_startup 176 | @time = Time.now 177 | #dir = File.basename(source) #File.basename(File.dirname(source)) 178 | report "Generating #{job} in #{File.basename(output)}:\n\n" 179 | end 180 | 181 | # 182 | # Output to provide when generation is complete. 183 | # 184 | def report_complete 185 | report "\nFinished in %.3f seconds." % [Time.now - @time] 186 | end 187 | 188 | # 189 | # 190 | # 191 | def report(message) 192 | puts message unless options[:quiet] or options[:trial] 193 | end 194 | 195 | # 196 | # Use this to report any "templating" that needs to done by hand. 197 | # 198 | # files - array of file names to check 199 | # marker - the Regexp to search for 200 | # 201 | def report_fixes(files, marker=nil) 202 | glist = check_for_fixes(files, marker) 203 | unless glist.empty? 204 | puts "\nYou may need to fix the occurances of missing information in the following files:\n\n" 205 | glist.each do |file| 206 | puts " #{file}" 207 | end 208 | puts 209 | end 210 | end 211 | 212 | # 213 | # Grep each file in +files+ for occurance of +marker+. 214 | # 215 | # files - array of file names to check 216 | # marker - the Regexp to search for 217 | # 218 | # Returns an Array of file names containing the marker. 219 | # 220 | def check_for_fixes(files, marker=nil) 221 | marker ||= EDIT_MARKER 222 | list = [] 223 | files.each do |file| 224 | next if File.directory?(file) 225 | File.open(file) do |f| 226 | f.grep(marker){ |l| list << file } 227 | end 228 | end 229 | list.uniq 230 | end 231 | 232 | # 233 | # Find a mine location by +name+. 234 | # 235 | def find(name) 236 | Template.find(name) 237 | end 238 | 239 | end 240 | 241 | end 242 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = Sow 2 | 3 | TENDING TO PROJECT ECOLOGY 4 | 5 | , __ \/ __ 6 | /\^/`\ /o \{}/ o\ If I had a flower for each time 7 | | \/ | \ () / I thought of you, my garden 8 | | | | `> /\ <` ,,, would be full... 9 | \ \ / @@@@ (o/\/\o) {{{}} _ _ 10 | '\\//' @@()@@ _ ) ( ~Y~ @@@@ _{ ' }_ 11 | || @@@@ _(_)_ wWWWw .oOOo. @@()@@ { `.!.` } 12 | || ,/ (_)@(_) (___) OO()OO @@@@ _ ',_/Y\_,' 13 | || ,\ | /) (_)\ Y 'OOOO',,,(\|/ _(_)_ {_,_} 14 | |\ || |\\|// vVVVv`|/@@@@ _ \/{{}}}\| (_)@(_) | ,,, 15 | | | || | |;,,,(___) |@@()@@ _(_)_| ~Y~ wWWWw(_)\ (\| {{{}} 16 | | | || / / {{}}} Y \| @@@@ (_)#(_) \| (___) | \| /~Y~ 17 | \ \||/ /\\|~Y~ \|/ | \ \/ /(_) |/ |/ Y \|/ |//\|/ 18 | jgs\ `\\//`,.\|/|//.|/\\|/\\|,\|/ //\|/\|.\\\| // \|\\ |/,\|/ 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | * home: http://proutils.github.com/sow 22 | * work: http://github.com/proutils/sow 23 | 24 | 25 | == INTRODUCTION 26 | 27 | Sow is a project scaffolding system. The system is pluggable 28 | and utilizes eRuby templating to make it easy to extend. Sow 29 | can be used for any kind of file scaffolding, but it is 30 | designed largely with Ruby project needs in mind. 31 | 32 | Sow's plugins are called "seeds". Sowing requires seeds. 33 | Sow comes with an extra large box of seeds to really get 34 | those projects blooming! 35 | 36 | 37 | == SOWING SEEDS 38 | 39 | General usage follows the pattern: 40 | 41 | sow [command] [*arguments] [*options] [*name=value] 42 | 43 | If no command is given, then +gen+ is the default. For instance to scaffold 44 | a new, basic ruby project with the name 'myapp' in the directory 'myapp': 45 | 46 | $ mkdir myapp 47 | $ cd myapp 48 | $ sow ruby 49 | 50 | By default, Sow's built-in +ruby+ seed will use the destination's basename 51 | as the project name. If we wished to name the project something 52 | other than the destination's path, we can supply that as an extra 53 | argument. 54 | 55 | $ sow ruby foo 56 | 57 | Or we could supply it via an environment setting. 58 | 59 | $ sow ruby name=foo 60 | 61 | When creating a new project, having to mkdir and cd is not convenient. 62 | For this sow provides the +new+ command. With it we could create an empty 63 | project. 64 | 65 | $ sow new myapp 66 | 67 | Or do the same but also include a seed. 68 | 69 | $ sow new myapp ruby 70 | 71 | Finally, sow can plant multiple seeds at once by dividing each seed with '-'. 72 | For example lets say we needs a ruby project with cucumber features and 73 | an Apache license. 74 | 75 | $ sow new foo ruby - license apache - cucumber 76 | 77 | In the is way, sow promotes the use of mirco-scaffolding --seeds can be small 78 | and narrowly focused. 79 | 80 | Once you have a project, Sow can be used to generate components 81 | as well, kind of like script/generate in Rails. For instance, 82 | to get a TestUnit starter test file. 83 | 84 | $ sow test.testunit mytest 85 | 86 | For more details on how to use Sow, what seeds are available and how 87 | to build your own seeds, please see the documentation provided 88 | on Sow's website or the Wiki. 89 | 90 | 91 | == CURRENT STATUS 92 | 93 | Sow is still a little wet behind the ears, and you might come across 94 | the occasional odd behavior. Please report on the Protutils 95 | mailing-list[http://groups.google.com/group/proutils]. Usually the 96 | issue will be something over-looked in a given seed --since they 97 | have a lot of flexability in their design. It will take some time 98 | and some widespread usage to work out all the corner cases and 99 | to bring each to a fine polish. 100 | 101 | 102 | == HOE USERS 103 | 104 | *IMPORTANT NOTICE FOR HOE USERS!* 105 | 106 | Hoe users will discover that the +sow+ command that comes with Hoe will 107 | be clobbered by Sow. This may seem a not-so-nice thing to do, but truth 108 | be told Sow is a slightly older project than Hoe (albeit admittedly 109 | a very different program originally --what is now called Box). Since there 110 | is no command called +hoe+, it would seem a more logical choice in any case. 111 | I am not sure why it wasn't used in the first place. To play nice, Sow ships 112 | with a copy of Hoe's +sow+ command renamed to +hoe+. Hoe users can simply 113 | use this command instead. Keep in mind however, that updating Hoe can likewise 114 | clobber Sow's sow command. 115 | 116 | 117 | == INSTALLATION 118 | 119 | === RubyGems Install 120 | 121 | Install using RubyGems as you would expect: 122 | 123 | $ sudo gem install sow 124 | 125 | This will install Sow, it's Facets dependency if not alreay installed, 126 | and a number of built-in seeds. Keep in mind that some seeds 127 | come from the packages with which they are associated. For example, 128 | the Syckle seed is distributed with the Syckle package. 129 | 130 | === Site Install 131 | 132 | Old-fashion site installs require Ruby Setup[http://proutils.rubyforge.org/setup]. 133 | If you don't have Ruby Setup you can install it via Rubygems: 134 | 135 | $ gem install setup 136 | 137 | With Setup in place, download the Sow tarball (.tar.gz) and unpack it, 138 | then install by invoking setup.rb. 139 | 140 | $ tar -xvvzf sow-1.0.0.tar.gz 141 | $ cd sow-1.0.0 142 | $ sudo setup.rb 143 | 144 | If you use Hoe, please see the the important message above before 145 | installing. 146 | 147 | 148 | == DEVELOPMENT 149 | 150 | Sow is being developed on GitHub, as part of the 151 | ProUtils set of project tools. You can browse the Sow project here: 152 | 153 | http://github.com/proutils/sow/tree/master 154 | 155 | Sow's public repository can be pulled via: 156 | 157 | git://github.com/proutils/sow.git 158 | 159 | Please feel free to fork the project and submit pull requests. Discussion of 160 | Sow occurs on the ProUtils mailinglist. 161 | 162 | http://groups.google.com/group/proutils 163 | 164 | Happy hacking! 165 | 166 | 167 | == COPYRIGHT & LICENSE 168 | 169 | Copyright (c) 2007 Thomas Sawyer 170 | 171 | This software is distributed under the terms of the Apache 2.0 license. 172 | 173 | Please see LICENSE file for details. 174 | 175 | -------------------------------------------------------------------------------- /data/quarry/license/lgpl/COPYING.LESSER: -------------------------------------------------------------------------------- 1 | = GNU LESSER GENERAL PUBLIC LICENSE 2 | 3 | Version 3, 29 June 2007 4 | 5 | Copyright (C) 2007 Free Software Foundation, Inc. 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | == 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the 17 | GNU General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | == 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | == 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | == 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this 77 | license document. 78 | 79 | == 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this 92 | license document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | d.0) Convey the Minimal Corresponding Source under the terms of 102 | this License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | d.1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | == 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | == 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | 167 | -------------------------------------------------------------------------------- /lib/quarry/template/management.rb: -------------------------------------------------------------------------------- 1 | module Quarry 2 | 3 | class Template 4 | 5 | # The Template::Management module extends the Template class 6 | # providing it class methods for finding templates. 7 | # 8 | # IMPORTANT! To have access to project templates, the present 9 | # working directory must be the project/destination directory 10 | # or `Template.output = path` must be set as such **prior** to 11 | # using these methods. 12 | # 13 | module Management 14 | 15 | # 16 | # @todo: What name sould this be? 17 | # 18 | LOCAL_DIRECTORY = "mine" 19 | 20 | # 21 | # 22 | # 23 | def output 24 | @output ||= Pathname.new(Dir.pwd) 25 | end 26 | 27 | # 28 | # 29 | # 30 | def output=(directory) 31 | @output = Pathname.new(File.expand_path(directory)) 32 | end 33 | 34 | # 35 | # Cached list of all available templates. 36 | # 37 | # @return [Array] Template list 38 | # 39 | def templates 40 | @templates ||= ( 41 | list = [] 42 | list.concat templates_from_project 43 | list.concat templates_from_remotes 44 | list.concat templates_from_plugins 45 | list.sort_by{ |t| t.name } 46 | ) 47 | end 48 | 49 | # 50 | # Sorted list of template names. 51 | # 52 | # @return [Array] Sorted template names. 53 | # 54 | def list 55 | templates.map{ |t| t.name }.sort_by{ |a| 56 | i = a.index('@') 57 | i ? [a[i+1..-1], a] : [a, a] 58 | } 59 | end 60 | 61 | # 62 | # Find template given it's name, or first unique portion of it's name. 63 | # 64 | # @return [Template] 65 | # 66 | # @raise [MissingTemplate] 67 | # 68 | # @raise [DuplicateTemplate] 69 | # 70 | def find(match) 71 | hits = search(match) 72 | raise(MissingTemplate, "No matching templates.") if hits.size == 0 73 | if hits.size > 1 74 | message = "More than one match:\n " + hits.map{|name, dir| name}.join("\n ") 75 | raise(DuplicateTemplate, message) 76 | end 77 | hits.first 78 | end 79 | 80 | # 81 | # Search for templates by name. 82 | # 83 | def search(match) 84 | if File.directory?(match) 85 | name = File.basename(match) 86 | return [Template.new(name, match, :type=>:project)] 87 | end 88 | 89 | hits = templates.select do |template| 90 | match == template.name 91 | end 92 | if hits.size == 0 93 | hits = templates.select do |template| 94 | /^#{match}/ =~ template.name 95 | end 96 | end 97 | return hits 98 | end 99 | 100 | # 101 | # Clone template repository. 102 | # 103 | # @raise [DuplicateTemplate] 104 | # If a template by the given name already exists. 105 | # 106 | def clone(uri, options={}) 107 | name = options[:name] || uri_to_name(uri) 108 | dir = bank_folder 109 | out = dir + name 110 | 111 | if File.exist?(out) 112 | raise DuplicateTemplate, "template already saved with that name -- #{name}" 113 | end 114 | 115 | # TODO: handle dryrun by using special File/URI interfance? 116 | if url?(uri) 117 | SCM.clone(uri, :dest=>out) 118 | else 119 | FileUtils.mkdir_p(dir) 120 | Dir.chdir(dir) do 121 | FileUtils.symlink(uri, name) #`ln -s #{uri} #{name}` 122 | end 123 | end 124 | 125 | return name 126 | end 127 | 128 | # 129 | # Remove a template by name. 130 | # 131 | # Careful! This method deletes files with force. 132 | # 133 | def remove(name) 134 | template = find(name) 135 | shell.rm_rf(template.path) if template 136 | end 137 | 138 | # 139 | # Since templates are usually version controlled repositories, they 140 | # should be updated from time to time. 141 | # 142 | def update(name=nil) 143 | if name 144 | template = find(name) 145 | template.update 146 | else 147 | list.each do |template| 148 | template.update 149 | end 150 | end 151 | end 152 | 153 | # 154 | # Save contents of source folder to the named template in one's personal 155 | # collection. 156 | # 157 | # FIXME: This needs to be more robust. 158 | # 159 | def save(name, src=nil) 160 | raise ArgumentError, "template name not given" unless name 161 | 162 | src = src || Dir.pwd 163 | dir = Quarry.bank_folder + "#{name}" # silo_folder 164 | copier = Copier.new(src, dir, :backup=>false) 165 | copier.copy 166 | copyfile = dir + '.ore/copy.rb' 167 | if !copyfile.exist? 168 | File.open(copyfile, 'w'){ |f| f << 'copy all' } 169 | end 170 | dir 171 | end 172 | 173 | # 174 | # Lookup ore and return the contents of it's README file. 175 | # If it does not have a README file that it will return a 176 | # message cveying as much. If the ore is not found it 177 | # raise an error. 178 | # 179 | def help(name) 180 | if template = find(name) 181 | template.help 182 | else 183 | raise "No matching template." 184 | end 185 | end 186 | 187 | private 188 | 189 | # 190 | # Collect templates from present working project. 191 | # 192 | def templates_from_project 193 | list = [] 194 | dirs = Dir.glob(File.join(output, LOCAL_DIRECTORY, '*/')) 195 | dirs = dirs.uniq.map{ |d| d.chomp('/') } 196 | dirs.each do |dir| 197 | name = dir.sub(File.join(output, LOCAL_DIRECTORY)+'/', '') 198 | list << Template.new(name, dir, :type=>:project) 199 | end 200 | list 201 | end 202 | 203 | # TODO: Should remote templates and personal templates 204 | # be stored in separate locations? 205 | 206 | # personal silo 207 | #def templates_from_saves 208 | # dirs = silo_folder.glob("*") 209 | # dirs = dirs.map{ |d| d.parent } 210 | # dirs.each do |dir| 211 | # ore = Template::Directory.new(dir, :type=>'silo') 212 | # list << ore 213 | # end 214 | #end 215 | 216 | # 217 | # Collect templates from $QUARRY_HOME (`$HOME/.quarry`). 218 | # These are either templates cloned from remote repository 219 | # or local templates saved by user. 220 | # 221 | def templates_from_remotes 222 | list = [] 223 | dirs = Dir.glob(File.join(QUARRY_BANK, '*/')) 224 | dirs = dirs.uniq.map{ |d| d.chomp('/') } 225 | dirs.each do |dir| 226 | name = dir.sub(QUARRY_BANK+'/', '') 227 | list << Template.new(name, dir, :type=>:remote) 228 | end 229 | list 230 | end 231 | 232 | # 233 | # Collect templates from packages installs. 234 | # 235 | def templates_from_plugins 236 | list = [] 237 | dirs = ::Find.data_path(File.join('quarry', '*/')) 238 | dirs = dirs.uniq.map{ |d| d.chomp('/') } 239 | dirs.each do |dir| 240 | i = dir.rindex('quarry/') 241 | name = dir[i+7..-1] 242 | list << Template.new(name, dir, :type=>:plugin) 243 | end 244 | list 245 | end 246 | 247 | # 248 | # Helper method to determine if a URI is a local file path or a remote URI. 249 | # 250 | def url?(uri) 251 | /\w+\:\/\// =~ uri 252 | end 253 | 254 | # 255 | # Convert an URI into a suitable directory name for storing banks. 256 | # 257 | def uri_to_name(uri) 258 | uri = URI.parse(uri) 259 | path = uri.path 260 | path = path.chomp(File.extname(path)) 261 | path = path.chomp('trunk') 262 | File.join(uri.host,path).split('/').reverse.join('.') 263 | #path.split('/').reverse.join('.') 264 | end 265 | 266 | # 267 | #def path_to_name(path) 268 | # div = path.to_s.split('/') # File::SEPARATOR ? 269 | # div.pop if div.last == 'default' 270 | # name = div.reverse.join('.').chomp('.') 271 | # return name, namespace 272 | #end 273 | 274 | # 275 | # Interface to FileUtils or FileUtils::DryRun. 276 | # 277 | def shell 278 | $DRYRUN ? FileUtils::DryRun : FileUtils 279 | end 280 | 281 | end 282 | 283 | # Extend Template with Management functions. 284 | extend Management 285 | end 286 | 287 | end 288 | --------------------------------------------------------------------------------