scriptorium 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba4a7ccc7ce7a40b162ed707305dd93d57f6ea1bf833ed906850ec1f36aff472
4
- data.tar.gz: d3235d8de8f2a933f97f28ab4cd5b3dc7e5c2301ea519a17e997b0849985b893
3
+ metadata.gz: bd8976bc35d478aa3db8436bb05812014abcc09f4b9a36ee20b14b2190468d98
4
+ data.tar.gz: 6745ebaf60ccb3f5bfdf60b80b8931725218d27a03a66f852d133cd5a5573ea1
5
5
  SHA512:
6
- metadata.gz: 043c37917c9420e5fdc38f032197c13a79cd7fe97dfc9d2cc02ba3bceeb606ee626b3827803726da7452cf955921698d95a174178a542275d51899657b75f3da
7
- data.tar.gz: 9403ab04666321ac164fad080e26600ccdbe5668973e476952082c3011ebb75f99cba35e9f7dd23f5e70fb3329f82a6ecdb86bbf0d21f35532ddd835b6b2ec63
6
+ metadata.gz: 061bf84937fe3de2727328300d0308bc14de9fdab705e4fed1c81b5a06c6622d16d55cd3c9399230d4af1d09c3ee1e2ff8fe69020add4a660b17d818c6594863
7
+ data.tar.gz: 4e923d45513ab03f8c438f9673a3bf37646e381eb1d45a144f28deec95f29a37a71481b1e9213316c8796d9bd3bc60bff2e974f9774cce9b404b8894783ab242
data/bin/sblog CHANGED
@@ -3,6 +3,9 @@
3
3
  require 'scriptorium'
4
4
  require 'rubytext'
5
5
 
6
- puts "sblog: Nothing here yet."
6
+ puts "sblog: Attempting .new"
7
+
8
+ $blog = Scriptorium.new
9
+
7
10
  puts
8
- ~
11
+
@@ -0,0 +1,22 @@
1
+ module Scriptorium::Engine
2
+
3
+ include Scriptorium::Exceptions
4
+
5
+ def repo_exists?
6
+ Dir.exist?(@dir)
7
+ end
8
+
9
+ def create_new_repo
10
+ Dir.mkdir(@dir)
11
+ Dir.chdir(@dir) do
12
+ subs = %w[config views]
13
+ subs.each {|sub| Dir.mkdir(sub) }
14
+ end
15
+ end
16
+
17
+ def destroy_repo
18
+ raise TestModeOnly unless Scriptorium.testing
19
+ system("rm -rf #@dir")
20
+ end
21
+
22
+ end
@@ -0,0 +1,5 @@
1
+ module Scriptorium::Exceptions
2
+
3
+ class TestModeOnly < Exception; end
4
+
5
+ end
@@ -1,5 +1,5 @@
1
1
  class Scriptorium
2
2
 
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.3"
4
4
 
5
5
  end
data/lib/scriptorium.rb CHANGED
@@ -1,10 +1,42 @@
1
1
  require_relative "skeleton"
2
2
 
3
+ require_relative "scriptorium/engine"
4
+ require_relative "scriptorium/exceptions"
5
+
6
+ require 'singleton'
7
+
8
+ ###
9
+
3
10
  class Scriptorium
4
11
 
12
+ include Singleton
13
+
14
+ include Exceptions
15
+ include Engine
16
+
17
+ # Class instance vars...
18
+ @testing = $testing # good/bad idea?
19
+ @blog = nil
20
+
21
+ class << self
22
+ attr_accessor :testing
23
+ alias blog instance
24
+ end
25
+
26
+ # Instance attrs/methods
27
+
28
+ attr_reader :name, :dir
29
+
5
30
  def initialize
6
- puts "Initializing... no code yet."
7
- puts
31
+ @testing = self.class.testing
32
+ @home = ENV['HOME']
33
+ if @testing
34
+ @name = "TEST-ONLY BLOG REPO"
35
+ @dir = "#@home/test-scriptorium"
36
+ else
37
+ @name = "Scriptorium repository"
38
+ @dir = "#@home/Scriptorium"
39
+ end
8
40
  end
9
41
 
10
42
  end
data/lib/skeleton.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  class Scriptorium
2
2
 
3
- class Engine
3
+ module Exceptions
4
+ end
5
+
6
+ module Engine
4
7
  end
5
8
 
6
9
  class UI
@@ -0,0 +1,44 @@
1
+ require 'minitest/autorun'
2
+
3
+ require_relative '../../lib/scriptorium'
4
+
5
+ class TestScriptoriumEngine < MiniTest::Test
6
+
7
+ TestModeOnly = Scriptorium::TestModeOnly
8
+
9
+ def setup
10
+ @blog = Scriptorium.blog
11
+ Scriptorium.testing = true
12
+ end
13
+
14
+ def teardown
15
+ Scriptorium.testing = true
16
+ end
17
+
18
+ def test_singleton
19
+ refute_nil @blog, "blog accessor was nil"
20
+ assert_raises(NoMethodError) { y = Scriptorium.new }
21
+ end
22
+
23
+ def test_repo_create_destroy
24
+ t0 = @blog.repo_exists?
25
+ refute t0, "Repo should not exist yet"
26
+
27
+ @blog.create_new_repo
28
+
29
+ t1 = @blog.repo_exists?
30
+ assert t1, "Repo should exist"
31
+
32
+ @blog.destroy_repo
33
+
34
+ t2 = @blog.repo_exists?
35
+ refute t2, "Repo should have been destroyed"
36
+ end
37
+
38
+ def test_illegal_destroy
39
+ Scriptorium.testing = false
40
+ assert_raises(TestModeOnly) { @blog.destroy_repo }
41
+ # @blog.destroy_repo
42
+ end
43
+
44
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scriptorium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
@@ -102,8 +102,11 @@ files:
102
102
  - "./scriptorium.gemspec"
103
103
  - bin/sblog
104
104
  - lib/scriptorium.rb
105
+ - lib/scriptorium/engine.rb
106
+ - lib/scriptorium/exceptions.rb
105
107
  - lib/scriptorium/version.rb
106
108
  - lib/skeleton.rb
109
+ - test/engine/unit.rb
107
110
  homepage: https://github.com/Hal9000/scriptorium
108
111
  licenses:
109
112
  - Ruby