itcss_cli 0.1.15 → 0.1.16
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/README.md +47 -22
- data/lib/itcss_cli/version.rb +1 -1
- data/lib/itcss_cli.rb +52 -4
- data/templates/itcss_config.erb +1 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97b2bc4bc19aa06262b874e124e567c302823eb8
|
4
|
+
data.tar.gz: 3dd9076c90ef38c6ca9ea674d78277aaab3292fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9250f41591cec6bb18746a630a4be42072b5c6e55df5f006031d991e8267ab61ebdaeaff7d803fe0099ba97e9d18712f391b5a21651c43f57e62a04b3551a533
|
7
|
+
data.tar.gz: b5b33142e2f44e3dff44d2399249bd93a1f5a8f3345c48146176dae8e813de9513fa5d843a41ffefc5c407104b285f5c24aedc3b65a5856013b9d777991f6da8
|
data/README.md
CHANGED
@@ -8,49 +8,78 @@ gem 'itcss_cli'
|
|
8
8
|
|
9
9
|
And then execute:
|
10
10
|
|
11
|
-
|
11
|
+
```{r, engine='bash'}
|
12
|
+
$ bundle
|
13
|
+
```
|
12
14
|
|
13
15
|
Or install it yourself as:
|
14
16
|
|
15
|
-
|
17
|
+
```{r, engine='bash'}
|
18
|
+
$ gem install itcss_cli
|
19
|
+
```
|
16
20
|
|
17
21
|
## Usage
|
18
22
|
|
19
23
|
First, you'll need to set up ITCSS by running:
|
20
24
|
|
21
|
-
|
25
|
+
```{r, engine='bash'}
|
26
|
+
$ itcss init
|
27
|
+
```
|
22
28
|
|
23
|
-
Now go to `itcss.yml` and
|
29
|
+
Now go to `itcss.yml` and do your itcss_cli config:
|
24
30
|
|
25
31
|
```yml
|
26
|
-
#
|
27
|
-
stylesheets_directory:
|
32
|
+
# Root folder where the ITCSS file structure should be builded.
|
33
|
+
stylesheets_directory: source/stylesheets
|
34
|
+
|
35
|
+
# Base sass file (all ITCSS modules will be imported in it).
|
36
|
+
stylesheets_import_file: application
|
37
|
+
|
38
|
+
# Uncomment to enable inuit modules importing. [ bower or npm ]
|
39
|
+
# package_manager: bower
|
28
40
|
|
29
|
-
#
|
30
|
-
|
41
|
+
# inuit_modules:
|
42
|
+
# - tools.functions
|
43
|
+
# - settings.defaults
|
44
|
+
# - base.page
|
31
45
|
```
|
32
46
|
|
33
47
|
Go ahead and grow your ITCSS structure:
|
34
48
|
```{r, engine='bash'}
|
35
49
|
$ itcss new component modals
|
36
50
|
create source/stylesheets/components/_components.modals.sass
|
37
|
-
update source/stylesheets/application.
|
51
|
+
update source/stylesheets/application.sass
|
38
52
|
|
39
53
|
$ itcss new trumps helpers
|
40
54
|
create source/stylesheets/trumps/_trumps.helpers.sass
|
41
|
-
update source/stylesheets/application.
|
55
|
+
update source/stylesheets/application.sass
|
42
56
|
```
|
43
57
|
|
44
|
-
##
|
45
|
-
|
58
|
+
## Inuitcss Commands
|
59
|
+
|
60
|
+
You can install and automatically import inuit modules via cli:
|
46
61
|
|
47
62
|
```{r, engine='bash'}
|
48
|
-
$ itcss
|
49
|
-
|
50
|
-
|
63
|
+
$ itcss inuit new settings.defaults
|
64
|
+
using bower to install inuit 'settings.defaults' dependency...
|
65
|
+
bower inuit-defaults#~0.2.3 install inuit-defaults#0.2.3
|
66
|
+
|
67
|
+
inuit-defaults#0.2.3 bower_components/inuit-defaults
|
68
|
+
update itcss.yml. [added settings.defaults]
|
69
|
+
update source/stylesheets/application.sass
|
70
|
+
```
|
71
|
+
|
72
|
+
Result at `application.sass`:
|
73
|
+
```sass
|
74
|
+
...
|
75
|
+
// [1] Settings
|
76
|
+
@import "inuit-defaults/settings.defaults"
|
77
|
+
...
|
78
|
+
```
|
51
79
|
|
52
|
-
|
80
|
+
## Creating a full ITCSS structure
|
53
81
|
|
82
|
+
```{r, engine='bash'}
|
54
83
|
$ itcss install example
|
55
84
|
create source/stylesheets/settings/_settings.example.sass
|
56
85
|
create source/stylesheets/tools/_tools.example.sass
|
@@ -113,13 +142,9 @@ If you open the ITCSS's base file now, you'll see that all ITCSS modules are aut
|
|
113
142
|
// ↑ ITCSS_CLI FILE IMPORTING ↑
|
114
143
|
```
|
115
144
|
|
116
|
-
|
117
|
-
|
118
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
119
|
-
|
120
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
145
|
+
---
|
121
146
|
|
122
|
-
|
147
|
+
# Contributing
|
123
148
|
|
124
149
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/itcss_cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
125
150
|
|
data/lib/itcss_cli/version.rb
CHANGED
data/lib/itcss_cli.rb
CHANGED
@@ -32,6 +32,7 @@ module ItcssCli
|
|
32
32
|
"itcss install [filenames] | | Creates an example of ITCSS structure in path specified in itcss.yml.",
|
33
33
|
"itcss new [module] [filename] | n | Creates a new ITCSS module and automatically import it into imports file.",
|
34
34
|
"itcss inuit new [inuit module] |inuit n| Add specified inuit module as an itcss dependency.",
|
35
|
+
"itcss inuit help |inuit h| Add specified inuit module as an itcss dependency.",
|
35
36
|
"itcss update | u | Updates the imports file using the files inside ITCSS structure.",
|
36
37
|
"itcss help | h, -h | Shows all available itcss commands and it's functions.",
|
37
38
|
"itcss version | v, -v | Shows itcss_cli gem version installed."
|
@@ -111,17 +112,55 @@ module ItcssCli
|
|
111
112
|
end
|
112
113
|
|
113
114
|
def itcss_init
|
115
|
+
if File.exist?(@ITCSS_CONFIG_FILE)
|
116
|
+
puts "There is already a itcss.yml created.".yellow
|
117
|
+
puts "Do you want to override it? [ y / n ]"
|
118
|
+
user_override_itcss_yml = STDIN.gets.chomp
|
119
|
+
unless user_override_itcss_yml == 'y'
|
120
|
+
abort
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
init_config = {}
|
125
|
+
|
126
|
+
puts "Well done! Let's configure your itcss.yml:".yellow
|
127
|
+
|
128
|
+
puts "Provide the root folder name where the ITCSS file structure should be built:"
|
129
|
+
user_itcss_dir = STDIN.gets.chomp
|
130
|
+
init_config['stylesheets_directory'] = user_itcss_dir
|
131
|
+
|
132
|
+
puts "What is the name of your base sass file (all ITCSS modules will be imported into it):"
|
133
|
+
user_itcss_base_file = STDIN.gets.chomp
|
134
|
+
init_config['stylesheets_import_file'] = user_itcss_base_file
|
135
|
+
|
136
|
+
puts "Are you using a package manager? [ y / n ]"
|
137
|
+
user_itcss_package_manager = STDIN.gets.chomp
|
138
|
+
if user_itcss_package_manager == 'y'
|
139
|
+
user_package_manager = true
|
140
|
+
end
|
141
|
+
|
142
|
+
if user_package_manager == true
|
143
|
+
puts "Choose your package manager [ bower / npm ]:"
|
144
|
+
user_package_manager = STDIN.gets.chomp
|
145
|
+
|
146
|
+
unless ['bower', 'npm'].include? user_package_manager
|
147
|
+
puts "#{user_package_manager} is not a valid package manager".red
|
148
|
+
abort
|
149
|
+
end
|
150
|
+
|
151
|
+
init_config['package_manager'] = user_package_manager
|
152
|
+
end
|
153
|
+
|
114
154
|
unless File.exist?(@ITCSS_CONFIG_FILE)
|
115
155
|
File.open @ITCSS_CONFIG_TEMPLATE do |io|
|
116
156
|
template = ERB.new io.read
|
117
|
-
content =
|
157
|
+
content = init_config.to_yaml
|
118
158
|
|
119
159
|
File.open @ITCSS_CONFIG_FILE, "w+" do |out|
|
120
160
|
out.puts template.result binding
|
121
161
|
end
|
122
162
|
end
|
123
|
-
puts "
|
124
|
-
puts "Well done! Please do your own configurations in itcss.yml.".yellow
|
163
|
+
puts "#{@ITCSS_CONFIG_FILE} successfully created!".green
|
125
164
|
else
|
126
165
|
puts "#{@ITCSS_CONFIG_FILE} already exists.".red
|
127
166
|
abort
|
@@ -168,7 +207,11 @@ module ItcssCli
|
|
168
207
|
|
169
208
|
itcss_files_to_import = {}
|
170
209
|
@ITCSS_MODULES.each do |current_module|
|
171
|
-
itcss_files_to_import[current_module] =
|
210
|
+
itcss_files_to_import[current_module] = []
|
211
|
+
|
212
|
+
if @INUIT_MODULES
|
213
|
+
itcss_files_to_import[current_module] += inuit_find_modules(current_module)
|
214
|
+
end
|
172
215
|
|
173
216
|
itcss_module_files = Dir[ File.join("#{@ITCSS_DIR}/#{current_module}/", '**', '*') ].reject { |p| File.directory? p }
|
174
217
|
itcss_files_to_import[current_module] += itcss_module_files.map{|s| s.gsub("#{@ITCSS_DIR}/", '')}
|
@@ -266,6 +309,11 @@ module ItcssCli
|
|
266
309
|
current_module_name = inuit_module_fullname(c_module, file)
|
267
310
|
config_file = @ITCSS_CONFIG_FILE
|
268
311
|
current_config = YAML.load_file(config_file)
|
312
|
+
|
313
|
+
if current_config['inuit_modules'].nil?
|
314
|
+
current_config['inuit_modules'] = []
|
315
|
+
end
|
316
|
+
|
269
317
|
current_config['inuit_modules'] << current_module_name
|
270
318
|
|
271
319
|
unless current_config['inuit_modules'].uniq.length == current_config['inuit_modules'].length
|
data/templates/itcss_config.erb
CHANGED
@@ -1,18 +1,4 @@
|
|
1
1
|
<%= "# " + "=" * 40 %>
|
2
2
|
<%= "# #itcss.yml" %>
|
3
3
|
<%= "# " + "=" * 40 %>
|
4
|
-
|
5
|
-
<% unless content.nil? %><%= content %>
|
6
|
-
<% else %># Root folder where the ITCSS file structure should be builded.
|
7
|
-
stylesheets_directory: path/to/itcss/root
|
8
|
-
|
9
|
-
# Base sass file (all ITCSS modules will be imported in it).
|
10
|
-
stylesheets_import_file: yourapplication
|
11
|
-
|
12
|
-
# Uncomment to enable inuit modules importing. [ bower or npm ]
|
13
|
-
# package_manager: bower
|
14
|
-
|
15
|
-
# inuit_modules:
|
16
|
-
# - tools.functions
|
17
|
-
# - settings.defaults
|
18
|
-
# - base.page<% end %>
|
4
|
+
<% unless content.nil? %><%= content %><% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kande Bonfim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|