kit 0.0.3 → 0.0.4

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.
@@ -1,17 +1,9 @@
1
1
  module Actions
2
2
 
3
- private
4
- def rsync
5
- # puts "rsync go!"
6
- end
7
-
8
3
  def clones options
9
4
  src = Bit.new options[:src]
10
5
  # fail ProjectMismatch unless @project_id == src.project_id
11
-
12
6
  puts "cloning #{src.project_name}.#{src.name} to #{@project_name}.#{@name}"
13
-
14
-
15
7
  end
16
8
 
17
9
  end
@@ -0,0 +1,16 @@
1
+ :name: "my_kit"
2
+
3
+ :db_backend: :sqlite3
4
+
5
+ :db_config:
6
+ :info: "info.db"
7
+ :actions: "actions.db"
8
+
9
+ :info:
10
+ :bits: [ :rowid, :name, :project, :root, :commit, :commit_time ]
11
+ :projects: [ :rowid, :name, :git ]
12
+
13
+ :actions:
14
+ :clones: [ :rowid, :status, :src, :site ]
15
+ :upgrades: [ :rowid, :status, :site, :component, :file ]
16
+ :commits: [ :rowid, :status, :site, :requested_commit ]
@@ -2,7 +2,6 @@ module Actions
2
2
 
3
3
  def upgrades options
4
4
  puts "upgrading"
5
-
6
5
  end
7
6
 
8
7
  end
@@ -29,6 +29,12 @@ class Backend < Kit
29
29
  include SQLite3Tools
30
30
 
31
31
  def initialize db_paths
32
+
33
+ db_paths.each do |key, p|
34
+ dir = File.dirname p
35
+ db_paths[key] = @@kit_path + p if dir == "."
36
+ end
37
+
32
38
  dbs = db_prepare db_paths
33
39
  @info_db = dbs[:info]
34
40
  @action_db = dbs[:actions]
data/lib/kit.rb CHANGED
@@ -1,17 +1,19 @@
1
+ require 'yaml'
2
+
1
3
  class Kit
2
4
 
3
5
  def initialize path
4
6
 
5
- load path + "config.rb"
7
+ config = YAML.load File.read path + "config.yml"
6
8
 
7
- load 'kit/db_sqlite3.rb' if DB_BACKEND == :sqlite3
9
+ load 'kit/db_sqlite3.rb' if config[:db_backend] == :sqlite3
8
10
 
9
- load path + NAME + ".rb"
11
+ load path + config[:name] + ".rb"
10
12
 
11
13
  @@kit_path = path
12
- @@db = Backend.new DB_CONFIG
13
- @@info = INFO
14
- @@actions = ACTIONS
14
+ @@db = Backend.new config[:db_config]
15
+ @@info = config[:info]
16
+ @@actions = config[:actions]
15
17
  end
16
18
 
17
19
  def add_bit info
data/spec/my_kit_spec.rb CHANGED
@@ -2,9 +2,27 @@ require 'kit'
2
2
 
3
3
  describe Kit do
4
4
 
5
- describe "#new" do
6
- k = Kit.new "/home/razorx/development/kit/kits/my_kit/"
7
- b = { :name => "otr", :git => "git", :project_name => "otr", :root => "root" }
8
- k.add_bit b
5
+ MY_KIT_PATH = "kits/my_kit/"
6
+
7
+ before :all do
8
+ @kit = Kit.new MY_KIT_PATH
9
+ end
10
+
11
+ it "can create a new kit" do
12
+ @kit.class.should == Kit
9
13
  end
14
+
15
+ after :all do
16
+
17
+ # Delete the sqlite3 database after running all tests
18
+ config = YAML.load File.read MY_KIT_PATH + "config.yml"
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
25
+ end
26
+ end
27
+
10
28
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evan Boyd Sosenko
@@ -34,9 +34,9 @@ files:
34
34
  - kits/my_kit/commits/my_project.rb
35
35
  - kits/my_kit/info.sql
36
36
  - kits/my_kit/clones/my_project.rb
37
+ - kits/my_kit/config.yml
37
38
  - kits/my_kit/my_kit.rb
38
39
  - kits/my_kit/actions.sql
39
- - kits/my_kit/config.rb
40
40
  - kits/my_kit/upgrades/my_project.rb
41
41
  - spec/my_kit_spec.rb
42
42
  has_rdoc: true
@@ -1,15 +0,0 @@
1
- NAME = "my_kit"
2
- DB_BACKEND = :sqlite3
3
- DB_CONFIG = {
4
- :info => "/home/razorx/development/kit/kits/my_kit/info.db",
5
- :actions => "/home/razorx/development/kit/kits/my_kit/actions.db"
6
- }
7
- INFO = {
8
- :bits => [ :rowid, :name, :project, :root, :commit, :commit_time ],
9
- :projects => [ :rowid, :name, :git ]
10
- }
11
- ACTIONS = {
12
- :clones => [ :rowid, :status, :src, :site ],
13
- :upgrades => [ :rowid, :status, :site, :component, :file ],
14
- :commits => [ :rowid, :status, :site, :requested_commit ]
15
- }