diff --git a/Rakefile b/Rakefile index 152592d..866c047 100644 --- a/Rakefile +++ b/Rakefile @@ -24,7 +24,7 @@ begin gemspec.homepage = "http://github.com/couchrest/couchrest_model" gemspec.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber", "Sam Lown"] gemspec.extra_rdoc_files = %w( README.md LICENSE THANKS.md ) - gemspec.files = %w( LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec,utils}/**/*"] - Dir["spec/tmp"] + gemspec.files = %w( LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec}/**/*"] - Dir["spec/tmp"] gemspec.has_rdoc = true gemspec.add_dependency("couchrest", ">= 1.0.0.beta") gemspec.add_dependency("mime-types", ">= 1.15") diff --git a/utils/remap.rb b/utils/remap.rb deleted file mode 100644 index 131aeb3..0000000 --- a/utils/remap.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'rubygems' -require 'couchrest' - -# set the source db and map view -source = CouchRest.new("http://127.0.0.1:5984").database('source-db') -source_view = 'mydesign/view-map' - -# set the target db -target = CouchRest.new("http://127.0.0.1:5984").database('target-db') - - -pager = CouchRest::Pager.new(source) - -# pager will yield once per uniq key in the source view - -pager.key_reduce(source_view, 10000) do |key, values| - # create a doc from the key and the values - example_doc = { - :key => key, - :values => values.uniq - } - - target.save(example_doc) - - # keep us up to date with progress - puts k if (rand > 0.9) -end diff --git a/utils/subset.rb b/utils/subset.rb deleted file mode 100644 index 0b7adb9..0000000 --- a/utils/subset.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'rubygems' -require 'couchrest' - -# subset.rb replicates a percentage of a database to a fresh database. -# use it to create a smaller dataset on which to prototype views. - -# specify the source database -source = CouchRest.new("http://127.0.0.1:5984").database('source-db') - -# specify the target database -target = CouchRest.new("http://127.0.0.1:5984").database('target-db') - -# pager efficiently yields all view rows -pager = CouchRest::Pager.new(source) - -pager.all_docs(1000) do |rows| - docs = rows.collect do |r| - # the percentage of docs to clone - next if rand > 0.1 - doc = source.get(r['id']) - doc.delete('_rev') - doc - end.compact - puts docs.length - next if docs.empty? - - puts docs.first['_id'] - target.bulk_save(docs) -end -