kit 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +34 -1
- data/kits/my_kit/{my_kit.rb → bit.rb} +1 -1
- data/kits/my_kit/config.yml +25 -5
- data/kits/my_kit/{actions.sql → sqlite3_actions.sql} +0 -0
- data/kits/my_kit/{info.sql → sqlite3_info.sql} +0 -0
- data/lib/kit.rb +33 -6
- data/lib/kit/db_sqlite3.rb +11 -6
- data/spec/my_kit/my_kit.yml +17 -0
- data/spec/my_kit_spec.rb +12 -14
- metadata +41 -11
data/README
CHANGED
@@ -1 +1,34 @@
|
|
1
|
-
|
1
|
+
= Kit
|
2
|
+
|
3
|
+
Kit is a framework for making simple management tools called kits.
|
4
|
+
|
5
|
+
* Kit is brand new and still very much under construction (a lot of which still included documentation such as this README file).
|
6
|
+
* The gem includes a skeleton kit for managing web projects: clone, deploy upgrades, and push git updates to your web apps.
|
7
|
+
|
8
|
+
== Installation
|
9
|
+
|
10
|
+
=== Gem Installation
|
11
|
+
|
12
|
+
Download and install kit with the following.
|
13
|
+
|
14
|
+
gem install kit
|
15
|
+
|
16
|
+
== Development
|
17
|
+
|
18
|
+
=== Source Repository
|
19
|
+
|
20
|
+
kit is currently hosted at github. The github web page is
|
21
|
+
https://github.com/razor-x/kit. The public git clone URL is
|
22
|
+
|
23
|
+
* git://github.com/razor-x/kit.git
|
24
|
+
|
25
|
+
== License
|
26
|
+
|
27
|
+
Kit is licensed under the GPLv3.
|
28
|
+
|
29
|
+
== Warranty
|
30
|
+
|
31
|
+
This software is provided "as is" and without any express or
|
32
|
+
implied warranties, including, without limitation, the implied
|
33
|
+
warranties of merchantibility and fitness for a particular
|
34
|
+
purpose.
|
data/kits/my_kit/config.yml
CHANGED
@@ -1,15 +1,35 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Path to this kit's root directory.
|
2
|
+
# Absolute or relative to this config file.
|
3
|
+
# If not specified, defaults to the folder that holds this config file.
|
4
|
+
#
|
5
|
+
:kits_path:
|
6
|
+
#
|
7
|
+
# Database backend to use. Available options:
|
8
|
+
# :sqlite3
|
9
|
+
#
|
3
10
|
:db_backend: :sqlite3
|
4
|
-
|
11
|
+
#
|
12
|
+
# Path to the files to save each sqlite3 database (since only sqlite3 is supported).
|
13
|
+
# Absolute or relative to this config file.
|
14
|
+
#
|
5
15
|
:db_config:
|
6
16
|
:info: "info.db"
|
7
17
|
:actions: "actions.db"
|
8
|
-
|
18
|
+
#
|
19
|
+
# Tables and columns for each database.
|
20
|
+
#
|
21
|
+
# Each table in the :info: database must be of the form
|
22
|
+
# :table_name: [ :rowid, :name, :column_name_1, :column_name_2 ]
|
23
|
+
# where :rowid and :name are required columns.
|
24
|
+
#
|
9
25
|
:info:
|
10
26
|
:bits: [ :rowid, :name, :project, :root, :commit, :commit_time ]
|
11
27
|
:projects: [ :rowid, :name, :git ]
|
12
|
-
|
28
|
+
#
|
29
|
+
# Each table in the :actions: database must be of the form
|
30
|
+
# :table_name: [ :rowid, :status, :column_name_1, :column_name_2 ]
|
31
|
+
# where :rowid and :status are required columns.
|
32
|
+
#
|
13
33
|
:actions:
|
14
34
|
:clones: [ :rowid, :status, :src, :site ]
|
15
35
|
:upgrades: [ :rowid, :status, :site, :component, :file ]
|
File without changes
|
File without changes
|
data/lib/kit.rb
CHANGED
@@ -1,21 +1,48 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
1
|
class Kit
|
4
2
|
|
5
|
-
def initialize
|
3
|
+
def initialize config
|
4
|
+
|
5
|
+
config = load_config_file config if File.exists? config
|
6
|
+
|
7
|
+
fail StandardError unless config.is_a? Hash
|
8
|
+
fail StandardError unless config[:kits_path]
|
9
|
+
|
10
|
+
@@kit_path = config[:kits_path]
|
6
11
|
|
7
|
-
|
12
|
+
defaults = YAML.load File.read @@kit_path + "/config.yml"
|
13
|
+
config = defaults.merge config
|
8
14
|
|
9
15
|
load 'kit/db_sqlite3.rb' if config[:db_backend] == :sqlite3
|
10
16
|
|
11
|
-
load
|
17
|
+
load @@kit_path + "/bit.rb"
|
12
18
|
|
13
|
-
@@kit_path = path
|
14
19
|
@@db = Backend.new config[:db_config]
|
15
20
|
@@info = config[:info]
|
16
21
|
@@actions = config[:actions]
|
17
22
|
end
|
18
23
|
|
24
|
+
def load_config_file file
|
25
|
+
|
26
|
+
config = YAML.load File.read file
|
27
|
+
@@config_path = File.absolute_path File.dirname file
|
28
|
+
|
29
|
+
dir = config[:kits_path]
|
30
|
+
if config[:kits_path].nil?
|
31
|
+
dir = @@config_path
|
32
|
+
else
|
33
|
+
dir = File.absolute_path @@config_path + config[:kits_path] unless [ "/", "~" ].include? config[:kits_path][0]
|
34
|
+
end
|
35
|
+
|
36
|
+
config[:kits_path] = dir
|
37
|
+
return config
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete_dbs
|
41
|
+
@@db.db_paths.each do |key, f|
|
42
|
+
File.delete f
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
19
46
|
def add_bit info
|
20
47
|
Bit.new info
|
21
48
|
end
|
data/lib/kit/db_sqlite3.rb
CHANGED
@@ -28,14 +28,19 @@ class Backend < Kit
|
|
28
28
|
|
29
29
|
include SQLite3Tools
|
30
30
|
|
31
|
-
|
31
|
+
attr_reader :db_paths
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
def initialize db_paths
|
34
|
+
db_paths.each do |key, db|
|
35
|
+
name = File.basename db
|
36
|
+
dir = File.dirname db
|
37
|
+
dir = @@config_path unless [ "/", "~" ].include? dir[0]
|
38
|
+
db_paths[key] = "#{dir}/#{name}"
|
36
39
|
end
|
37
40
|
|
38
|
-
|
41
|
+
@db_paths = db_paths
|
42
|
+
|
43
|
+
dbs = db_prepare @db_paths
|
39
44
|
@info_db = dbs[:info]
|
40
45
|
@action_db = dbs[:actions]
|
41
46
|
end
|
@@ -44,7 +49,7 @@ class Backend < Kit
|
|
44
49
|
def db_prepare db_paths
|
45
50
|
|
46
51
|
def db_initialize type, db
|
47
|
-
sql = File.read @@kit_path + "#{type}.sql"
|
52
|
+
sql = File.read @@kit_path + "/sqlite3_#{type}.sql"
|
48
53
|
db.execute_batch sql
|
49
54
|
end
|
50
55
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Path to this kit's root directory.
|
2
|
+
# Absolute or relative to this config file.
|
3
|
+
# If not specified, defaults to the folder that holds this config file.
|
4
|
+
#
|
5
|
+
:kits_path: "../../../kits/my_kit"
|
6
|
+
#
|
7
|
+
# Database backend to use. Available options:
|
8
|
+
# :sqlite3
|
9
|
+
#
|
10
|
+
:db_backend: :sqlite3
|
11
|
+
#
|
12
|
+
# Path to the files to save each sqlite3 database (since only sqlite3 is supported).
|
13
|
+
# Absolute or relative to this config file.
|
14
|
+
#
|
15
|
+
:db_config:
|
16
|
+
:info: "info.db"
|
17
|
+
:actions: "actions.db"
|
data/spec/my_kit_spec.rb
CHANGED
@@ -2,27 +2,25 @@ require 'kit'
|
|
2
2
|
|
3
3
|
describe Kit do
|
4
4
|
|
5
|
-
|
5
|
+
MY_KIT_CONFIG = "spec/my_kit/my_kit.yml"
|
6
6
|
|
7
7
|
before :all do
|
8
|
-
@kit = Kit.new
|
8
|
+
@kit = Kit.new MY_KIT_CONFIG
|
9
9
|
end
|
10
10
|
|
11
|
-
it "
|
12
|
-
|
13
|
-
|
11
|
+
it "adds a new bit" do
|
12
|
+
new_bit = { :name => "live", :project_name => "my_project", :root => "./my_kit_spec/my_project", :git => "git path" }
|
13
|
+
b = @kit.add_bit new_bit
|
14
14
|
|
15
|
-
|
15
|
+
b.class.should == Bit
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
if config[:db_backend] == :sqlite3
|
20
|
-
config[:db_config].each do |key, p|
|
21
|
-
dir = File.dirname p
|
22
|
-
f = MY_KIT_PATH + p if dir == "."
|
23
|
-
File.delete f
|
24
|
-
end
|
17
|
+
new_bit.each do |key, value|
|
18
|
+
( b.send key ).should == value
|
25
19
|
end
|
26
20
|
end
|
27
21
|
|
22
|
+
after :all do
|
23
|
+
@kit.delete_dbs
|
24
|
+
end
|
25
|
+
|
28
26
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Evan Boyd Sosenko
|
@@ -16,9 +16,38 @@ cert_chain: []
|
|
16
16
|
|
17
17
|
date: 2011-04-28 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
21
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: sqlite3
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 3
|
31
|
+
- 3
|
32
|
+
version: 1.3.3
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: yaml
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 3
|
46
|
+
- 3
|
47
|
+
version: 1.3.3
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
description: "\t\tKit is a framework for making simple management tools called kits. Includes a skeleton kit for managing web projects: clone, deploy upgrades, and push git updates to your web apps.\n"
|
22
51
|
email:
|
23
52
|
executables: []
|
24
53
|
|
@@ -32,13 +61,14 @@ files:
|
|
32
61
|
- lib/kit.rb
|
33
62
|
- README
|
34
63
|
- kits/my_kit/commits/my_project.rb
|
35
|
-
- kits/my_kit/info.sql
|
36
64
|
- kits/my_kit/clones/my_project.rb
|
37
65
|
- kits/my_kit/config.yml
|
38
|
-
- kits/my_kit/
|
39
|
-
- kits/my_kit/
|
66
|
+
- kits/my_kit/sqlite3_actions.sql
|
67
|
+
- kits/my_kit/bit.rb
|
68
|
+
- kits/my_kit/sqlite3_info.sql
|
40
69
|
- kits/my_kit/upgrades/my_project.rb
|
41
70
|
- spec/my_kit_spec.rb
|
71
|
+
- spec/my_kit/my_kit.yml
|
42
72
|
has_rdoc: true
|
43
73
|
homepage:
|
44
74
|
licenses:
|
@@ -66,12 +96,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
96
|
segments:
|
67
97
|
- 0
|
68
98
|
version: "0"
|
69
|
-
requirements:
|
70
|
-
|
99
|
+
requirements:
|
100
|
+
- SQLite3
|
71
101
|
rubyforge_project:
|
72
102
|
rubygems_version: 1.3.7
|
73
103
|
signing_key:
|
74
104
|
specification_version: 3
|
75
|
-
summary: Extendable tool to manage site development
|
105
|
+
summary: Extendable tool to manage site development and more.
|
76
106
|
test_files: []
|
77
107
|
|