watch_tower 0.0.1.beta2 → 0.0.1.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -21,12 +21,23 @@ The installation has been made as simple as possible, here's the steps required:
21
21
  ```bash
22
22
  $ gem install watch_tower --pre
23
23
  $ watchtower install
24
+ $ watchtower load_bootloader
24
25
  ```
25
26
 
26
27
  This creates a configuration file which you __should__ review before invoking
27
28
  __WatchTower__, located at __~/.watch_tower/config.yml__ the configuration file
28
29
  is self explanatory.
29
30
 
31
+ # Update
32
+
33
+ It is important to run
34
+
35
+ ```bash
36
+ $ watchtower load_bootloader
37
+ ```
38
+
39
+ because the path to watchtower binary file is hardcoded in the boot loader.
40
+
30
41
  # Usage
31
42
 
32
43
  The installation process should create a launcher on login which starts
data/Rakefile CHANGED
@@ -4,5 +4,32 @@ require "bundler/gem_tasks"
4
4
  require 'rspec/core/rake_task'
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
+ # Monky patch bundler
8
+ Bundler::GemHelper.class_eval <<-END, __FILE__, __LINE__ + 1
9
+ def tag_version
10
+ sh %(git tag -a -m "Version \#{version}" \#{version_tag}) unless already_tagged?
11
+ Bundler.ui.confirm "Tagged \#{version_tag}"
12
+ yield if block_given?
13
+ rescue
14
+ Bundler.ui.error "Untagged \#{version_tag} due to error"
15
+ sh_with_code "git tag -d \#{version_tag}"
16
+ raise
17
+ end
18
+
19
+ def guard_clean
20
+ end
21
+
22
+ def guard_already_tagged
23
+ end
24
+
25
+ def already_tagged?
26
+ if sh('git tag').split(/\n/).include?(version_tag)
27
+ true
28
+ else
29
+ false
30
+ end
31
+ end
32
+ END
33
+
7
34
  # The default task is tests
8
35
  task :default => :spec
@@ -26,6 +26,34 @@ module WatchTower
26
26
  install_bootloader
27
27
  end
28
28
 
29
+ # Install bootloader
30
+ desc "install_bootloader", "Install Watch Tower's bootloader"
31
+ def install_bootloader
32
+ # Install the bootloader
33
+ install_bootloader_on_os
34
+ end
35
+
36
+ # Load bootloader
37
+ desc "load_bootloader", "Load Watch Tower's bootloader"
38
+ def load_bootloader
39
+ # Load the bootloader
40
+ load_bootloader_on_os
41
+ end
42
+
43
+ # Unload bootloader
44
+ desc "unload_bootloader", "Unload Watch Tower's bootloader"
45
+ def unload_bootloader
46
+ # Unload the bootloader
47
+ unload_bootloader_on_os
48
+ end
49
+
50
+ # Load bootloader
51
+ desc "reload_bootloader", "Reload Watch Tower's bootloader"
52
+ def reload_bootloader
53
+ # Reload the bootloader
54
+ reload_bootloader_on_os
55
+ end
56
+
29
57
  protected
30
58
  # Taken from hub
31
59
  # https://github.com/defunkt/hub/blob/master/lib/hub/context.rb#L186
@@ -50,18 +78,13 @@ module WatchTower
50
78
  end
51
79
 
52
80
  # Install bootloader
53
- def install_bootloader
81
+ def install_bootloader_on_os
54
82
  require 'rbconfig'
55
83
  case RbConfig::CONFIG['target_os']
56
84
  when /darwin/
57
85
  install_bootloader_on_mac
58
86
  else
59
- puts <<-MSG
60
- WatchTower bootloader is not supported on your OS, you'd have to run it manually
61
- for the time being. Support for many editors and many OSes is planned for the
62
- future, if you would like to help, or drop in an issue please don't hesitate to
63
- do so on the project's Github page: https://github.com/TechnoGate/watch_tower
64
- MSG
87
+ puts bootloader_not_supported_on_current_os
65
88
  end
66
89
  end
67
90
 
@@ -70,14 +93,81 @@ MSG
70
93
  self.class.source_root(TEMPLATE_PATH)
71
94
  # copy_file 'watchtower.plist', File.join(ENV['HOME'], 'Library',
72
95
  # 'LaunchAgents', 'fr.technogate.WatchTower.plist')
73
- create_file File.join(ENV['HOME'], 'Library', 'LaunchAgents', 'fr.technogate.WatchTower.plist') do
96
+ create_file bootloader_path_on_mac do
74
97
  ruby_binary = which('ruby')
75
98
  watch_tower_binary = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'bin', 'watchtower'))
76
99
  template = File.expand_path(find_in_source_paths('watchtower.plist.erb'))
77
100
  ERB.new(File.read(template)).result(binding)
78
101
  end
79
102
 
80
- puts "\nCreated. Now run:\n launchctl load ~/Library/LaunchAgents/fr.technogate.WatchTower.plist\n\n"
103
+ puts "\nCreated. Now run:\n watchtower load_bootloader\n\n"
104
+ end
105
+
106
+ # Load bootloader
107
+ def load_bootloader_on_os
108
+ require 'rbconfig'
109
+ case RbConfig::CONFIG['target_os']
110
+ when /darwin/
111
+ load_bootloader_on_mac
112
+ else
113
+ puts bootloader_not_supported_on_current_os
114
+ end
115
+ end
116
+
117
+ # Unload bootloader
118
+ def unload_bootloader_on_os
119
+ require 'rbconfig'
120
+ case RbConfig::CONFIG['target_os']
121
+ when /darwin/
122
+ unload_bootloader_on_mac
123
+ else
124
+ puts bootloader_not_supported_on_current_os
125
+ end
126
+ end
127
+
128
+ # Reload bootloader
129
+ def reload_bootloader_on_os
130
+ require 'rbconfig'
131
+ case RbConfig::CONFIG['target_os']
132
+ when /darwin/
133
+ reload_bootloader_on_mac
134
+ else
135
+ puts bootloader_not_supported_on_current_os
136
+ end
137
+ end
138
+
139
+ # Load the bootloader
140
+ def load_bootloader_on_mac
141
+ system "launchctl load \#{bootloader_path_on_mac}"
142
+ end
143
+
144
+ # Unload the bootloader
145
+ def unload_bootloader_on_mac
146
+ system "launchctl unload \#{bootloader_path_on_mac}"
147
+ end
148
+
149
+ # Reload the bootloader
150
+ def reload_bootloader_on_mac
151
+ # Unload bootloader
152
+ unload_bootloader_on_mac
153
+ # Load bootloader
154
+ load_bootloader_on_mac
155
+ end
156
+
157
+ # Returns the path of the bootloader on mac
158
+ #
159
+ # @return [String] The path to the bootloader
160
+ def bootloader_path_on_mac
161
+ File.join(ENV['HOME'], 'Library', 'LaunchAgents', 'fr.technogate.WatchTower.plist')
162
+ end
163
+
164
+ def bootloader_not_supported_on_current_os
165
+ <<-MSG
166
+ WatchTower bootloader is not supported on your OS, you'd have to run it manually
167
+ for the time being. Support for many editors and many OSes is planned for the
168
+ future, if you would like to help, or drop in an issue please don't hesitate to
169
+ do so on the project's Github page: https://github.com/TechnoGate/watch_tower
170
+ MSG
81
171
  end
82
172
  END
83
173
  end
@@ -4,7 +4,7 @@ module WatchTower
4
4
  MAJOR = 0
5
5
  MINOR = 0
6
6
  TINY = 1
7
- PRE = "beta2"
7
+ PRE = "beta3"
8
8
 
9
9
  def self.version
10
10
  # Init the version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watch_tower
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta2
4
+ version: 0.0.1.beta3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-appscript
16
- requirement: &2151847880 !ruby/object:Gem::Requirement
16
+ requirement: &2151847860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.6.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151847880
24
+ version_requirements: *2151847860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &2151847240 !ruby/object:Gem::Requirement
27
+ requirement: &2151847120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2151847240
35
+ version_requirements: *2151847120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &2151846040 !ruby/object:Gem::Requirement
38
+ requirement: &2151846120 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.6.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2151846040
46
+ version_requirements: *2151846120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activerecord
49
- requirement: &2151845460 !ruby/object:Gem::Requirement
49
+ requirement: &2151845400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.1.1
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2151845460
57
+ version_requirements: *2151845400
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sinatra
60
- requirement: &2151844780 !ruby/object:Gem::Requirement
60
+ requirement: &2151844720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.3.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2151844780
68
+ version_requirements: *2151844720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sinatra-snap
71
- requirement: &2151844160 !ruby/object:Gem::Requirement
71
+ requirement: &2151844120 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.3.2
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2151844160
79
+ version_requirements: *2151844120
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: haml
82
82
  requirement: &2151843400 !ruby/object:Gem::Requirement
@@ -101,7 +101,7 @@ dependencies:
101
101
  version_requirements: *2151859160
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: coffee-script
104
- requirement: &2151858340 !ruby/object:Gem::Requirement
104
+ requirement: &2151858320 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 2.2.0
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2151858340
112
+ version_requirements: *2151858320
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: uglifier
115
- requirement: &2151857580 !ruby/object:Gem::Requirement
115
+ requirement: &2151857560 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 1.0.3
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2151857580
123
+ version_requirements: *2151857560
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: sass
126
- requirement: &2151856520 !ruby/object:Gem::Requirement
126
+ requirement: &2151856480 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 3.1.10
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *2151856520
134
+ version_requirements: *2151856480
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: sprockets
137
- requirement: &2151855220 !ruby/object:Gem::Requirement
137
+ requirement: &2151855260 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,7 +142,7 @@ dependencies:
142
142
  version: 2.0.2
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *2151855220
145
+ version_requirements: *2151855260
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: guard
148
148
  requirement: &2151854100 !ruby/object:Gem::Requirement
@@ -167,7 +167,7 @@ dependencies:
167
167
  version_requirements: *2151853260
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: guard-rspec
170
- requirement: &2151852340 !ruby/object:Gem::Requirement
170
+ requirement: &2151852380 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ~>
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: 0.4.5
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *2151852340
178
+ version_requirements: *2151852380
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: guard-sprockets2
181
- requirement: &2151867020 !ruby/object:Gem::Requirement
181
+ requirement: &2151867560 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ~>
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: 0.0.5
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *2151867020
189
+ version_requirements: *2151867560
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: yard
192
- requirement: &2151864160 !ruby/object:Gem::Requirement
192
+ requirement: &2151864580 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ~>
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: 0.7.2
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *2151864160
200
+ version_requirements: *2151864580
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: rspec
203
- requirement: &2151862820 !ruby/object:Gem::Requirement
203
+ requirement: &2151862900 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ~>
@@ -208,10 +208,10 @@ dependencies:
208
208
  version: 2.6.0
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *2151862820
211
+ version_requirements: *2151862900
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: rspec-rails
214
- requirement: &2151862020 !ruby/object:Gem::Requirement
214
+ requirement: &2151862200 !ruby/object:Gem::Requirement
215
215
  none: false
216
216
  requirements:
217
217
  - - ~>
@@ -219,10 +219,10 @@ dependencies:
219
219
  version: 2.6.1
220
220
  type: :development
221
221
  prerelease: false
222
- version_requirements: *2151862020
222
+ version_requirements: *2151862200
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: capybara
225
- requirement: &2151872460 !ruby/object:Gem::Requirement
225
+ requirement: &2151872780 !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements:
228
228
  - - ~>
@@ -230,10 +230,10 @@ dependencies:
230
230
  version: 1.1.1
231
231
  type: :development
232
232
  prerelease: false
233
- version_requirements: *2151872460
233
+ version_requirements: *2151872780
234
234
  - !ruby/object:Gem::Dependency
235
235
  name: launchy
236
- requirement: &2151871140 !ruby/object:Gem::Requirement
236
+ requirement: &2151871180 !ruby/object:Gem::Requirement
237
237
  none: false
238
238
  requirements:
239
239
  - - ~>
@@ -241,10 +241,10 @@ dependencies:
241
241
  version: 2.0.5
242
242
  type: :development
243
243
  prerelease: false
244
- version_requirements: *2151871140
244
+ version_requirements: *2151871180
245
245
  - !ruby/object:Gem::Dependency
246
246
  name: mocha
247
- requirement: &2151870300 !ruby/object:Gem::Requirement
247
+ requirement: &2151870380 !ruby/object:Gem::Requirement
248
248
  none: false
249
249
  requirements:
250
250
  - - ~>
@@ -252,10 +252,10 @@ dependencies:
252
252
  version: 0.10.0
253
253
  type: :development
254
254
  prerelease: false
255
- version_requirements: *2151870300
255
+ version_requirements: *2151870380
256
256
  - !ruby/object:Gem::Dependency
257
257
  name: factory_girl
258
- requirement: &2151869280 !ruby/object:Gem::Requirement
258
+ requirement: &2151869300 !ruby/object:Gem::Requirement
259
259
  none: false
260
260
  requirements:
261
261
  - - ~>
@@ -263,10 +263,10 @@ dependencies:
263
263
  version: 2.1.2
264
264
  type: :development
265
265
  prerelease: false
266
- version_requirements: *2151869280
266
+ version_requirements: *2151869300
267
267
  - !ruby/object:Gem::Dependency
268
268
  name: timecop
269
- requirement: &2151868340 !ruby/object:Gem::Requirement
269
+ requirement: &2151868500 !ruby/object:Gem::Requirement
270
270
  none: false
271
271
  requirements:
272
272
  - - ~>
@@ -274,10 +274,10 @@ dependencies:
274
274
  version: 0.3.5
275
275
  type: :development
276
276
  prerelease: false
277
- version_requirements: *2151868340
277
+ version_requirements: *2151868500
278
278
  - !ruby/object:Gem::Dependency
279
279
  name: pry
280
- requirement: &2151881480 !ruby/object:Gem::Requirement
280
+ requirement: &2151881580 !ruby/object:Gem::Requirement
281
281
  none: false
282
282
  requirements:
283
283
  - - ~>
@@ -285,7 +285,7 @@ dependencies:
285
285
  version: 0.9.6.2
286
286
  type: :development
287
287
  prerelease: false
288
- version_requirements: *2151881480
288
+ version_requirements: *2151881580
289
289
  description: WatchTower helps you track the time you spend on each project.
290
290
  email:
291
291
  - wael.nasreddine@gmail.com