etaps 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in etaps.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # Etaps
2
+
3
+ ```bash
4
+ etaps # pulls production db
5
+ etaps staging # pulls staging db
6
+ ```
7
+
8
+ Have fun!
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/etaps ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # vim: set filetype=ruby
3
+
4
+ begin
5
+ require 'etaps'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ $:.unshift(File.expand_path('../../lib', __FILE__))
9
+ require 'etaps'
10
+ end
11
+
12
+ Etaps.run ARGV[0]
data/etaps.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "etaps/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "etaps"
7
+ s.version = Etaps::VERSION
8
+ s.authors = ["Simon Menke"]
9
+ s.email = ["simon.menke@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Simple CLI for Taps}
12
+ s.description = %q{Really simple CLI for Taps}
13
+
14
+ s.rubyforge_project = "etaps"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+
24
+ s.add_runtime_dependency "taps"
25
+ s.add_runtime_dependency "childprocess"
26
+ end
data/lib/etaps.rb ADDED
@@ -0,0 +1,64 @@
1
+ require "etaps/version"
2
+
3
+ module Etaps
4
+
5
+ def self.run(source='production')
6
+ unless File.file?('config/database.yml')
7
+ $stderr.puts "No config/database.yml found!"
8
+ exit 1
9
+ end
10
+
11
+ require 'etc'
12
+ require 'erb'
13
+ require 'yaml'
14
+ require 'childprocess'
15
+
16
+ config = YAML.load(ERB.new(File.read('config/database.yml')).result)
17
+ source = build_url(config[source])
18
+ target = build_url(config['development'])
19
+
20
+ server = ChildProcess.build("taps", "server", source, "a", "b")
21
+ server.io.inherit!
22
+ server.io.stdout = File.open('/dev/null', 'w')
23
+ server.io.stderr = File.open('/dev/null', 'w')
24
+ server.start
25
+
26
+ sleep 10
27
+
28
+ unless server.alive?
29
+ exit 1
30
+ end
31
+
32
+ client = ChildProcess.build("taps", "pull", target, "http://a:b@localhost:5000")
33
+ client.io.inherit!
34
+ client.start
35
+ client.wait
36
+
37
+ ensure
38
+ client.stop rescue nil
39
+ server.stop rescue nil
40
+ end
41
+
42
+
43
+ def self.build_url(conf)
44
+ type = conf['adapter']
45
+ __send__("build_#{type}_url", conf)
46
+ end
47
+
48
+ def self.build_sqlite_url(conf)
49
+ "sqlite://#{File.expand_path(conf['database'])}"
50
+ end
51
+
52
+ def self.build_sqlite3_url(conf)
53
+ build_sqlite_url(conf)
54
+ end
55
+
56
+ def self.build_mysql_url(conf)
57
+ "mysql://#{conf['username']}:#{conf['password']}@#{conf['host']}/#{conf['database']}"
58
+ end
59
+
60
+ def self.build_mysql2_url(conf)
61
+ build_mysql_url(conf)
62
+ end
63
+
64
+ end
@@ -0,0 +1,3 @@
1
+ module Etaps
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: etaps
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Simon Menke
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-01-27 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: taps
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: childprocess
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: Really simple CLI for Taps
49
+ email:
50
+ - simon.menke@gmail.com
51
+ executables:
52
+ - etaps
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - .gitignore
59
+ - Gemfile
60
+ - README.md
61
+ - Rakefile
62
+ - bin/etaps
63
+ - etaps.gemspec
64
+ - lib/etaps.rb
65
+ - lib/etaps/version.rb
66
+ homepage: ""
67
+ licenses: []
68
+
69
+ post_install_message:
70
+ rdoc_options: []
71
+
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
91
+ version: "0"
92
+ requirements: []
93
+
94
+ rubyforge_project: etaps
95
+ rubygems_version: 1.8.6
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: Simple CLI for Taps
99
+ test_files: []
100
+