classicCMS 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Guardfile CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
2
  # --drb
3
3
  guard 'rspec', :cli => "--fail-fast", :notification => false do
4
- watch(/.*/)
4
+ watch /(lib|spec).*/
5
5
  end
data/bin/classiccms CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'webcms'
4
- puts 'hello world'
3
+ require 'classicCMS/cli'
4
+ ClassicCMS::Cli.command(ARGV)
data/classicCMS.gemspec CHANGED
@@ -18,8 +18,12 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
21
+ s.add_development_dependency "rspec"
22
+ s.add_development_dependency "guard"
23
+ s.add_development_dependency "guard-rspec"
24
+
25
+ s.add_runtime_dependency "mongoid"
26
+ s.add_runtime_dependency "bson_ext"
27
+ s.add_runtime_dependency "sinatra"
24
28
  end
25
29
 
data/lib/classiccms.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "classicCMS/version"
2
1
  require "classicCMS/base"
3
2
 
4
3
  module ClassicCMS
@@ -0,0 +1,23 @@
1
+ module ClassicCMS
2
+ class Cli
3
+ def self.command(arguments)
4
+ case arguments[0]
5
+ when 'new'
6
+ if arguments[1] == nil
7
+ puts 'hmm you are using the command wrong: classicCMS new [app name]'
8
+ elsif File::directory? arguments[1]
9
+ puts 'hmm I think that app already exists!'
10
+ else
11
+ app_name = arguments[1]
12
+ FileUtils.cp_r File.dirname(__FILE__), Dir.pwd + "/#{app_name}"
13
+
14
+ puts "#{app_name} created!"
15
+ end
16
+ when 'server'
17
+ puts 'going to start server...'
18
+ else
19
+ puts "you are so smart! I don't know what you mean!"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,4 +1,3 @@
1
1
  module Classiccms #:nodoc
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
4
-
data/spec/cli_spec.rb ADDED
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+ require 'classicCMS/cli'
3
+ require 'stringio'
4
+
5
+ describe 'Base' do
6
+ before :all do
7
+ #set directory
8
+ $default[:dir] = Dir.pwd
9
+ $default[:log] = $stdout
10
+ $stdout = StringIO.new
11
+ end
12
+ before :each do
13
+ clear_tmp
14
+ @cli = ClassicCMS::Cli.command ['new']
15
+ end
16
+
17
+ it "should display an help message when the app name isn't displayed" do
18
+ capture_log do
19
+ ClassicCMS::Cli.command ['new']
20
+ $stdout.string.should == "hmm you are using the command wrong: classicCMS new [app name]\n"
21
+ end
22
+ end
23
+ it "should display error message when app name already exist" do
24
+ capture_log do
25
+ Dir.mkdir 'app'
26
+ ClassicCMS::Cli.command ['new', 'app']
27
+ $stdout.string.should == "hmm I think that app already exists!\n"
28
+ end
29
+ end
30
+ it "should display message when command is finished" do
31
+ capture_log do
32
+ app_name = 'app'
33
+ ClassicCMS::Cli.command ['new', app_name]
34
+ $stdout.string.should == "#{app_name} created!\n"
35
+ end
36
+ end
37
+ it "should copy scaffolding" do
38
+ capture_log do
39
+ app_name = 'app'
40
+ ClassicCMS::Cli.command ['new', app_name]
41
+
42
+ File.directory?(app_name).should == true
43
+ end
44
+ end
45
+
46
+ it "should display message that server is starting" do
47
+ capture_log do
48
+ ClassicCMS::Cli.command ['server']
49
+ $stdout.string.should == "going to start server...\n"
50
+ end
51
+ end
52
+ it "should display an error message when command isn't recognized" do
53
+ capture_log do
54
+ ClassicCMS::Cli.command ['nonexistant']
55
+ $stdout.string.should == "you are so smart! I don't know what you mean!\n"
56
+ end
57
+ end
58
+
59
+ after :all do
60
+ Dir::chdir $default[:dir]
61
+ $stdout = $default[:log]
62
+ end
63
+ end
data/spec/methods.rb ADDED
@@ -0,0 +1,15 @@
1
+ #helper method for output tests
2
+ def capture_log
3
+ origin = $stdout
4
+ $stdout = StringIO.new
5
+ yield
6
+ $stdout = origin
7
+ end
8
+
9
+ #helper method for clearing temp directory
10
+ def clear_tmp
11
+ Dir.chdir $default[:dir]
12
+ FileUtils.rm_rf 'tmp' if File.directory? 'tmp'
13
+ Dir.mkdir 'tmp'
14
+ Dir.chdir 'tmp'
15
+ end
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,7 @@ require 'bundler/setup'
5
5
  ENV['RACK_ENV'] = 'test'
6
6
 
7
7
  require 'classicCMS' # and any other gems you need
8
+ require 'methods'
8
9
 
9
10
  RSpec.configure do |config|
10
11
  Mongoid.load!("spec/config/mongoid.yml")
@@ -12,6 +13,7 @@ RSpec.configure do |config|
12
13
  config.before(:each) do
13
14
  Mongoid.master.collections.reject { |c| c.name =~ /^system./ }.each(&:drop)
14
15
  end
15
- end
16
-
17
16
 
17
+ #for storing default settings during testing
18
+ $default = {}
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classicCMS
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,103 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-04-01 00:00:00.000000000 Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: guard
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: guard-rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: mongoid
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: bson_ext
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: sinatra
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
14
110
  description: Webcms is a wrapper that automatigically will create a layer. It enables
15
111
  programmers to quickly build and release websites with CRUD CMS capabilities
16
112
  email:
@@ -30,9 +126,12 @@ files:
30
126
  - lib/classiccms/application.rb
31
127
  - lib/classiccms/application/cms.rb
32
128
  - lib/classiccms/base.rb
129
+ - lib/classiccms/cli.rb
33
130
  - lib/classiccms/version.rb
131
+ - spec/cli_spec.rb
34
132
  - spec/config/mongoid.yml
35
133
  - spec/factories.rb
134
+ - spec/methods.rb
36
135
  - spec/models/base_spec.rb
37
136
  - spec/spec_helper.rb
38
137
  - vendor/bundle/bin/autospec
@@ -3823,8 +3922,10 @@ signing_key:
3823
3922
  specification_version: 3
3824
3923
  summary: An easy to use wrapper for creating basic and more complicated websites
3825
3924
  test_files:
3925
+ - spec/cli_spec.rb
3826
3926
  - spec/config/mongoid.yml
3827
3927
  - spec/factories.rb
3928
+ - spec/methods.rb
3828
3929
  - spec/models/base_spec.rb
3829
3930
  - spec/spec_helper.rb
3830
3931
  has_rdoc: