prixfixe 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
data/prixfixe.gemspec ADDED
@@ -0,0 +1,14 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'prixfixe'
3
+ s.version = '0.0.4'
4
+ s.date = '2014-03-26'
5
+ s.summary = "PrixFixe"
6
+ s.description = "A set of Rails extensions to deal with PrixFixe Servers"
7
+ s.authors = ["Dana Levine"]
8
+ s.email = 'dana11235@gmail.com'
9
+ s.files = `git ls-files`.split("\n")
10
+ s.homepage =
11
+ 'http://rubygems.org/gems/prixfixe'
12
+ s.license = 'MIT'
13
+ s.require_paths = ["lib"]
14
+ end
@@ -0,0 +1,28 @@
1
+ require 'net/http'
2
+
3
+ namespace :prixfixe do
4
+ desc 'dump a model to a json file'
5
+ task :dump, [:classname] => [:environment] do |t, args|
6
+ classname = args[:classname]
7
+ all_objects = eval("#{classname}.all")
8
+ File.open(classname + ".json", 'w') do |out|
9
+ all_objects.each do |obj|
10
+ out.puts obj.dump_data
11
+ end
12
+ end
13
+ puts "Wrote model to #{classname}.json"
14
+ end
15
+
16
+ desc 'push a model to the prix fixe cache'
17
+ task :index, [:classname] => [:environment] do |t, args|
18
+ classname = args[:classname]
19
+ all_objects = eval("#{classname}.all")
20
+
21
+ # This isn't going to work too well if there are a ton of objects.
22
+ # This should probably be chunked in a subsequent release
23
+ data = all_objects.map{|o| o.dump_data}.join("\n")
24
+ uri = URI(PRIX_FIXE[:server] + "/putall")
25
+ response = Net::HTTP.post_form(uri, {"data" => data})
26
+ puts "Pushed #{all_objects.size} objects to server"
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prixfixe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,8 +18,11 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/prix_fixe_model.rb
21
- - lib/prixfixe/railtie.rb
22
21
  - lib/prixfixe.rb
22
+ - lib/prixfixe/railtie.rb
23
+ - prixfixe-0.0.1.gem
24
+ - prixfixe.gemspec
25
+ - tasks/prixfixe.rake
23
26
  homepage: http://rubygems.org/gems/prixfixe
24
27
  licenses:
25
28
  - MIT