smallvictories 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 7ec4b9886a3ede16fc3d173852d14e53fd762a38
4
- data.tar.gz: 925234d3af8439d6f45381a4701f7c0331192ea9
3
+ metadata.gz: b519e1b389b4f5ad88c228896a66e099bf080c03
4
+ data.tar.gz: 68f66717c9bf8100b1773d7061e8c54842c1a5ad
5
5
  SHA512:
6
- metadata.gz: 43e26f3eec4ca433f45e629dddb541e1a39cbfeadb87187d1c3628b886d92260018c6f0b15d8077d9bad0886b832b1d6a94476b46163cd02c62120ed7b83b23b
7
- data.tar.gz: a91f54da2046b2cff5dff279ad4c644354e801a2ff4cf0e900c060186fd9feadab22adb3ebfb4519cdba4b0d90caf459b4a02a546858d6252806b01c62de9ba2
6
+ metadata.gz: 082fbefe8a57fad2cc0111d0f36658032a1ff262249fdc19d36a881041ab8992e0617190140c32bceab1bca007923239523c1531c2450fc4490dd415a9eced6a
7
+ data.tar.gz: fbf653203cba09588114ce8c81c2597a842beac72d24c93106b3e44b4922a85458e8856b22ebde00af7191dc52a9426ab6c9d19f3ba9b7f0e288c84d4ef23e97
data/README.md CHANGED
@@ -5,7 +5,7 @@ A command line utility for building websites.
5
5
  ## What does it do?
6
6
 
7
7
  The Small Victories gem compiles Sass/CSS and JS/CoffeeScript files into a single Stylesheet and
8
- Javascript file and renders HTML and Liquid files into a destination folder.
8
+ JavaScript file and renders HTML and Liquid files into a destination folder.
9
9
 
10
10
  [Sprockets](https://github.com/rails/sprockets) looks for main Sass/CSS and JS/CoffeeScript files and compiles
11
11
  multiple Sass/CSS and JS/CoffeeScript files into a single CSS and JS file.
@@ -23,13 +23,17 @@ be copied over to the destination folder.
23
23
  ### Basic Folder Structure
24
24
 
25
25
  ```text
26
- project
27
- ├── _includes
28
- ├── _layout.liquid
29
- ├── _sv_custom.css
30
- ├── _sv_custom.js
31
-
32
- └── index.html
26
+ dev
27
+ ├── _includes
28
+ └── _head.liquid
29
+ ├── _layout.liquid
30
+ ├── _sv_custom.css
31
+ ├── _sv_custom.js
32
+ └── index.liquid
33
+ prod
34
+ ├── _sv_custom.css
35
+ ├── _sv_custom.js
36
+ └── index.html
33
37
  ```
34
38
 
35
39
  ## How does it work with Small Victories?
@@ -43,6 +47,42 @@ Victories site folder e.g. `~/Dropbox/Small Victories/liberal coyote`.
43
47
  Now when you watch or build your site it will output the files into your Dropbox
44
48
  folder, which in turn will trigger Small Victories to rebuild your site.
45
49
 
50
+ ### Example Config
51
+
52
+ ```yaml
53
+ source: ''
54
+ destination: '~/Dropbox/Small Victories/my-site'
55
+ stylesheet: '_sv_custom.css'
56
+ javascript: '_sv_custom.js'
57
+ layout: '_layout.liquid'
58
+ includes: '_includes'
59
+ ```
60
+
61
+ ### Example Folder Structure
62
+
63
+ ```text
64
+ Code
65
+ my-site
66
+ ├── _includes
67
+ │ └── _head.liquid
68
+ ├── _config.yml
69
+ ├── _layout.liquid
70
+ ├── _sv_custom.css
71
+ ├── _sv_custom.js
72
+ └── index.liquid
73
+
74
+ Dropbox
75
+ └── Small Victories
76
+ └──my-site
77
+ ├── _sv_custom.css
78
+ ├── _sv_custom.js
79
+ └── index.html
80
+ ```
81
+
82
+ ## Why is there now web server?
83
+
84
+ There are other static site generators (like [Jekyll](http://jekyllrb.com/) or [Middleman](https://middlemanapp.com/)) that you can use to fire up a web server (and more!), Small Victories helps you build a static site for hosting on Small Victories, so if you don't need anything more than a static HTML file that can be dropped into your Small Victories folder.
85
+
46
86
  ## Installation
47
87
 
48
88
  ```
@@ -63,9 +103,9 @@ run from.
63
103
 
64
104
  ### Default Configuration
65
105
 
66
- ```
67
- source: ''
68
- destination: '_site'
106
+ ```yaml
107
+ source: 'dev'
108
+ destination: 'prod'
69
109
  stylesheet: '_sv_custom.css'
70
110
  javascript: '_sv_custom.js'
71
111
  layout: '_layout.liquid'
data/bin/sv CHANGED
@@ -9,6 +9,7 @@ def help
9
9
  Commands:
10
10
  bootstrap, bootstrap FOLDER Setup folder with default files
11
11
  compile Compile files
12
+ open Open index.html in destination folder
12
13
  watch Watch for changes and compile files
13
14
  help Prints this help document
14
15
  version Prints the small victories gem version
@@ -35,6 +36,11 @@ def compile
35
36
  compiler.compile_html
36
37
  end
37
38
 
39
+ def open
40
+ config = SmallVictories::Configuration.new
41
+ system("open #{config.full_destination_path}index.html")
42
+ end
43
+
38
44
  def watch
39
45
  config = SmallVictories::Configuration.new
40
46
  compiler = SmallVictories::Compiler.new(config: config)
@@ -51,6 +57,8 @@ when 'bootstrap'
51
57
  bootstrap ARGV[1]
52
58
  when 'compile'
53
59
  compile
60
+ when 'open'
61
+ open
54
62
  when 'watch'
55
63
  watch
56
64
  else
@@ -12,6 +12,7 @@ module SmallVictories
12
12
  def setup folder=nil
13
13
  self.folder = "#{folder.chomp("/").reverse.chomp("/").reverse}/" if folder
14
14
  setup_directory folder_path
15
+ setup_directory folder_source_path
15
16
  setup_config
16
17
  setup_stylesheet
17
18
  setup_javascript
@@ -19,7 +20,11 @@ module SmallVictories
19
20
  end
20
21
 
21
22
  def folder_path
22
- "#{config.full_source_path}#{folder}"
23
+ "#{ROOT}/#{folder}"
24
+ end
25
+
26
+ def folder_source_path
27
+ "#{folder_path}/#{config.source}/"
23
28
  end
24
29
 
25
30
  private
@@ -56,18 +61,18 @@ module SmallVictories
56
61
  end
57
62
 
58
63
  def setup_stylesheet
59
- create_src_file('stylesheet.css', "#{folder_path}#{config.stylesheet}")
64
+ create_src_file('stylesheet.css', "#{folder_source_path}#{config.stylesheet}")
60
65
  end
61
66
 
62
67
  def setup_javascript
63
- create_src_file('javascript.js', "#{folder_path}#{config.javascript}")
68
+ create_src_file('javascript.js', "#{folder_source_path}#{config.javascript}")
64
69
  end
65
70
 
66
71
  def setup_html
67
- setup_directory("#{folder_path}#{config.includes}")
68
- create_src_file('layout.liquid', "#{folder_path}#{config.layout}")
69
- create_src_file('index.liquid', "#{folder_path}/index.liquid")
70
- create_src_file('head.liquid', "#{folder_path}#{config.includes}/_head.liquid")
72
+ setup_directory("#{folder_source_path}#{config.includes}")
73
+ create_src_file('head.liquid', "#{folder_source_path}#{config.includes}/_head.liquid")
74
+ create_src_file('layout.liquid', "#{folder_source_path}#{config.layout}")
75
+ create_src_file('index.liquid', "#{folder_source_path}index.liquid")
71
76
  end
72
77
  end
73
78
  end
@@ -51,6 +51,7 @@ module SmallVictories
51
51
  else
52
52
  html = liquid.render('config' => { 'stylesheet' => config.stylesheet, 'javascript' => config.javascript })
53
53
  end
54
+ Dir.mkdir(config.full_destination_path) unless File.exists?(config.full_destination_path)
54
55
  File.open("#{config.full_destination_path}#{output_file_name}", 'w') { |file| file.write(html) }
55
56
  SmallVictories.logger.info "compiled #{config.destination}/#{output_file_name}"
56
57
  rescue => e
@@ -58,6 +59,7 @@ module SmallVictories
58
59
  end
59
60
  end
60
61
  end
62
+
61
63
  def package bundles=[config.stylesheet, config.javascript]
62
64
  sprockets = Sprockets::Environment.new(ROOT) do |environment|
63
65
  environment.js_compressor = :uglify
@@ -21,7 +21,7 @@ module SmallVictories
21
21
  end
22
22
 
23
23
  def full_source_path
24
- "#{ROOT}/#{source}"
24
+ "#{ROOT}/#{source}/"
25
25
  end
26
26
 
27
27
  def destination
@@ -1,7 +1,7 @@
1
1
  module SmallVictories
2
2
  CONFIG_FILE = '_config.yml'
3
- DEFAULT_SOURCE = ''
4
- DEFAULT_DESTINATION = '_site'
3
+ DEFAULT_SOURCE = 'dev'
4
+ DEFAULT_DESTINATION = 'prod'
5
5
  DEFAULT_STYLESHEET = '_sv_custom.css'
6
6
  DEFAULT_JAVASCRIPT = '_sv_custom.js'
7
7
  DEFAULT_LAYOUT = '_layout.liquid'
@@ -1,3 +1,3 @@
1
1
  module SmallVictories
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -36,14 +36,14 @@ module SmallVictories
36
36
  end
37
37
 
38
38
  def watch
39
- listener = build_listener
40
- listener.start
41
39
  SmallVictories.logger.debug "👋"
42
40
  SmallVictories.logger.debug "👀"
41
+ listener = build_listener
42
+ listener.start
43
43
 
44
44
  trap("INT") do
45
45
  listener.stop
46
- SmallVictories.logger.warn "✋ Halting auto-regeneration."
46
+ puts "✋ Halting auto-regeneration."
47
47
  exit 0
48
48
  end
49
49
 
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_runtime_dependency 'autoprefixer-rails', "~> 6.0"
22
+ spec.add_runtime_dependency 'coffee-script', '~> 2.4'
23
+ spec.add_runtime_dependency 'listen', '~> 3.0'
24
+ spec.add_runtime_dependency 'liquid', "~> 3.0"
21
25
  spec.add_runtime_dependency 'sassc', "~> 1.6"
22
26
  spec.add_runtime_dependency 'sprockets', '~> 3.4'
23
- spec.add_runtime_dependency 'listen', '~> 3.0'
24
27
  spec.add_runtime_dependency 'uglifier', '~> 2.7'
25
- spec.add_runtime_dependency 'coffee-script', '~> 2.4'
26
- spec.add_runtime_dependency 'liquid', "~> 3.0"
27
- spec.add_runtime_dependency 'autoprefixer-rails', "~> 6.0"
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 1.7"
30
30
  spec.add_development_dependency "rake", "~> 10.0"
data/spec/builder_spec.rb CHANGED
@@ -3,19 +3,19 @@ require 'spec_helper'
3
3
  describe SmallVictories do
4
4
  let(:builder) { SmallVictories::Builder.new(config: SmallVictories::Configuration.new) }
5
5
 
6
- context 'with no folder' do
6
+ context 'with folder' do
7
7
  it 'sets up default files' do
8
8
  builder.setup 'spec/fixtures/new'
9
9
  expect(File.exists?('fixtures/new/_config.yml')).to eq true
10
- expect(File.exists?('fixtures/new/_layout.liquid')).to eq true
11
- expect(File.exists?('fixtures/new/index.liquid')).to eq true
12
- expect(File.exists?('fixtures/new/_includes/_head.liquid')).to eq true
13
- expect(File.exists?('fixtures/new/_sv_custom.js')).to eq true
14
- expect(File.exists?('fixtures/new/_sv_custom.css')).to eq true
10
+ expect(File.exists?('fixtures/new/dev/_layout.liquid')).to eq true
11
+ expect(File.exists?('fixtures/new/dev/index.liquid')).to eq true
12
+ expect(File.exists?('fixtures/new/dev/_includes/_head.liquid')).to eq true
13
+ expect(File.exists?('fixtures/new/dev/_sv_custom.js')).to eq true
14
+ expect(File.exists?('fixtures/new/dev/_sv_custom.css')).to eq true
15
15
  end
16
16
 
17
17
  after do
18
- %w(fixtures/new/_config.yml fixtures/new/index.liquid fixtures/new/_sv_custom.css fixtures/new/_sv_custom.js fixtures/new/_includes/_head.liquid fixtures/new/_layout.liquid).each { |path| clean_file(path) }
18
+ %w(fixtures/new/_config.yml fixtures/new/dev/index.liquid fixtures/new/dev/_sv_custom.css fixtures/new/dev/_sv_custom.js fixtures/new/dev/_includes/_head.liquid fixtures/new/dev/_layout.liquid).each { |path| clean_file(path) }
19
19
  end
20
20
  end
21
21
  end
@@ -5,11 +5,11 @@ describe SmallVictories do
5
5
 
6
6
  context 'with no config file' do
7
7
  it 'defaults to source directory' do
8
- expect(configuration.source).to eq ''
8
+ expect(configuration.source).to eq 'dev'
9
9
  end
10
10
 
11
11
  it 'defaults to destination directory' do
12
- expect(configuration.destination).to eq '_site'
12
+ expect(configuration.destination).to eq 'prod'
13
13
  end
14
14
 
15
15
  it 'defaults stylesheet file' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smallvictories
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Dijkstra
@@ -11,33 +11,33 @@ cert_chain: []
11
11
  date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: sassc
14
+ name: autoprefixer-rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sprockets
28
+ name: coffee-script
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.4'
33
+ version: '2.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.4'
40
+ version: '2.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: listen
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,61 +53,61 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: uglifier
56
+ name: liquid
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.7'
61
+ version: '3.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.7'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: coffee-script
70
+ name: sassc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.4'
75
+ version: '1.6'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.4'
82
+ version: '1.6'
83
83
  - !ruby/object:Gem::Dependency
84
- name: liquid
84
+ name: sprockets
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.0'
89
+ version: '3.4'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.0'
96
+ version: '3.4'
97
97
  - !ruby/object:Gem::Dependency
98
- name: autoprefixer-rails
98
+ name: uglifier
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '6.0'
103
+ version: '2.7'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '6.0'
110
+ version: '2.7'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bundler
113
113
  requirement: !ruby/object:Gem::Requirement