bard 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/bard.rb +21 -8
  3. data/lib/bard/capistrano.rb +22 -0
  4. metadata +138 -153
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.18.0
1
+ 0.19.0
@@ -62,13 +62,21 @@ EOF
62
62
  check_project project_path if project_path
63
63
  end
64
64
 
65
- desc "data [ROLE=production]", "copy database and assets down to your local machine from ROLE"
66
- def data(role = "production")
65
+ desc "data [FROM=production, TO=local]", "copy database and assets from FROM to TO"
66
+ def data(from = "production", to = "local")
67
67
  ensure_sanity!(true)
68
- if role == "production" and heroku?
69
- exec "heroku db:pull --confirm #{project_name}"
68
+
69
+ if to == "local"
70
+ if from == "production" and heroku?
71
+ exec "heroku db:pull --confirm #{project_name}"
72
+ else
73
+ exec "cap data:pull ROLES=#{from}"
74
+ end
75
+
70
76
  else
71
- exec "cap data:pull ROLES=#{role}"
77
+ if from == "local"
78
+ exec "cap data:push ROLES=#{to}"
79
+ end
72
80
  end
73
81
  end
74
82
 
@@ -145,8 +153,12 @@ EOF
145
153
  start_time = Time.new.to_i
146
154
  while (response = `curl -s #{ci_host}/lastBuild/api/xml?token=botandrose`).include? "<building>true</building>"
147
155
  elapsed_time = Time.new.to_i - start_time
148
- percentage = (elapsed_time.to_f / last_time_elapsed.to_f * 100).to_i
149
- output = " Estimated completion: #{percentage}%"
156
+ if last_time_elapsed
157
+ percentage = (elapsed_time.to_f / last_time_elapsed.to_f * 100).to_i
158
+ output = " Estimated completion: #{percentage}%"
159
+ else
160
+ output = " No estimated completion time. Elapsed time: #{elapsed_time} sec"
161
+ end
150
162
  print "\x08" * output.length
151
163
  print output
152
164
  $stdout.flush
@@ -195,7 +207,8 @@ EOF
195
207
 
196
208
  def get_last_time_elapsed
197
209
  response = `curl -s #{ci_host}/lastStableBuild/api/xml?token=botandrose`
198
- response.match(/<duration>(\d+)<\/duration>/)[1].to_i / 1000
210
+ response.match(/<duration>(\d+)<\/duration>/)
211
+ $1 ? $1.to_i / 1000 : nil
199
212
  end
200
213
 
201
214
  def ensure_sanity!(dirty_ok = false)
@@ -28,9 +28,31 @@ Capistrano::Configuration.instance(:must_exist).load do
28
28
  end
29
29
  end
30
30
  end
31
+
32
+ namespace "push" do
33
+ desc "push data"
34
+ task "default" do
35
+ system "bundle exec rake db:dump && gzip -9f db/data.sql"
36
+ transfer :up, "db/data.sql.gz", "#{application}/db/data.sql.gz"
37
+ run "cd #{application} && gunzip -f db/data.sql.gz && bundle exec rake db:load"
38
+ end
39
+
40
+ desc "sync the static assets"
41
+ task "assets" do
42
+ uri = URI.parse("ssh://#{roles[ENV['ROLES'].to_sym].first.to_s}")
43
+ portopt = "-e'ssh -p#{uri.port}'" if uri.port
44
+
45
+ [asset_paths].flatten.each do |path|
46
+ dest_path = path.dup
47
+ dest_path.sub! %r(/[^/]+$), '/'
48
+ system "rsync #{portopt} --delete -avz #{path} #{uri.user}@#{uri.host}:#{application}/#{dest_path}"
49
+ end
50
+ end
51
+ end
31
52
  end
32
53
 
33
54
  after 'data:pull', 'data:pull:assets'
55
+ after 'data:push', 'data:push:assets'
34
56
 
35
57
  desc "push app to production"
36
58
  task :deploy, :roles => :production do
metadata CHANGED
@@ -1,175 +1,170 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bard
3
- version: !ruby/object:Gem::Version
4
- hash: 87
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 18
9
- - 0
10
- version: 0.18.0
5
+ version: 0.19.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Micah Geisel
14
9
  - Nick Hogle
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2013-03-08 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: thor
13
+ date: 2013-06-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
23
16
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - "="
28
- - !ruby/object:Gem::Version
29
- hash: 61
30
- segments:
31
- - 0
32
- - 11
33
- - 7
17
+ type: :runtime
18
+ name: thor
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - '='
23
+ - !ruby/object:Gem::Version
24
+ version: 0.11.7
25
+ requirement: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - '='
29
+ - !ruby/object:Gem::Version
34
30
  version: 0.11.7
31
+ - !ruby/object:Gem::Dependency
32
+ prerelease: false
35
33
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
34
  name: capistrano
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - "="
44
- - !ruby/object:Gem::Version
45
- hash: 15
46
- segments:
47
- - 2
48
- - 5
49
- - 10
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
50
40
  version: 2.5.10
41
+ requirement: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - '='
45
+ - !ruby/object:Gem::Version
46
+ version: 2.5.10
47
+ - !ruby/object:Gem::Dependency
48
+ prerelease: false
51
49
  type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
50
  name: rvm-capistrano
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirement: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
55
64
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
65
65
  type: :runtime
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
66
  name: grit
69
- prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - "="
74
- - !ruby/object:Gem::Version
75
- hash: 17
76
- segments:
77
- - 1
78
- - 1
79
- - 1
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - '='
71
+ - !ruby/object:Gem::Version
72
+ version: 1.1.1
73
+ requirement: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - '='
77
+ - !ruby/object:Gem::Version
80
78
  version: 1.1.1
79
+ - !ruby/object:Gem::Dependency
80
+ prerelease: false
81
81
  type: :runtime
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
82
  name: systemu
85
- prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 31
92
- segments:
93
- - 1
94
- - 2
95
- - 0
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: 1.2.0
89
+ requirement: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
96
94
  version: 1.2.0
95
+ - !ruby/object:Gem::Dependency
96
+ prerelease: false
97
97
  type: :runtime
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
98
  name: term-ansicolor
101
- prerelease: false
102
- requirement: &id006 !ruby/object:Gem::Requirement
103
- none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 17
108
- segments:
109
- - 1
110
- - 0
111
- - 3
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
112
104
  version: 1.0.3
105
+ requirement: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.3
111
+ - !ruby/object:Gem::Dependency
112
+ prerelease: false
113
113
  type: :runtime
114
- version_requirements: *id006
115
- - !ruby/object:Gem::Dependency
116
114
  name: bard-rake
117
- prerelease: false
118
- requirement: &id007 !ruby/object:Gem::Requirement
119
- none: false
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- hash: 25
124
- segments:
125
- - 0
126
- - 1
127
- - 1
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
128
120
  version: 0.1.1
129
- type: :runtime
130
- version_requirements: *id007
131
- - !ruby/object:Gem::Dependency
132
- name: rspec
121
+ requirement: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: 0.1.1
127
+ - !ruby/object:Gem::Dependency
133
128
  prerelease: false
134
- requirement: &id008 !ruby/object:Gem::Requirement
129
+ type: :development
130
+ name: rspec
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ~>
135
+ - !ruby/object:Gem::Version
136
+ version: 1.3.0
137
+ requirement: !ruby/object:Gem::Requirement
135
138
  none: false
136
- requirements:
139
+ requirements:
137
140
  - - ~>
138
- - !ruby/object:Gem::Version
139
- hash: 27
140
- segments:
141
- - 1
142
- - 3
143
- - 0
141
+ - !ruby/object:Gem::Version
144
142
  version: 1.3.0
143
+ - !ruby/object:Gem::Dependency
144
+ prerelease: false
145
145
  type: :development
146
- version_requirements: *id008
147
- - !ruby/object:Gem::Dependency
148
146
  name: cucumber
149
- prerelease: false
150
- requirement: &id009 !ruby/object:Gem::Requirement
147
+ version_requirements: !ruby/object:Gem::Requirement
151
148
  none: false
152
- requirements:
149
+ requirements:
153
150
  - - ~>
154
- - !ruby/object:Gem::Version
155
- hash: 59
156
- segments:
157
- - 0
158
- - 9
159
- - 0
151
+ - !ruby/object:Gem::Version
160
152
  version: 0.9.0
161
- type: :development
162
- version_requirements: *id009
163
- description: This immaculate work of engineering genius allows mere mortals to collaborate with beings of transcendent intelligence like Micah, Michael, and Nick.
164
- email:
153
+ requirement: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ~>
157
+ - !ruby/object:Gem::Version
158
+ version: 0.9.0
159
+ description: This immaculate work of engineering genius allows mere mortals to collaborate
160
+ with beings of transcendent intelligence like Micah, Michael, and Nick.
161
+ email:
165
162
  - micah@botandrose.com
166
- executables:
163
+ executables:
167
164
  - bard
168
165
  extensions: []
169
-
170
166
  extra_rdoc_files: []
171
-
172
- files:
167
+ files:
173
168
  - .document
174
169
  - .gitignore
175
170
  - .gitmodules
@@ -214,36 +209,26 @@ files:
214
209
  - spec/spec_helper.rb
215
210
  homepage: https://github.com/botandrose/bard
216
211
  licenses: []
217
-
218
212
  post_install_message:
219
213
  rdoc_options: []
220
-
221
- require_paths:
214
+ require_paths:
222
215
  - lib
223
- required_ruby_version: !ruby/object:Gem::Requirement
216
+ required_ruby_version: !ruby/object:Gem::Requirement
224
217
  none: false
225
- requirements:
226
- - - ">="
227
- - !ruby/object:Gem::Version
228
- hash: 3
229
- segments:
230
- - 0
231
- version: "0"
232
- required_rubygems_version: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ required_rubygems_version: !ruby/object:Gem::Requirement
233
223
  none: false
234
- requirements:
235
- - - ">="
236
- - !ruby/object:Gem::Version
237
- hash: 3
238
- segments:
239
- - 0
240
- version: "0"
224
+ requirements:
225
+ - - ! '>='
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
241
228
  requirements: []
242
-
243
229
  rubyforge_project:
244
- rubygems_version: 1.8.24
230
+ rubygems_version: 1.8.25
245
231
  signing_key:
246
232
  specification_version: 3
247
233
  summary: Tools for collaborating with Bot and Rose Design.
248
234
  test_files: []
249
-