capucine 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -7
- data/README.md +318 -23
- data/Rakefile +5 -9
- data/VERSION +1 -1
- data/bin/capucine +6 -2
- data/capucine-logo-mini.png +0 -0
- data/capucine.gemspec +32 -16
- data/content/{templates/capucine.yaml → default.yaml} +5 -5
- data/content/options.yaml +11 -0
- data/content/shared/capucine.yaml +2 -2
- data/content/shared/index.html +2 -2
- data/content/shared/public/js/app.js +1 -1
- data/content/shared/sass/_main.scss +1 -1
- data/content/shared/sass/screen.scss +4 -2
- data/content/templates/cmd_help.erb +8 -17
- data/lib/capucine.rb +68 -9
- data/lib/cdnjs.rb +71 -0
- data/lib/coffeescript.rb +36 -30
- data/lib/compass-sass.rb +51 -53
- data/lib/incloudr.rb +44 -43
- data/lib/npm.rb +21 -0
- data/lib/settings.rb +42 -55
- data/lib/tools.rb +167 -31
- data/lor +32 -0
- data/spec/capucine/capucine_spec.rb +179 -0
- data/spec/capucine/coffee_spec.rb +9 -0
- data/spec/capucine/incloudr_spec.rb +80 -0
- data/spec/capucine_coffee.yaml +30 -0
- data/spec/capucine_incloudr.yaml +6 -0
- data/spec/capucine_incloudr2.yaml +8 -0
- data/spec/capucine_incloudr3.yaml +6 -0
- data/spec/spec.rake +13 -0
- data/spec/spec_helper.rb +1 -0
- data/templates/README.md +10 -0
- data/templates/sinatra.yaml +30 -0
- metadata +54 -25
- data/Gemfile.lock +0 -49
- data/lib/commands.rb +0 -43
- data/lib/watch.rb +0 -39
data/lib/settings.rb
CHANGED
@@ -1,75 +1,62 @@
|
|
1
|
-
module Capucine
|
2
1
|
|
3
|
-
|
4
|
-
end
|
2
|
+
module Capucine
|
5
3
|
|
6
4
|
class Settings
|
7
|
-
|
8
|
-
|
5
|
+
require 'rubygems'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
attr_accessor :current_dir
|
9
|
+
attr_accessor :working_dir
|
10
|
+
attr_accessor :external_config
|
11
|
+
attr_accessor :project_name
|
12
|
+
attr_accessor :root_dir
|
13
|
+
attr_accessor :content_dir
|
14
|
+
attr_accessor :user_config_file
|
15
|
+
attr_accessor :conf
|
9
16
|
|
10
|
-
attr_accessor :current_dir, :project_name, :is_usable, :config, :gem_dir, :gem_content_dir, :working_dir, :external_config, :user_config_file
|
11
17
|
def initialize
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
self.reset_working_dir
|
18
|
+
|
19
|
+
self.working_dir = File.expand_path(Dir.getwd)
|
20
|
+
self.project_name = 'capucine'
|
21
|
+
self.root_dir = File.expand_path('../..', __FILE__)
|
22
|
+
self.content_dir = File.expand_path('../../content', __FILE__)
|
23
|
+
|
24
|
+
self.set_user_config_file
|
25
|
+
return self
|
21
26
|
end
|
22
27
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
if
|
29
|
-
|
30
|
-
@external_config = true
|
31
|
-
@working_dir = File.dirname from_user
|
32
|
-
else
|
33
|
-
from_user = File.join @working_dir, "#{@project_name}.yaml"
|
28
|
+
def set_user_config_file(file = nil, silent = false)
|
29
|
+
if not file
|
30
|
+
file = File.join self.working_dir, 'capucine.yaml'
|
31
|
+
end
|
32
|
+
|
33
|
+
if File.exist?(file)
|
34
|
+
self.user_config_file = File.expand_path(file)
|
34
35
|
end
|
35
36
|
|
36
|
-
|
37
|
+
self.get_conf
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
return self
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_conf
|
43
|
+
|
44
|
+
default = File.join self.content_dir, "default.yaml"
|
45
|
+
self.conf = YAML::load_file(default)
|
46
|
+
|
47
|
+
if self.user_config_file
|
48
|
+
additional = YAML::load_file(self.user_config_file)
|
49
|
+
end
|
40
50
|
|
41
51
|
if additional
|
42
52
|
additional.each do |k, v|
|
43
|
-
|
53
|
+
self.conf[k] = v
|
44
54
|
end
|
45
55
|
end
|
46
|
-
#self.test_config
|
47
|
-
end
|
48
56
|
|
49
|
-
|
50
|
-
# conf_dirs = []
|
51
|
-
# dirs = []
|
52
|
-
# for conf in conf_dirs
|
53
|
-
# conf = @config[conf]
|
54
|
-
# dirs.push File.join(@working_dir,conf)
|
55
|
-
# end
|
56
|
-
|
57
|
-
# for dir in dirs
|
58
|
-
# unless File.directory?(dir)
|
59
|
-
# puts "[error] #{dir} - Does not exist."
|
60
|
-
# exit
|
61
|
-
# end
|
62
|
-
# end
|
63
|
-
# end
|
64
|
-
|
65
|
-
def reset_working_dir
|
66
|
-
if @external_config
|
67
|
-
from_user = File.expand_path @user_config_file
|
68
|
-
@working_dir = File.dirname from_user
|
69
|
-
else
|
70
|
-
@working_dir = File.expand_path Dir.pwd
|
71
|
-
end
|
57
|
+
return self
|
72
58
|
end
|
59
|
+
|
73
60
|
end
|
74
61
|
end
|
75
62
|
|
data/lib/tools.rb
CHANGED
@@ -1,50 +1,188 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
+
require 'fileutils'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'erb'
|
6
|
+
require 'npm.rb'
|
7
|
+
require 'cdnjs.rb'
|
8
|
+
|
3
9
|
module Capucine
|
4
10
|
|
5
11
|
class Tools
|
6
|
-
require 'fileutils'
|
7
|
-
require 'erb'
|
8
|
-
require "compass-sass.rb"
|
9
|
-
require "coffeescript.rb"
|
10
|
-
require "incloudr.rb"
|
11
12
|
|
12
|
-
def
|
13
|
+
def initialize(capucine)
|
14
|
+
@cap = capucine
|
15
|
+
end
|
16
|
+
|
17
|
+
def new_project(scope = nil, name = nil)
|
18
|
+
name = name || @cap.settings.project_name # Custom name or 'capucine'
|
13
19
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
20
|
+
@cap.settings.working_dir = File.join @cap.settings.working_dir, name
|
21
|
+
self.archive_file(@cap.settings.working_dir)
|
22
|
+
|
23
|
+
config_file = get_config_file_from_scope(scope)
|
24
|
+
files = Dir.glob File.join(@cap.settings.content_dir, 'shared', '**')
|
25
|
+
|
26
|
+
FileUtils.mkdir @cap.settings.working_dir
|
27
|
+
FileUtils.cp_r files, @cap.settings.working_dir
|
28
|
+
FileUtils.cp config_file, File.join(@cap.settings.working_dir, 'capucine.yaml')
|
29
|
+
|
30
|
+
@cap.settings.set_user_config_file(File.join(@cap.settings.working_dir, 'capucine.yaml'))
|
31
|
+
|
32
|
+
return self
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def init(scope = nil, config_or_name = nil)
|
37
|
+
self.archive_file(@cap.settings.user_config_file) if @cap.settings.user_config_file
|
38
|
+
|
39
|
+
# Without Conf
|
40
|
+
if not scope and not config_or_name
|
41
|
+
file = File.join(@cap.settings.content_dir,'shared', 'capucine.yaml')
|
42
|
+
FileUtils.cp file, File.join(@cap.settings.working_dir, 'capucine.yaml')
|
43
|
+
return file
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# With Conf
|
48
|
+
if config_or_name
|
49
|
+
|
50
|
+
begin
|
51
|
+
d = open(config_or_name).read
|
52
|
+
rescue
|
53
|
+
puts "Error downloading : #{config_or_name}"
|
54
|
+
return self
|
55
|
+
end
|
56
|
+
|
57
|
+
file = File.new File.join(@cap.settings.working_dir, 'capucine.yaml'), 'w+'
|
58
|
+
file.write(d)
|
59
|
+
file.close
|
60
|
+
# file.unlink
|
61
|
+
|
62
|
+
return self
|
63
|
+
end
|
64
|
+
|
65
|
+
if scope
|
66
|
+
file = File.join(@cap.settings.root_dir,'templates', "#{scope}.yaml")
|
67
|
+
if not File.exists?(file)
|
68
|
+
puts "Sorry, this template does not exists : #{scope}"
|
69
|
+
return self
|
70
|
+
end
|
71
|
+
|
72
|
+
FileUtils.cp file, File.join(@cap.settings.working_dir, 'capucine.yaml')
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
return self
|
78
|
+
end
|
79
|
+
|
80
|
+
def compile(scope = nil)
|
81
|
+
|
82
|
+
scope = (scope) ? scope : 'all'
|
83
|
+
do_things = self.extract_commands_from_scope(scope)
|
84
|
+
|
85
|
+
do_sass = do_things[0]
|
86
|
+
do_coffee = do_things[1]
|
87
|
+
do_incloudr = do_things[2]
|
88
|
+
|
89
|
+
@cap.sass.run_once if do_sass
|
90
|
+
@cap.coffee.run_once if do_coffee
|
91
|
+
@cap.incloudr.run_once if do_incloudr
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
def watch(scope = nil)
|
96
|
+
self.compile(scope)
|
97
|
+
|
98
|
+
scope = (scope) ? scope : 'all'
|
99
|
+
|
100
|
+
do_things = self.extract_commands_from_scope(scope)
|
101
|
+
|
102
|
+
do_sass = do_things[0]
|
103
|
+
do_coffee = do_things[1]
|
104
|
+
do_incloudr = do_things[2]
|
105
|
+
|
106
|
+
thread_sass = @cap.sass.run_watch if do_sass
|
107
|
+
thread_coffee = @cap.coffee.run_watch if do_coffee
|
108
|
+
# thread_incloudr = @cap.incloudr.run_watch if do_incloudr
|
109
|
+
|
110
|
+
|
111
|
+
thread_sass.join if thread_sass
|
112
|
+
thread_coffee.join if thread_coffee
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
def js(scope, query = nil)
|
117
|
+
if scope[0] == 'search'
|
118
|
+
if scope[1] == 'npm'
|
119
|
+
else
|
120
|
+
libs = Capucine::CDNJS.search(query)
|
121
|
+
libs.each do |lib|
|
122
|
+
puts "#{lib['name']} --- #{lib['version']}"
|
123
|
+
end
|
124
|
+
end
|
18
125
|
end
|
19
126
|
|
20
|
-
|
127
|
+
if scope[0] == 'list'
|
128
|
+
if scope[1] == 'npm'
|
129
|
+
else
|
130
|
+
libs = Capucine::CDNJS.get_all
|
131
|
+
libs.each do |lib|
|
132
|
+
puts "#{lib['name']} --- #{lib['version']}"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
21
136
|
|
22
|
-
|
23
|
-
FileUtils.mkdir Capucine.settings.working_dir if not File.directory? Capucine.settings.working_dir
|
137
|
+
end
|
24
138
|
|
25
|
-
|
139
|
+
def update
|
140
|
+
system('gem uninstall -a -x capucine')
|
141
|
+
system('gem install capucine')
|
26
142
|
end
|
27
143
|
|
28
|
-
def
|
29
|
-
|
144
|
+
def clean
|
145
|
+
# TODO
|
146
|
+
end
|
147
|
+
|
148
|
+
#======================
|
149
|
+
def extract_commands_from_scope(scope)
|
150
|
+
all = ['sass', 'coffee', 'incloudr']
|
151
|
+
todo = [false,false,false]
|
152
|
+
|
153
|
+
scope = (scope != 'all') ? scope.split(',') : all # [] or ['sass', 'coffee']
|
154
|
+
|
155
|
+
all.each_with_index do |command, i|
|
156
|
+
if @cap.settings.conf[command] == true
|
157
|
+
if scope.include?(command)
|
158
|
+
todo[i] = true
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
return todo
|
163
|
+
|
164
|
+
end
|
30
165
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
166
|
+
|
167
|
+
def get_config_file_from_scope(scope = nil)
|
168
|
+
if not scope
|
169
|
+
file = File.join(@cap.settings.content_dir,'shared', 'capucine.yaml')
|
170
|
+
elsif scope.match(/^http:\/\//)
|
171
|
+
# files = from the web
|
172
|
+
else
|
173
|
+
# files = from github
|
35
174
|
end
|
36
175
|
|
37
|
-
|
38
|
-
Capucine.settings.reset_working_dir
|
176
|
+
return file
|
39
177
|
end
|
40
178
|
|
41
|
-
def
|
179
|
+
def render_template template_file, content = nil
|
42
180
|
config = content
|
43
|
-
|
44
|
-
output
|
181
|
+
output = ERB.new(File.new(template_file).read).result(binding)
|
182
|
+
return output
|
45
183
|
end
|
46
184
|
|
47
|
-
def
|
185
|
+
def archive_file path, force = true
|
48
186
|
return if not File.exist? path
|
49
187
|
|
50
188
|
is_empty = false
|
@@ -73,11 +211,9 @@ module Capucine
|
|
73
211
|
|
74
212
|
end
|
75
213
|
|
76
|
-
def self.clean
|
77
|
-
FileUtils.rm File.join(Capucine.settings.working_dir, '.compass.rb')
|
78
|
-
FileUtils.rm_r File.join(Capucine.settings.working_dir, '.incloudr')
|
79
|
-
end
|
80
|
-
|
81
214
|
end
|
215
|
+
|
216
|
+
|
217
|
+
|
82
218
|
end
|
83
219
|
|
data/lor
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
General
|
3
|
+
[32m #init the Capucine[0m
|
4
|
+
[32m #init the Capucine with settings[0m
|
5
|
+
[32m #init from command line[0m
|
6
|
+
[32m #init from command line with sinatra[0m
|
7
|
+
[32m #init from command line with wrong template[0m
|
8
|
+
[31m #init from command line with distant template (FAILED - 1)[0m
|
9
|
+
[32m #new from command line[0m
|
10
|
+
[32m #new from command line with custom name[0m
|
11
|
+
[32m #new, set coffee, compile[0m
|
12
|
+
[32m #new, set coffee, compile with c:sass ONLY[0m
|
13
|
+
[32m #new, set coffee, compile with c:coffee ONLY[0m
|
14
|
+
|
15
|
+
Failures:
|
16
|
+
|
17
|
+
1) General#init from command line with distant template
|
18
|
+
[31mFailure/Error:[0m [31m@cap.run_command(['i', 'http://capucine.dln.name/capucine.yaml'])[0m
|
19
|
+
[31mErrno::ENOENT:[0m
|
20
|
+
[31mNo such file or directory - /Users/damln/Work/capucine/capucine-gem2/spec/blank/capucine.yaml[0m
|
21
|
+
[36m # ./lib/tools.rb:57:in `initialize'[0m
|
22
|
+
[36m # ./lib/tools.rb:57:in `open'[0m
|
23
|
+
[36m # ./lib/tools.rb:57:in `init'[0m
|
24
|
+
[36m # ./lib/capucine.rb:34:in `run_command'[0m
|
25
|
+
[36m # ./spec/capucine/capucine_spec.rb:68:in `block (2 levels) in <top (required)>'[0m
|
26
|
+
|
27
|
+
Finished in 20.63 seconds
|
28
|
+
[31m11 examples, 1 failure[0m
|
29
|
+
|
30
|
+
Failed examples:
|
31
|
+
|
32
|
+
[31mrspec ./spec/capucine/capucine_spec.rb:67[0m [36m# General#init from command line with distant template[0m
|
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'General' do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
Dir.chdir("spec/blank")
|
7
|
+
|
8
|
+
@cap = Capucine::Main.new
|
9
|
+
@config_user = File.join @cap.settings.content_dir, 'shared', 'capucine.yaml'
|
10
|
+
@config_user_coffee = File.expand_path File.join '..', 'capucine_coffee.yaml'
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
after :each do
|
15
|
+
Dir.chdir("../..")
|
16
|
+
end
|
17
|
+
|
18
|
+
it '#init the Capucine' do
|
19
|
+
@cap.should_not eq(nil)
|
20
|
+
|
21
|
+
@cap.settings.should_not eq(nil)
|
22
|
+
@cap.settings.working_dir.should eq(Dir.pwd)
|
23
|
+
@cap.settings.conf.should_not eq(nil)
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
it '#init the Capucine with settings' do
|
28
|
+
@cap.settings.set_user_config_file(@config_user)
|
29
|
+
|
30
|
+
@cap.settings.should_not eq(nil)
|
31
|
+
@cap.settings.working_dir.should eq(Dir.pwd)
|
32
|
+
@cap.settings.user_config_file.should_not eq(nil)
|
33
|
+
@cap.settings.conf.should_not eq(nil)
|
34
|
+
|
35
|
+
@cap.settings.conf['sass'].should eq(true)
|
36
|
+
@cap.settings.conf['coffee'].should eq(false)
|
37
|
+
@cap.settings.conf['incloudr'].should eq(false)
|
38
|
+
end
|
39
|
+
|
40
|
+
it '#init from command line' do
|
41
|
+
@cap.run_command(['i'])
|
42
|
+
|
43
|
+
File.exist?('capucine.yaml').should be_true
|
44
|
+
size = File.size('capucine.yaml')
|
45
|
+
size.should_not == 0
|
46
|
+
|
47
|
+
FileUtils.rm_r 'capucine.yaml'
|
48
|
+
end
|
49
|
+
|
50
|
+
it '#update from command line' do
|
51
|
+
# @cap.run_command(['u'])
|
52
|
+
end
|
53
|
+
|
54
|
+
it '#init from command line with sinatra' do
|
55
|
+
@cap.run_command(['i:sinatra'])
|
56
|
+
|
57
|
+
File.exist?('capucine.yaml').should be_true
|
58
|
+
|
59
|
+
size = File.size('capucine.yaml')
|
60
|
+
size.should_not == 0
|
61
|
+
|
62
|
+
FileUtils.rm_r 'capucine.yaml'
|
63
|
+
end
|
64
|
+
|
65
|
+
it '#init from command line with wrong template' do
|
66
|
+
@cap.run_command(['i:sinatraaaaa'])
|
67
|
+
|
68
|
+
File.exist?('capucine.yaml').should == false
|
69
|
+
end
|
70
|
+
|
71
|
+
it '#init from command line with distant template' do
|
72
|
+
@cap.run_command(['i', 'http://capucine.dln.name/capucine.yaml'])
|
73
|
+
|
74
|
+
File.exist?('capucine.yaml').should == true
|
75
|
+
|
76
|
+
size = File.size('capucine.yaml')
|
77
|
+
size.should_not == 0
|
78
|
+
|
79
|
+
FileUtils.rm_r 'capucine.yaml'
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
it '#new from command line' do
|
84
|
+
@cap.run_command(['n'])
|
85
|
+
|
86
|
+
cap = File.join @cap.settings.working_dir, 'capucine.yaml'
|
87
|
+
sass = File.join @cap.settings.working_dir, 'public/css_generated/screen.css'
|
88
|
+
|
89
|
+
@cap.settings.working_dir.should eq(File.join Dir.pwd, 'capucine')
|
90
|
+
|
91
|
+
File.exist?(cap).should eq(true)
|
92
|
+
File.exist?(sass).should eq(true)
|
93
|
+
|
94
|
+
FileUtils.rm_r @cap.settings.working_dir
|
95
|
+
end
|
96
|
+
|
97
|
+
it '#new from command line with custom name' do
|
98
|
+
@cap.run_command(['n', 'oh_my_god'])
|
99
|
+
|
100
|
+
cap = File.join @cap.settings.working_dir, 'capucine.yaml'
|
101
|
+
sass = File.join @cap.settings.working_dir, 'public/css_generated/screen.css'
|
102
|
+
|
103
|
+
@cap.settings.working_dir.should eq(File.join Dir.pwd, 'oh_my_god')
|
104
|
+
|
105
|
+
File.exist?(cap).should eq(true)
|
106
|
+
File.exist?(sass).should eq(true)
|
107
|
+
|
108
|
+
FileUtils.rm_r @cap.settings.working_dir
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
it '#new, set coffee, compile' do
|
113
|
+
@cap.run_command(['n'])
|
114
|
+
|
115
|
+
Dir.chdir('capucine')
|
116
|
+
|
117
|
+
@cap.settings.conf['coffee'].should eq(false)
|
118
|
+
|
119
|
+
@cap.run_command(['c', @config_user_coffee])
|
120
|
+
|
121
|
+
@cap.settings.user_config_file.should_not eq(nil)
|
122
|
+
@cap.settings.conf['coffee'].should eq(true)
|
123
|
+
|
124
|
+
coffee = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/app.js')
|
125
|
+
coffee2 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/app.min.js')
|
126
|
+
|
127
|
+
File.exist?(coffee).should eq(true)
|
128
|
+
File.exist?(coffee2).should eq(true)
|
129
|
+
|
130
|
+
FileUtils.rm_r @cap.settings.working_dir
|
131
|
+
Dir.chdir('..')
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
it '#new, set coffee, compile with c:sass ONLY' do
|
136
|
+
@cap.run_command(['n'])
|
137
|
+
|
138
|
+
Dir.chdir('capucine')
|
139
|
+
|
140
|
+
@cap.settings.conf['coffee'].should eq(false)
|
141
|
+
|
142
|
+
@cap.run_command(['c:sass', @config_user_coffee])
|
143
|
+
@cap.settings.conf['coffee'].should eq(true)
|
144
|
+
|
145
|
+
coffee = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/app.js')
|
146
|
+
|
147
|
+
File.exist?(coffee).should eq(false)
|
148
|
+
|
149
|
+
FileUtils.rm_r @cap.settings.working_dir
|
150
|
+
|
151
|
+
Dir.chdir('..')
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
it '#new, set coffee, compile with c:coffee ONLY' do
|
156
|
+
@cap.run_command(['n'])
|
157
|
+
|
158
|
+
Dir.chdir('capucine')
|
159
|
+
|
160
|
+
@cap.settings.conf['coffee'].should eq(false)
|
161
|
+
|
162
|
+
FileUtils.rm File.expand_path(File.join @cap.settings.working_dir, 'public/css_generated/screen.css')
|
163
|
+
@cap.run_command(['c:coffee', @config_user_coffee])
|
164
|
+
|
165
|
+
@cap.settings.conf['sass'].should eq(true)
|
166
|
+
@cap.settings.conf['coffee'].should eq(true)
|
167
|
+
|
168
|
+
scss = File.expand_path(File.join @cap.settings.working_dir, 'public/css_generated/screen.css')
|
169
|
+
|
170
|
+
File.exist?(scss).should eq(false)
|
171
|
+
|
172
|
+
FileUtils.rm_r @cap.settings.working_dir
|
173
|
+
Dir.chdir('..')
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Incloudr' do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
Dir.chdir("spec/blank")
|
7
|
+
|
8
|
+
@cap = Capucine::Main.new
|
9
|
+
@config_user_incloudr = File.expand_path File.join '..', 'capucine_incloudr.yaml'
|
10
|
+
@config_user_incloudr2 = File.expand_path File.join '..', 'capucine_incloudr2.yaml'
|
11
|
+
@config_user_incloudr3 = File.expand_path File.join '..', 'capucine_incloudr3.yaml'
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
after :each do
|
16
|
+
Dir.chdir("../..")
|
17
|
+
end
|
18
|
+
|
19
|
+
it '#new, set incloudr, and download jquery from CDNJS' do
|
20
|
+
@cap.run_command(['n'])
|
21
|
+
|
22
|
+
Dir.chdir('capucine')
|
23
|
+
|
24
|
+
@cap.run_command(['c', @config_user_incloudr])
|
25
|
+
|
26
|
+
jquery1 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.js')
|
27
|
+
jquery2 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.min.js')
|
28
|
+
|
29
|
+
File.exist?(jquery1).should eq(true)
|
30
|
+
File.exist?(jquery2).should eq(true)
|
31
|
+
|
32
|
+
FileUtils.rm_r @cap.settings.working_dir
|
33
|
+
Dir.chdir('..')
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
it '#new, set incloudr, and download jquery version 1.7 from CDNJS' do
|
38
|
+
@cap.run_command(['n'])
|
39
|
+
|
40
|
+
Dir.chdir('capucine')
|
41
|
+
|
42
|
+
@cap.run_command(['c', @config_user_incloudr2])
|
43
|
+
|
44
|
+
jquery1 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.js')
|
45
|
+
jquery2 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.min.js')
|
46
|
+
|
47
|
+
File.exist?(jquery1).should eq(true)
|
48
|
+
File.exist?(jquery2).should eq(true)
|
49
|
+
|
50
|
+
FileUtils.rm_r @cap.settings.working_dir
|
51
|
+
Dir.chdir('..')
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
it '#new, set incloudr, and download jque from CDNJS (error)' do
|
56
|
+
@cap.run_command(['n'])
|
57
|
+
|
58
|
+
Dir.chdir('capucine')
|
59
|
+
|
60
|
+
@cap.run_command(['c', @config_user_incloudr3])
|
61
|
+
|
62
|
+
jquery1 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.js')
|
63
|
+
jquery2 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.min.js')
|
64
|
+
|
65
|
+
File.exist?(jquery1).should eq(false)
|
66
|
+
File.exist?(jquery2).should eq(false)
|
67
|
+
|
68
|
+
FileUtils.rm_r @cap.settings.working_dir
|
69
|
+
Dir.chdir('..')
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
it '#list' do
|
74
|
+
@cap.run_command(['js:list'])
|
75
|
+
end
|
76
|
+
|
77
|
+
it '#search' do
|
78
|
+
@cap.run_command(['js:search', 'jquery'])
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
sass: true
|
2
|
+
coffee: true
|
3
|
+
# incloudr: true
|
4
|
+
|
5
|
+
# # ----------------------------------------
|
6
|
+
# sass_images_dir: public/images
|
7
|
+
# sass_files_dir: sass
|
8
|
+
# sass_output_dir: public/css_generated
|
9
|
+
# sass_line_comments: false
|
10
|
+
# sass_css_generated_style: expanded # compact | expanded | compressed
|
11
|
+
# sass_options: '{:cache => false}'
|
12
|
+
|
13
|
+
# compass_config: {}
|
14
|
+
# compass_plugins:
|
15
|
+
# - compass-capucine
|
16
|
+
|
17
|
+
# sass_import_css: false
|
18
|
+
# sass_import_formats: css to sass
|
19
|
+
# sass_import_css_dir: public/css/import
|
20
|
+
# sass_import_output_dir: sass/converted
|
21
|
+
|
22
|
+
# coffeescript_bare: false
|
23
|
+
# coffeescript_files_dir: coffeescript
|
24
|
+
# coffeescript_output_dir: public/js_generated
|
25
|
+
|
26
|
+
# incloudr_output_dir: public/js_generated/modules
|
27
|
+
# incloudr_libs:
|
28
|
+
# - jquery
|
29
|
+
|
30
|
+
# DOCUMENTATION : http:// capucine.dln.name
|