watch_tower 0.0.0.1
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 +10 -0
- data/.todo +33 -0
- data/.travis.yml +14 -0
- data/Gemfile +43 -0
- data/Guardfile +25 -0
- data/MIT-LICENSE +20 -0
- data/README.md +38 -0
- data/Rakefile +8 -0
- data/TODO +17 -0
- data/bin/watchtower +10 -0
- data/ci/adapters/jruby-mysql.yml +8 -0
- data/ci/adapters/jruby-postgresql.yml +6 -0
- data/ci/adapters/jruby-sqlite.yml +6 -0
- data/ci/adapters/ruby-mysql.yml +8 -0
- data/ci/adapters/ruby-postgresql.yml +6 -0
- data/ci/adapters/ruby-sqlite.yml +6 -0
- data/ci/travis.rb +102 -0
- data/lib/watch_tower.rb +60 -0
- data/lib/watch_tower/appscript.rb +22 -0
- data/lib/watch_tower/cli.rb +15 -0
- data/lib/watch_tower/cli/.gitkeep +0 -0
- data/lib/watch_tower/cli/install.rb +63 -0
- data/lib/watch_tower/cli/open.rb +24 -0
- data/lib/watch_tower/cli/start.rb +140 -0
- data/lib/watch_tower/config.rb +38 -0
- data/lib/watch_tower/core_ext.rb +4 -0
- data/lib/watch_tower/core_ext/.gitkeep +0 -0
- data/lib/watch_tower/editor.rb +17 -0
- data/lib/watch_tower/editor/.gitkeep +0 -0
- data/lib/watch_tower/editor/base_appscript.rb +34 -0
- data/lib/watch_tower/editor/base_ps.rb +6 -0
- data/lib/watch_tower/editor/textmate.rb +17 -0
- data/lib/watch_tower/editor/xcode.rb +22 -0
- data/lib/watch_tower/errors.rb +25 -0
- data/lib/watch_tower/eye.rb +79 -0
- data/lib/watch_tower/project.rb +14 -0
- data/lib/watch_tower/project/.gitkeep +0 -0
- data/lib/watch_tower/project/any_based.rb +22 -0
- data/lib/watch_tower/project/git_based.rb +86 -0
- data/lib/watch_tower/project/init.rb +38 -0
- data/lib/watch_tower/project/path_based.rb +144 -0
- data/lib/watch_tower/server.rb +62 -0
- data/lib/watch_tower/server/.gitkeep +0 -0
- data/lib/watch_tower/server/app.rb +37 -0
- data/lib/watch_tower/server/assets/images/WatchTower.jpg +0 -0
- data/lib/watch_tower/server/assets/images/percentage.png +0 -0
- data/lib/watch_tower/server/assets/javascripts/application.js +3 -0
- data/lib/watch_tower/server/assets/javascripts/percentage.coffee +8 -0
- data/lib/watch_tower/server/assets/stylesheets/application.css +7 -0
- data/lib/watch_tower/server/assets/stylesheets/global.sass +71 -0
- data/lib/watch_tower/server/assets/stylesheets/project.sass +59 -0
- data/lib/watch_tower/server/configurations.rb +10 -0
- data/lib/watch_tower/server/configurations/asset.rb +43 -0
- data/lib/watch_tower/server/database.rb +105 -0
- data/lib/watch_tower/server/db/migrate/001_create_projects.rb +15 -0
- data/lib/watch_tower/server/db/migrate/002_create_files.rb +16 -0
- data/lib/watch_tower/server/db/migrate/003_create_time_entries.rb +12 -0
- data/lib/watch_tower/server/db/migrate/004_create_durations.rb +14 -0
- data/lib/watch_tower/server/db/migrate/005_add_hash_to_time_entries.rb +6 -0
- data/lib/watch_tower/server/db/migrate/006_add_hash_to_files.rb +6 -0
- data/lib/watch_tower/server/decorator.rb +21 -0
- data/lib/watch_tower/server/decorator/application_decorator.rb +91 -0
- data/lib/watch_tower/server/decorator/file_decorator.rb +38 -0
- data/lib/watch_tower/server/decorator/project_decorator.rb +51 -0
- data/lib/watch_tower/server/helpers.rb +13 -0
- data/lib/watch_tower/server/helpers/asset.rb +29 -0
- data/lib/watch_tower/server/helpers/improved_partials.rb +41 -0
- data/lib/watch_tower/server/models/duration.rb +11 -0
- data/lib/watch_tower/server/models/file.rb +31 -0
- data/lib/watch_tower/server/models/project.rb +17 -0
- data/lib/watch_tower/server/models/time_entry.rb +64 -0
- data/lib/watch_tower/server/public/assets/WatchTower-4d6de11e1bd34165ad91ac46fb711bf3.jpg +0 -0
- data/lib/watch_tower/server/public/assets/application-7829b53b5ece1a16d22dc3d00f329023.css +107 -0
- data/lib/watch_tower/server/public/assets/application-e0e6b7731aade460f680331e65cf0682.js +9359 -0
- data/lib/watch_tower/server/public/assets/percentage-d8589e21a5fc85d32a445f531ff8ab95.png +0 -0
- data/lib/watch_tower/server/vendor/assets/javascripts/jquery-ui.js +11729 -0
- data/lib/watch_tower/server/vendor/assets/javascripts/jquery.js +8981 -0
- data/lib/watch_tower/server/vendor/assets/javascripts/jquery_ujs.js +363 -0
- data/lib/watch_tower/server/views/.gitkeep +0 -0
- data/lib/watch_tower/server/views/_file.haml +9 -0
- data/lib/watch_tower/server/views/_project.haml +13 -0
- data/lib/watch_tower/server/views/index.haml +7 -0
- data/lib/watch_tower/server/views/layout.haml +32 -0
- data/lib/watch_tower/server/views/project.haml +12 -0
- data/lib/watch_tower/templates/config.yml +146 -0
- data/lib/watch_tower/templates/watchtower.plist +23 -0
- data/lib/watch_tower/version.rb +8 -0
- data/spec/factories.rb +45 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/active_record.rb +44 -0
- data/spec/support/factory_girl.rb +6 -0
- data/spec/support/launchy.rb +3 -0
- data/spec/support/sinatra.rb +10 -0
- data/spec/support/timecop.rb +7 -0
- data/spec/watch_tower/appscript_spec.rb +6 -0
- data/spec/watch_tower/cli/install_spec.rb +16 -0
- data/spec/watch_tower/cli/open_spec.rb +14 -0
- data/spec/watch_tower/cli/start_spec.rb +17 -0
- data/spec/watch_tower/cli_spec.rb +15 -0
- data/spec/watch_tower/config_spec.rb +25 -0
- data/spec/watch_tower/editor/textmate_spec.rb +43 -0
- data/spec/watch_tower/editor/xcode_spec.rb +43 -0
- data/spec/watch_tower/editor_spec.rb +19 -0
- data/spec/watch_tower/eye_spec.rb +130 -0
- data/spec/watch_tower/project/git_based_spec.rb +131 -0
- data/spec/watch_tower/project/path_based_spec.rb +111 -0
- data/spec/watch_tower/project_spec.rb +82 -0
- data/spec/watch_tower/server/app_spec.rb +186 -0
- data/spec/watch_tower/server/decorator/project_decorator_spec.rb +60 -0
- data/spec/watch_tower/server/models/file_spec.rb +284 -0
- data/spec/watch_tower/server/models/project_spec.rb +165 -0
- data/spec/watch_tower/server/models/time_entry_spec.rb +37 -0
- data/spec/watch_tower/server_spec.rb +4 -0
- data/watch_tower.gemspec +80 -0
- metadata +450 -0
data/.gitignore
ADDED
data/.todo
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<todo version="0.1.20">
|
|
3
|
+
<note priority="medium" time="1317884658" done="1317889968">
|
|
4
|
+
Remove the last_id from File and Project as it's not needed.
|
|
5
|
+
</note>
|
|
6
|
+
<note priority="medium" time="1317884720" done="1317891752">
|
|
7
|
+
Add a default_scope to sort files and projects by their elapsed time
|
|
8
|
+
</note>
|
|
9
|
+
<note priority="medium" time="1317888883" done="1317895336">
|
|
10
|
+
Add a config file, a yaml file to configure watch_tower a section under database/environment should be added to configure the server's database... watch_tower should not be run unless the config file has been edited.
|
|
11
|
+
</note>
|
|
12
|
+
<note priority="medium" time="1317889118" done="1317980852">
|
|
13
|
+
Add a ci/travis.rb script which runs the tests under Travis-CI, needed because the config file added in todo number 3 won't exist and the current setup (sqlite) does not work with JRuby
|
|
14
|
+
</note>
|
|
15
|
+
<note priority="high" time="1318256016">
|
|
16
|
+
Figure out how to load assets from gems and remove the bundled jQuery files.
|
|
17
|
+
</note>
|
|
18
|
+
<note priority="medium" time="1317895354">
|
|
19
|
+
The Config module need some tests.
|
|
20
|
+
</note>
|
|
21
|
+
<note priority="medium" time="1317980873">
|
|
22
|
+
Convert the Editor module to be Enumerable for easier access to the list of editors
|
|
23
|
+
</note>
|
|
24
|
+
<note priority="medium" time="1317996464">
|
|
25
|
+
maybe use sinatra-simple-navigation gem
|
|
26
|
+
</note>
|
|
27
|
+
<note priority="medium" time="1318109702">
|
|
28
|
+
Add tracking by git branch, needs a branches table that belongs to a project and has many time_entries
|
|
29
|
+
</note>
|
|
30
|
+
<note priority="medium" time="1318258373">
|
|
31
|
+
Maybe use a Rails engine instead of Sinatra ?
|
|
32
|
+
</note>
|
|
33
|
+
</todo>
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
script: 'ci/travis.rb'
|
|
2
|
+
rvm:
|
|
3
|
+
- 1.9.2
|
|
4
|
+
- 1.9.3
|
|
5
|
+
# - jruby
|
|
6
|
+
# - rbx-2.0
|
|
7
|
+
env:
|
|
8
|
+
- WATCH_TOWER_ENV=test RBXOPT="${RBXOPT} -X19" JRUBY_OPTS="${JRUBY_OPTS} --1.9" ADAPTERS="sqlite:mysql:postgresql"
|
|
9
|
+
notifications:
|
|
10
|
+
recipients:
|
|
11
|
+
- wael.nasreddine@gmail.com
|
|
12
|
+
email:
|
|
13
|
+
on_success: change
|
|
14
|
+
on_failure: always
|
data/Gemfile
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Sources
|
|
2
|
+
source "http://rubygems.org"
|
|
3
|
+
|
|
4
|
+
# Parse watch_tower.gemspec
|
|
5
|
+
gemspec
|
|
6
|
+
|
|
7
|
+
####
|
|
8
|
+
# For development or testing
|
|
9
|
+
###
|
|
10
|
+
|
|
11
|
+
# Require rbconfig to figure out the target OS
|
|
12
|
+
require 'rbconfig'
|
|
13
|
+
|
|
14
|
+
platforms :jruby do
|
|
15
|
+
gem 'activerecord-jdbcmysql-adapter'
|
|
16
|
+
gem 'activerecord-jdbcpostgresql-adapter'
|
|
17
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
platforms :ruby do
|
|
21
|
+
gem 'mysql2'
|
|
22
|
+
gem 'sqlite3'
|
|
23
|
+
|
|
24
|
+
unless ENV['TRAVIS']
|
|
25
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
|
26
|
+
gem 'rb-fsevent', require: false
|
|
27
|
+
gem 'ruby-growl', require: false
|
|
28
|
+
gem 'growl', require: false
|
|
29
|
+
end
|
|
30
|
+
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
|
31
|
+
gem 'rb-inotify', require: false
|
|
32
|
+
gem 'libnotify', require: false
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
platforms :mri do
|
|
38
|
+
gem 'pg'
|
|
39
|
+
|
|
40
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
|
41
|
+
gem 'rb-appscript', '~>0.6.1'
|
|
42
|
+
end
|
|
43
|
+
end
|
data/Guardfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
$:.push File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
|
|
2
|
+
require 'watch_tower'
|
|
3
|
+
|
|
4
|
+
guard 'bundler' do
|
|
5
|
+
watch('Gemfile')
|
|
6
|
+
watch(/^.+\.gemspec/)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
guard 'sprockets2',
|
|
10
|
+
sprockets: WatchTower::Server::App.sprockets,
|
|
11
|
+
assets_path: 'lib/watch_tower/server/public/assets' do
|
|
12
|
+
watch(%r{^lib/watch_tower/server/assets/.+$})
|
|
13
|
+
watch('lib/watch_tower/server/app.rb')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
guard 'rspec', :version => 2 do
|
|
17
|
+
# All specs
|
|
18
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
19
|
+
watch('spec/spec_helper.rb') { "spec" }
|
|
20
|
+
watch(%r{spec/factories/(.+)\.rb} ) { "spec" }
|
|
21
|
+
watch(%r{spec/support/(.+)\.rb} ) { "spec" }
|
|
22
|
+
|
|
23
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
24
|
+
watch(%r(^lib/watch_tower/server/(views|extensions|presenters)/(.+)$)) { "spec/watch_tower/server/app_spec.rb" }
|
|
25
|
+
end
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Wael Nasreddine <wael.nasreddine@gmail.com>
|
|
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.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Watch Tower [](http://travis-ci.org/TechnoGate/watch_tower) 
|
|
2
|
+
|
|
3
|
+
<a href='http://www.pledgie.com/campaigns/16123'><img alt='Click here to lend your support to: Open Source Projects and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/16123.png?skin_name=chrome' border='0' /></a>
|
|
4
|
+
|
|
5
|
+
WatchTower helps you track the time you spend on each project.
|
|
6
|
+
|
|
7
|
+
# Introduction
|
|
8
|
+
|
|
9
|
+
Are you tired of not-knowing how much each of your projects really costs? Watch Tower
|
|
10
|
+
comes to the rescue.
|
|
11
|
+
|
|
12
|
+
WatchTower runs in the background and it monitors your editors (see Supported
|
|
13
|
+
Editors) and records the time you spend on each file and thus on the project
|
|
14
|
+
in total, and using a web interface, it presents you with statistics on each
|
|
15
|
+
project
|
|
16
|
+
|
|
17
|
+
# Installation
|
|
18
|
+
|
|
19
|
+
The installation has been made as simple as possible, here's the steps required:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ gem install watch_tower
|
|
23
|
+
$ watchtower intall
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This creates a configuration file which you __should__ review before invoking
|
|
27
|
+
__WatchTower__, located at __~/.watch_tower/config.yml__ the configuration file
|
|
28
|
+
is self explanatory.
|
|
29
|
+
|
|
30
|
+
# Usage
|
|
31
|
+
|
|
32
|
+
The installation process should create a launcher on login which starts
|
|
33
|
+
__WatchTower__ you can open the web interface by going to
|
|
34
|
+
http://localhost:9282 or using the command
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
$ watchtower open
|
|
38
|
+
```
|
data/Rakefile
ADDED
data/TODO
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
- Figure out how to load assets from gems and remove the bundled jQuery files.
|
|
2
|
+
(added Mon Oct 10 16:13:36 2011, incomplete, priority high)
|
|
3
|
+
|
|
4
|
+
- The Config module need some tests.
|
|
5
|
+
(added Thu Oct 6 12:02:34 2011, incomplete, priority medium)
|
|
6
|
+
|
|
7
|
+
- Convert the Editor module to be Enumerable for easier access to the list of editors
|
|
8
|
+
(added Fri Oct 7 11:47:53 2011, incomplete, priority medium)
|
|
9
|
+
|
|
10
|
+
- maybe use sinatra-simple-navigation gem
|
|
11
|
+
(added Fri Oct 7 16:07:44 2011, incomplete, priority medium)
|
|
12
|
+
|
|
13
|
+
- Add tracking by git branch, needs a branches table that belongs to a project and has many time_entries
|
|
14
|
+
(added Sat Oct 8 23:35:02 2011, incomplete, priority medium)
|
|
15
|
+
|
|
16
|
+
- Maybe use a Rails engine instead of Sinatra ?
|
|
17
|
+
(added Mon Oct 10 16:52:53 2011, incomplete, priority medium)
|
data/bin/watchtower
ADDED
data/ci/travis.rb
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This file has been taken from rails
|
|
3
|
+
# https://github.com/rails/rails/blob/master/ci/travis.rb
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
include FileUtils
|
|
6
|
+
|
|
7
|
+
commands = [
|
|
8
|
+
'mysql -e "create database watch_tower_test;"',
|
|
9
|
+
'psql -c "create database watch_tower_test;" -U postgres'
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
commands.each do |command|
|
|
13
|
+
system("#{command} > /dev/null 2>&1")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class Build
|
|
17
|
+
attr_reader :options
|
|
18
|
+
|
|
19
|
+
def initialize(options = {})
|
|
20
|
+
@options = options
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def run!(options = {})
|
|
24
|
+
self.options.update(options)
|
|
25
|
+
create_config_file
|
|
26
|
+
announce(heading)
|
|
27
|
+
rake(*tasks)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def create_config_file
|
|
31
|
+
commands = [
|
|
32
|
+
"mkdir -p ~/.watch_tower",
|
|
33
|
+
"cp lib/watch_tower/templates/config.yml ~/.watch_tower/config.yml",
|
|
34
|
+
"cat ci/adapters/#{ruby_platform}-#{adapter}.yml >> ~/.watch_tower/config.yml"
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
commands.each do |command|
|
|
38
|
+
system("#{command}")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def ruby_platform
|
|
43
|
+
RUBY_PLATFORM == 'java' ? 'jruby' : 'ruby'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def announce(heading)
|
|
47
|
+
puts "\n\e[1;33m[Travis CI] #{heading}\e[m\n"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def heading
|
|
51
|
+
heading = [gem]
|
|
52
|
+
heading << "with #{adapter}"
|
|
53
|
+
heading.join(' ')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def tasks
|
|
57
|
+
"spec"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def gem
|
|
61
|
+
'watch_tower'
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def adapter
|
|
65
|
+
@options[:adapter]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def rake(*tasks)
|
|
69
|
+
tasks.each do |task|
|
|
70
|
+
cmd = "bundle exec rake #{task}"
|
|
71
|
+
puts "Running command: #{cmd}"
|
|
72
|
+
return false unless system(cmd)
|
|
73
|
+
end
|
|
74
|
+
true
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
results = {}
|
|
79
|
+
|
|
80
|
+
ENV['ADAPTERS'].split(':').each do |adapter|
|
|
81
|
+
# PG is not working on RBX
|
|
82
|
+
# Probably a bug on Travis, to investigate of course
|
|
83
|
+
if adapter == 'postgresql' && RUBY_ENGINE == 'rbx'
|
|
84
|
+
results[adapter] = true
|
|
85
|
+
else
|
|
86
|
+
build = Build.new(adapter: adapter)
|
|
87
|
+
results[adapter] = build.run!
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
failures = results.select { |key, value| value == false }
|
|
92
|
+
|
|
93
|
+
if failures.empty?
|
|
94
|
+
puts
|
|
95
|
+
puts "WatchTower build finished sucessfully"
|
|
96
|
+
exit(true)
|
|
97
|
+
else
|
|
98
|
+
puts
|
|
99
|
+
puts "WatchTower build FAILED"
|
|
100
|
+
puts "Failed adapters: #{failures.join(', ')}"
|
|
101
|
+
exit(false)
|
|
102
|
+
end
|
data/lib/watch_tower.rb
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# RubyGems is needed at first
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
|
|
4
|
+
# Require daemon from active_support's core_ext allows us to fork really quickly
|
|
5
|
+
require 'active_support/core_ext/process/daemon'
|
|
6
|
+
|
|
7
|
+
# External requirements
|
|
8
|
+
require 'fileutils'
|
|
9
|
+
require 'logger'
|
|
10
|
+
require 'active_record'
|
|
11
|
+
|
|
12
|
+
# Define a few pathes
|
|
13
|
+
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
|
14
|
+
LIB_PATH = File.join(ROOT_PATH, 'lib', 'watch_tower')
|
|
15
|
+
SERVER_PATH = File.join(LIB_PATH, 'server')
|
|
16
|
+
MODELS_PATH = File.join(SERVER_PATH, 'models')
|
|
17
|
+
EXTENSIONS_PATH = File.join(SERVER_PATH, 'extensions')
|
|
18
|
+
MIGRATIONS_PATH = File.join(SERVER_PATH, 'db', 'migrate')
|
|
19
|
+
TEMPLATE_PATH = File.join(LIB_PATH, 'templates')
|
|
20
|
+
USER_PATH = File.expand_path(File.join(ENV['HOME'], '.watch_tower'))
|
|
21
|
+
DATABASE_PATH = File.join(USER_PATH, 'databases')
|
|
22
|
+
LOG_PATH = File.join(USER_PATH, 'log')
|
|
23
|
+
|
|
24
|
+
# Define the environment by default set to development
|
|
25
|
+
ENV['WATCH_TOWER_ENV'] ||= 'development'
|
|
26
|
+
|
|
27
|
+
# Make sure the USER_PATH exist
|
|
28
|
+
FileUtils.mkdir_p USER_PATH
|
|
29
|
+
FileUtils.mkdir_p DATABASE_PATH
|
|
30
|
+
FileUtils.mkdir_p LOG_PATH
|
|
31
|
+
|
|
32
|
+
# module WatchTower
|
|
33
|
+
module WatchTower
|
|
34
|
+
|
|
35
|
+
# Create a logger
|
|
36
|
+
LOG = Logger.new(File.join(LOG_PATH, 'watch_tower.log'))
|
|
37
|
+
|
|
38
|
+
# Threads
|
|
39
|
+
# Hash
|
|
40
|
+
@@threads = {}
|
|
41
|
+
|
|
42
|
+
# Returh the threads
|
|
43
|
+
#
|
|
44
|
+
# @return [Hash] Threads
|
|
45
|
+
def self.threads
|
|
46
|
+
@@threads
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Require watch_tower's libraries
|
|
52
|
+
require "watch_tower/version"
|
|
53
|
+
require "watch_tower/errors"
|
|
54
|
+
require "watch_tower/core_ext"
|
|
55
|
+
require "watch_tower/config"
|
|
56
|
+
require "watch_tower/cli"
|
|
57
|
+
require "watch_tower/editor"
|
|
58
|
+
require "watch_tower/project"
|
|
59
|
+
require "watch_tower/eye"
|
|
60
|
+
require "watch_tower/server"
|