itcss_cli 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/bin/itcss +1 -1
- data/itcss_cli-0.1.2.gem +0 -0
- data/lib/itcss_cli/version.rb +1 -1
- data/lib/itcss_cli.rb +58 -15
- data/templates/itcss_application.erb +6 -0
- metadata +4 -2
- /data/templates/{itcss_file.erb → itcss_module.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 095287d9c35897f38d76153eb69f5be2078a8c17
|
4
|
+
data.tar.gz: e709597aa6a1b50dc0d9b63ebb66196de4f0c311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1185993120076b6b6fcf28425067db95801e376ee4149a4312d0dff41a3a95ef803c89393641d386917c3c019be7ce358139ad9df3043753307feafe34139cca
|
7
|
+
data.tar.gz: be70322b4387c8640ed3af9b77eab2f052534f7d20245d1d024708b4eb172b83c54cac4eeb5280dd29f9e160a42fd6204b600f75048e0208eaeae42f0962d1fc
|
data/bin/itcss
CHANGED
data/itcss_cli-0.1.2.gem
ADDED
Binary file
|
data/lib/itcss_cli/version.rb
CHANGED
data/lib/itcss_cli.rb
CHANGED
@@ -6,29 +6,72 @@ module ItcssCli
|
|
6
6
|
class Init
|
7
7
|
|
8
8
|
ITCSS_DIR = "stylesheets"
|
9
|
-
|
9
|
+
ITCSS_BASE_FILE = "application"
|
10
|
+
ITCSS_MODULE_TEMPLATE = File.expand_path(File.join(File.dirname(__FILE__), "../templates/itcss_module.erb"))
|
11
|
+
ITCSS_APP_TEMPLATE = File.expand_path(File.join(File.dirname(__FILE__), "../templates/itcss_application.erb"))
|
12
|
+
ITCSS_FILES = ["settings", "tools", "generic", "base", "objects", "components", "trumps"]
|
10
13
|
|
11
|
-
def
|
12
|
-
|
14
|
+
def command_parser
|
15
|
+
# $ itcss init
|
16
|
+
if ARGV[0] == 'init'
|
13
17
|
|
14
|
-
File.open ITCSS_FILE_TEMPLATE do |io|
|
15
|
-
template = ERB.new io.read
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
19
|
+
# $ itcss install example
|
20
|
+
elsif ARGV[0] == 'install' && ARGV[1] == 'example'
|
21
|
+
new_itcss_basic_structure
|
21
22
|
|
22
|
-
FileUtils.mkdir_p ITCSS_DIR
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
# $ itcss new components buttons
|
25
|
+
elsif ARGV[0] == 'new' && ARGV[1] && ARGV[2]
|
26
|
+
occur = ITCSS_FILES.each_index.select{|i| ITCSS_FILES[i].include? ARGV[1]}
|
27
|
+
if occur.size == 1
|
28
|
+
new_itcss_module(ITCSS_FILES[occur[0]], ARGV[2])
|
29
29
|
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Enable ITCSS_BASE_FILE to import all itcss dependencies
|
33
|
+
generate_base_file
|
34
|
+
end
|
35
|
+
|
36
|
+
def new_itcss_basic_structure
|
37
|
+
File.open ITCSS_MODULE_TEMPLATE do |io|
|
38
|
+
template = ERB.new io.read
|
39
|
+
|
40
|
+
ITCSS_FILES.each do |file|
|
41
|
+
new_itcss_file(file, 'example', template)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
30
45
|
|
46
|
+
def new_itcss_module(type, file)
|
47
|
+
File.open ITCSS_MODULE_TEMPLATE do |io|
|
48
|
+
template = ERB.new io.read
|
49
|
+
new_itcss_file(type, file, template)
|
31
50
|
end
|
32
51
|
end
|
52
|
+
|
53
|
+
def new_itcss_file(type, file, template)
|
54
|
+
FileUtils.mkdir_p ITCSS_DIR
|
55
|
+
FileUtils.mkdir_p "#{ITCSS_DIR}/#{type}"
|
56
|
+
|
57
|
+
contents = "##{type}.#{file}"
|
58
|
+
File.open "#{ITCSS_DIR}/#{type}/_#{type}.#{file}.sass", "w+" do |out|
|
59
|
+
out.puts template.result binding
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def generate_base_file
|
64
|
+
itcss_files = Dir[ File.join(ITCSS_DIR, '**', '*') ].reject { |p| File.directory? p }
|
65
|
+
|
66
|
+
File.open ITCSS_APP_TEMPLATE do |io|
|
67
|
+
template = ERB.new io.read
|
68
|
+
|
69
|
+
contents = "application.sass"
|
70
|
+
File.open "#{ITCSS_DIR}/application.sass", "w+" do |out|
|
71
|
+
out.puts template.result binding
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
33
76
|
end
|
34
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itcss_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kande Bonfim
|
@@ -57,10 +57,12 @@ files:
|
|
57
57
|
- bin/setup
|
58
58
|
- itcss_cli-0.1.0.gem
|
59
59
|
- itcss_cli-0.1.1.gem
|
60
|
+
- itcss_cli-0.1.2.gem
|
60
61
|
- itcss_cli.gemspec
|
61
62
|
- lib/itcss_cli.rb
|
62
63
|
- lib/itcss_cli/version.rb
|
63
|
-
- templates/
|
64
|
+
- templates/itcss_application.erb
|
65
|
+
- templates/itcss_module.erb
|
64
66
|
homepage: https://github.com/kandebonfim/itcss_cli
|
65
67
|
licenses:
|
66
68
|
- MIT
|
File without changes
|