co2 0.1.0

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.
data/bin/co2 ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'rubygems'
6
+ require 'co2'
7
+
8
+ Co2::Cli.new(
9
+ ARGV,
10
+ STDOUT,
11
+ STDERR
12
+ ).run
@@ -0,0 +1,81 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{co2}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Florian Schade}, %q{Thomas Boerger}]
12
+ s.date = %q{2011-10-07}
13
+ s.description = %q{It's a simple rapid prototyping CSS framework, including SCSS styles, and cli generator for CSS files}
14
+ s.email = [%q{f.schade@purpled.de}, %q{t.boerger@purpled.de}]
15
+ s.executables = [%q{co2}]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "app/assets/stylesheets/app.css",
27
+ "app/assets/stylesheets/co2.scss",
28
+ "app/assets/stylesheets/co2/container.scss",
29
+ "app/assets/stylesheets/co2/element.scss",
30
+ "app/assets/stylesheets/co2/form.scss",
31
+ "app/assets/stylesheets/co2/grid.scss",
32
+ "app/assets/stylesheets/co2/helper.scss",
33
+ "app/assets/stylesheets/co2/message.scss",
34
+ "app/assets/stylesheets/co2/mixin.scss",
35
+ "app/assets/stylesheets/co2/navigation.scss",
36
+ "app/assets/stylesheets/co2/reset.scss",
37
+ "app/assets/stylesheets/co2/table.scss",
38
+ "app/assets/stylesheets/co2/typo.scss",
39
+ "bin/co2",
40
+ "co2.gemspec",
41
+ "init.rb",
42
+ "lib/co2.rb",
43
+ "lib/co2/cli.rb",
44
+ "lib/co2/version.rb",
45
+ "lib/co2/writer.rb",
46
+ "lib/co2/writer/disk.rb",
47
+ "lib/generators/co2.rb",
48
+ "lib/generators/co2/install/install_generator.rb",
49
+ "lib/generators/co2/install/templates/co2.css.scss"
50
+ ]
51
+ s.homepage = %q{https://github.com/purpled/co2}
52
+ s.licenses = [%q{MIT}]
53
+ s.require_paths = [%q{lib}]
54
+ s.rubygems_version = %q{1.8.5}
55
+ s.summary = %q{CSS prototyping framework}
56
+
57
+ if s.respond_to? :specification_version then
58
+ s.specification_version = 3
59
+
60
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
61
+ s.add_runtime_dependency(%q<sass>, ["~> 3.1.7"])
62
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.18"])
63
+ s.add_development_dependency(%q<yard>, ["~> 0.7.2"])
64
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
65
+ s.add_development_dependency(%q<rdiscount>, ["~> 1.6.8"])
66
+ else
67
+ s.add_dependency(%q<sass>, ["~> 3.1.7"])
68
+ s.add_dependency(%q<bundler>, ["~> 1.0.18"])
69
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
70
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
71
+ s.add_dependency(%q<rdiscount>, ["~> 1.6.8"])
72
+ end
73
+ else
74
+ s.add_dependency(%q<sass>, ["~> 3.1.7"])
75
+ s.add_dependency(%q<bundler>, ["~> 1.0.18"])
76
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
77
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
78
+ s.add_dependency(%q<rdiscount>, ["~> 1.6.8"])
79
+ end
80
+ end
81
+
data/init.rb ADDED
@@ -0,0 +1,4 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ require 'co2'
@@ -0,0 +1,42 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ require 'tempfile'
5
+
6
+ class File
7
+ def self.prepend(path, string)
8
+ Tempfile.open File.basename(path) do |tempfile|
9
+ tempfile << string
10
+
11
+ File.open(path, 'r+') do |file|
12
+ tempfile << file.read
13
+ file.pos = tempfile.pos = 0
14
+ file << tempfile.read
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ class Hash
21
+ def deep_merge(hash)
22
+ target = dup
23
+
24
+ hash.keys.each do |key|
25
+ if hash[key].is_a? Hash and self[key].is_a? Hash
26
+ target[key] = target[key].deep_merge(hash[key])
27
+ next
28
+ end
29
+
30
+ target[key] = hash[key]
31
+ end
32
+
33
+ target
34
+ end
35
+ end
36
+
37
+ module Co2
38
+ autoload :Build, 'co2/build'
39
+ autoload :Cli, 'co2/cli'
40
+ autoload :Version, 'co2/version'
41
+ autoload :Writer, 'co2/writer'
42
+ end
@@ -0,0 +1,113 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ require 'optparse'
5
+ require 'fileutils'
6
+
7
+ module Co2
8
+ class Cli
9
+ attr_reader :options
10
+
11
+ def initialize(arguments, output, errors)
12
+ @arguments = arguments
13
+ @output = output
14
+ @errors = errors
15
+
16
+ @options = {
17
+ :config => File.expand_path('../../../app/assets/stylesheets/co2.scss', __FILE__),
18
+ :directory => '.'
19
+ }
20
+ end
21
+
22
+ def run
23
+ if options? and valid?
24
+ process!
25
+ end
26
+ end
27
+
28
+ protected
29
+ def options?
30
+ @parser = OptionParser.new do |opts|
31
+ opts.banner = banner
32
+ opts.version = version
33
+
34
+ opts.separator ''
35
+ opts.separator 'Config options:'
36
+
37
+ opts.on('-g', '--generate FILENAME', 'Generate default config') do |p|
38
+ generate p
39
+ exit 0
40
+ end
41
+
42
+ opts.on('-c', '--config FILENAME', 'Use the defined config') do |p|
43
+ @options[:config] = p
44
+ end
45
+
46
+ opts.separator ''
47
+ opts.separator 'Build options:'
48
+
49
+ opts.on('-o', '--output DIRECTORY', 'Directory for generated files') do |p|
50
+ @options[:directory] = p
51
+ end
52
+
53
+ opts.separator ''
54
+ opts.separator 'Common options:'
55
+
56
+ opts.on_tail('-h', '--help', 'Show this message') do
57
+ logit opts.help
58
+ exit 0
59
+ end
60
+
61
+ opts.on_tail('-v', '--version', 'Show version info') do
62
+ logit opts.version
63
+ exit 0
64
+ end
65
+ end
66
+
67
+ begin
68
+ @parser.parse!(@arguments)
69
+ rescue
70
+ error 'Failed to parse cli parameters'
71
+ end
72
+
73
+ true
74
+ end
75
+
76
+ def valid?
77
+ error 'Config file does not exist' if @options[:config] and not File.exists?(@options[:config])
78
+ error 'Output directory does not exist' if @options[:directory] and not File.directory?(@options[:directory])
79
+ true
80
+ end
81
+
82
+ def process!
83
+ Writer::Disk.new @options
84
+ end
85
+
86
+ def generate(file)
87
+ FileUtils.cp @options[:config], [file, 'scss'].join('.')
88
+ end
89
+
90
+ def error(msg)
91
+ @errors.puts "#{msg}\n"
92
+ exit 0
93
+ end
94
+
95
+ def logit(msg)
96
+ @output.puts "#{msg}\n"
97
+ end
98
+
99
+ def version
100
+ ['co2 v', Version::STRING].join
101
+ end
102
+
103
+ def banner
104
+ [
105
+ 'This script generates compressed CSS files defined by cli',
106
+ 'options or configuration file and the co2 SCSS files.',
107
+ '',
108
+ 'It was created by Florian Schade and Thomas Boerger, you can',
109
+ 'find more informations and demos on http://www.co2css.com'
110
+ ].join("\n")
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,13 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ module Co2
5
+ class Version
6
+ MAJOR = 0
7
+ MINOR = 1
8
+ PATCH = 0
9
+ BUILD = nil
10
+
11
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
12
+ end
13
+ end
@@ -0,0 +1,37 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ module Co2
5
+ module Writer
6
+ autoload :Disk, 'co2/writer/disk'
7
+
8
+ class Base
9
+ protected
10
+ def scss_base_path
11
+ File.expand_path('../../../app/assets/stylesheets', __FILE__)
12
+ end
13
+
14
+ def copyright
15
+ [
16
+ '/*_____________________________________________________________________________',
17
+ ' *_____________________________________________/\/\/\/\/\______________________',
18
+ ' *_______________________/\/\/\/\____/\/\/\____________/\/\____________________',
19
+ ' *_____________________/\/\________/\/\__/\/\____/\/\/\/\______________________',
20
+ ' *_____________________/\/\________/\/\__/\/\__/\/\____________________________',
21
+ ' *_______________________/\/\/\/\____/\/\/\____/\/\/\/\/\/\____________________',
22
+ ' *_____________________________________________________________________________',
23
+ ' *_______________inspired by blueprint, 960.gs, formalize, formee______________',
24
+ ' *_____________________________________________________________________________',
25
+ ' *',
26
+ ' * @copyright Copyright 2011 Florian Schade, Thomas Boerger',
27
+ ' * @author Florian Schade <f.schade@purpled.de>',
28
+ ' * @author Thomas Boerger <t.boerger@purpled.de>',
29
+ ' * @license http://www.opensource.org/licenses/mit-license.php',
30
+ ' */',
31
+ '',
32
+ ''
33
+ ].join("\n")
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,52 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ require 'fileutils'
5
+ require 'sass'
6
+
7
+ module Co2
8
+ module Writer
9
+ class Disk < Base
10
+ def initialize(options)
11
+ @options = options
12
+
13
+ @sassopt = {
14
+ :load_paths => scss_base_path,
15
+ :style => :compressed,
16
+ :cache => false,
17
+ :line_numbers => false
18
+ }
19
+
20
+ generate
21
+ end
22
+
23
+ protected
24
+ def generate
25
+ Sass.compile_file(
26
+ co2_input_path,
27
+ co2_output_path,
28
+ @sassopt
29
+ )
30
+
31
+ FileUtils.cp app_input_path, app_output_path
32
+ File.prepend co2_output_path, copyright
33
+ end
34
+
35
+ def co2_input_path
36
+ @options[:config]
37
+ end
38
+
39
+ def co2_output_path
40
+ File.join(@options[:directory], 'co2.css')
41
+ end
42
+
43
+ def app_input_path
44
+ File.join(scss_base_path, 'app.css')
45
+ end
46
+
47
+ def app_output_path
48
+ File.join(@options[:directory], 'app.css')
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,12 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ module Co2
5
+ module Generators
6
+ class Base < Rails::Generators::Base
7
+ def self.source_root
8
+ @_co2_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'co2', generator_name, 'templates'))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # Created by Florian Schade, Thomas Boerger on 2011-08-25.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ require 'generators/co2'
5
+
6
+ module Co2
7
+ module Generators
8
+ class InstallGenerator < Base
9
+ desc 'Install co2 bootstrap SCSS file'
10
+
11
+ def copy_stylesheet
12
+ copy_file 'co2.css.scss', File.join('app', 'assets', 'stylesheets', 'co2.css.scss')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,39 @@
1
+ /*_____________________________________________________________________________
2
+ *_____________________________________________/\/\/\/\/\______________________
3
+ *_______________________/\/\/\/\____/\/\/\____________/\/\____________________
4
+ *_____________________/\/\________/\/\__/\/\____/\/\/\/\______________________
5
+ *_____________________/\/\________/\/\__/\/\__/\/\____________________________
6
+ *_______________________/\/\/\/\____/\/\/\____/\/\/\/\/\/\____________________
7
+ *_____________________________________________________________________________
8
+ *_______________inspired by blueprint, 960.gs, formalize, formee______________
9
+ *_____________________________________________________________________________
10
+ *
11
+ * @copyright Copyright 2011 Florian Schade, Thomas Boerger
12
+ * @author Florian Schade <f.schade@purpled.de>
13
+ * @author Thomas Boerger <t.boerger@purpled.de>
14
+ * @license http://www.opensource.org/licenses/mit-license.php
15
+ */
16
+
17
+ $base_size: 13px;
18
+ $base_line: 18px;
19
+ $base_color: #000;
20
+ $base_font: "Helvetica Neue", Helvetica, Arial, sans-serif;
21
+
22
+ $space_dimension: 10px;
23
+
24
+ $grid_columns: 16;
25
+ $grid_column_width: 60px;
26
+
27
+ $site_width: ($grid_columns * $grid_column_width);
28
+
29
+ @import "co2/mixin";
30
+ @import "co2/reset";
31
+ @import "co2/helper";
32
+ @import "co2/container";
33
+ @import "co2/grid";
34
+ @import "co2/table";
35
+ @import "co2/element";
36
+ @import "co2/form";
37
+ @import "co2/typo";
38
+ @import "co2/navigation";
39
+ @import "co2/message";
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: co2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Florian Schade
9
+ - Thomas Boerger
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-10-07 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sass
17
+ requirement: &70222078510700 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 3.1.7
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *70222078510700
26
+ - !ruby/object:Gem::Dependency
27
+ name: bundler
28
+ requirement: &70222078509980 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.18
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *70222078509980
37
+ - !ruby/object:Gem::Dependency
38
+ name: yard
39
+ requirement: &70222078509100 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.7.2
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *70222078509100
48
+ - !ruby/object:Gem::Dependency
49
+ name: jeweler
50
+ requirement: &70222078508360 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 1.6.4
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *70222078508360
59
+ - !ruby/object:Gem::Dependency
60
+ name: rdiscount
61
+ requirement: &70222078557140 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 1.6.8
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *70222078557140
70
+ description: It's a simple rapid prototyping CSS framework, including SCSS styles,
71
+ and cli generator for CSS files
72
+ email:
73
+ - f.schade@purpled.de
74
+ - t.boerger@purpled.de
75
+ executables:
76
+ - co2
77
+ extensions: []
78
+ extra_rdoc_files:
79
+ - LICENSE.txt
80
+ - README.md
81
+ files:
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ - LICENSE.txt
85
+ - README.md
86
+ - Rakefile
87
+ - app/assets/stylesheets/app.css
88
+ - app/assets/stylesheets/co2.scss
89
+ - app/assets/stylesheets/co2/container.scss
90
+ - app/assets/stylesheets/co2/element.scss
91
+ - app/assets/stylesheets/co2/form.scss
92
+ - app/assets/stylesheets/co2/grid.scss
93
+ - app/assets/stylesheets/co2/helper.scss
94
+ - app/assets/stylesheets/co2/message.scss
95
+ - app/assets/stylesheets/co2/mixin.scss
96
+ - app/assets/stylesheets/co2/navigation.scss
97
+ - app/assets/stylesheets/co2/reset.scss
98
+ - app/assets/stylesheets/co2/table.scss
99
+ - app/assets/stylesheets/co2/typo.scss
100
+ - bin/co2
101
+ - co2.gemspec
102
+ - init.rb
103
+ - lib/co2.rb
104
+ - lib/co2/cli.rb
105
+ - lib/co2/version.rb
106
+ - lib/co2/writer.rb
107
+ - lib/co2/writer/disk.rb
108
+ - lib/generators/co2.rb
109
+ - lib/generators/co2/install/install_generator.rb
110
+ - lib/generators/co2/install/templates/co2.css.scss
111
+ homepage: https://github.com/purpled/co2
112
+ licenses:
113
+ - MIT
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ segments:
125
+ - 0
126
+ hash: -893316843300624134
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.5
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: CSS prototyping framework
139
+ test_files: []