rid-push 0.1.0
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.
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README +8 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/lib/rid-push.rb +78 -0
- data/rid-push.gemspec +50 -0
- metadata +105 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Johannes J. Schmidt
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "rid-push"
|
8
|
+
gem.summary = %Q{Rest in development. This is the rid push command.}
|
9
|
+
gem.description = %Q{Rid is a toolkit to relax in web development. Based on CouchDB you get a distributed, high scaling web application infrastructure with Rid. This is the rid push command to deploy rid applications to CouchDB database.}
|
10
|
+
gem.email = "schmidt@netzmerk.com"
|
11
|
+
gem.homepage = "http://github.com/jo/rid-push"
|
12
|
+
gem.authors = ["Johannes J. Schmidt"]
|
13
|
+
|
14
|
+
gem.add_dependency "rid", ">= 1.0.1"
|
15
|
+
|
16
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
17
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
end
|
19
|
+
Jeweler::GemcutterTasks.new
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'spec/rake/spectask'
|
25
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
27
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
+
end
|
29
|
+
|
30
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
31
|
+
spec.libs << 'lib' << 'spec'
|
32
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
33
|
+
spec.rcov = true
|
34
|
+
end
|
35
|
+
|
36
|
+
task :spec => :check_dependencies
|
37
|
+
|
38
|
+
task :default => :spec
|
39
|
+
|
40
|
+
require 'rake/rdoctask'
|
41
|
+
Rake::RDocTask.new do |rdoc|
|
42
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
43
|
+
|
44
|
+
rdoc.rdoc_dir = 'rdoc'
|
45
|
+
rdoc.title = "rid-push #{version}"
|
46
|
+
rdoc.rdoc_files.include('README*')
|
47
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/rid-push.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
module Rid
|
2
|
+
module Commands
|
3
|
+
# Rid Push command.
|
4
|
+
# Deploy Rid applications to CouchDB server.
|
5
|
+
#
|
6
|
+
module Push
|
7
|
+
command :push do |c|
|
8
|
+
c.syntax = 'rid push'
|
9
|
+
c.description = 'Deploy project.'
|
10
|
+
|
11
|
+
c.option '-d DATABASE', '--database DATABASE', String, 'Setup database url'
|
12
|
+
c.option '-r ROOT', '--root ROOT', String, 'Setup application root'
|
13
|
+
c.option '-f', '--force', 'Do not care about _rev'
|
14
|
+
|
15
|
+
c.example 'Deploy a Rid application', 'rid push'
|
16
|
+
c.example 'Deploy to example.com/myapp database', 'rid push -d http://example.com/myapp'
|
17
|
+
c.example 'Force deployment to example.com/myapp database', 'rid push -d http://example.com/myapp -f'
|
18
|
+
c.example 'Deploy from ~/rid/myapp to example.com/myapp', 'rid push -r ~/rid/myapp -d http://example.com/myapp'
|
19
|
+
|
20
|
+
c.action do |args, options|
|
21
|
+
app = Rid::App.new(options)
|
22
|
+
app.documents.each do |doc|
|
23
|
+
doc.read!
|
24
|
+
current = app.db.get(doc, :attachments => true)
|
25
|
+
|
26
|
+
# no local rev means to push against the latest rev
|
27
|
+
doc.rev = current.rev if (!doc.rev || options.force) && current
|
28
|
+
|
29
|
+
# remove revpos attribute for comparison
|
30
|
+
if current && current.hash["_attachments"]
|
31
|
+
current.hash["_attachments"].each do |k,v|
|
32
|
+
current.hash["_attachments"][k].delete("revpos")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# look for changes, comparire local and remote docs
|
37
|
+
if doc == current
|
38
|
+
verb = :unchanged
|
39
|
+
color = :blue
|
40
|
+
text = { "rev" => doc.rev }.to_json
|
41
|
+
|
42
|
+
else
|
43
|
+
# only push attachments which have been changed
|
44
|
+
if current && doc.hash["_attachments"]
|
45
|
+
doc.hash["_attachments"].each do |k,v|
|
46
|
+
if current.hash["_attachments"] && current.hash["_attachments"][k] && current.hash["_attachments"][k]["data"] == v
|
47
|
+
doc.hash["_attachments"][k].delete("data")
|
48
|
+
doc.hash["_attachments"][k]["stub"] = true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# remove _rev if document does not exist
|
54
|
+
unless current
|
55
|
+
doc.hash.delete("_rev")
|
56
|
+
end
|
57
|
+
|
58
|
+
# save document
|
59
|
+
begin
|
60
|
+
text = app.db.save(doc)
|
61
|
+
verb = :push
|
62
|
+
color = :green
|
63
|
+
rescue RestClient::Conflict
|
64
|
+
verb = :conflict
|
65
|
+
color = :red
|
66
|
+
text = { "rev" => doc.rev, "remote" => current.rev }.to_json
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
verb = verb.to_s.rjust(12)
|
71
|
+
verb = $terminal.color(verb, :bold, color) if defined? $terminal
|
72
|
+
puts '%s %s: %s' % [verb, doc.id, text]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/rid-push.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{rid-push}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Johannes J. Schmidt"]
|
12
|
+
s.date = %q{2010-08-19}
|
13
|
+
s.description = %q{Rid is a toolkit to relax in web development. Based on CouchDB you get a distributed, high scaling web application infrastructure with Rid. This is the rid push command to deploy rid applications to CouchDB database.}
|
14
|
+
s.email = %q{schmidt@netzmerk.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"LICENSE",
|
22
|
+
"README",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/rid-push.rb",
|
26
|
+
"rid-push.gemspec"
|
27
|
+
]
|
28
|
+
s.homepage = %q{http://github.com/jo/rid-push}
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = %q{1.3.7}
|
32
|
+
s.summary = %q{Rest in development. This is the rid push command.}
|
33
|
+
|
34
|
+
if s.respond_to? :specification_version then
|
35
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
36
|
+
s.specification_version = 3
|
37
|
+
|
38
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
39
|
+
s.add_runtime_dependency(%q<rid>, [">= 1.0.1"])
|
40
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
41
|
+
else
|
42
|
+
s.add_dependency(%q<rid>, [">= 1.0.1"])
|
43
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
44
|
+
end
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<rid>, [">= 1.0.1"])
|
47
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rid-push
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Johannes J. Schmidt
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-19 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rid
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 21
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 1
|
34
|
+
version: 1.0.1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 13
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 2
|
49
|
+
- 9
|
50
|
+
version: 1.2.9
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
description: Rid is a toolkit to relax in web development. Based on CouchDB you get a distributed, high scaling web application infrastructure with Rid. This is the rid push command to deploy rid applications to CouchDB database.
|
54
|
+
email: schmidt@netzmerk.com
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE
|
61
|
+
- README
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- LICENSE
|
65
|
+
- README
|
66
|
+
- Rakefile
|
67
|
+
- VERSION
|
68
|
+
- lib/rid-push.rb
|
69
|
+
- rid-push.gemspec
|
70
|
+
has_rdoc: true
|
71
|
+
homepage: http://github.com/jo/rid-push
|
72
|
+
licenses: []
|
73
|
+
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options:
|
76
|
+
- --charset=UTF-8
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
requirements: []
|
98
|
+
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 1.3.7
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Rest in development. This is the rid push command.
|
104
|
+
test_files: []
|
105
|
+
|