momaker 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 03b0f620a2919a7458dea73e4b513a67c7930538
4
+ data.tar.gz: df4666b4b8a41f1bf0a5d6b7cd26b32ce0ecd1a9
5
+ SHA512:
6
+ metadata.gz: 84e11919164179ff7bfdd3af50ac0efdc018479b9f9ec5e80275b63848a626239114d175d0abdbf2e2c08c7d525790cf02906253c655baec3d2493824e163e03
7
+ data.tar.gz: 38e5480e21910ca0e566c93e14eeb5cdf0abdd846076882758649bec3b0aca9bc83937232c79f239936b63b79947ad2be2a52758a77e2c3a0a935cf51e3a9d0e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in momaker.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Robert Lyall
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Momaker
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'momaker'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install momaker
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/momaker/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/momaker ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'momaker'
4
+
5
+ command = ARGV[0]
6
+ type = ARGV[1]
7
+ name = ARGV[2]
8
+ submodules = ARGV[3..ARGV.length]
9
+
10
+ Momaker.start(command, type, name, submodules)
data/lib/momaker.rb ADDED
@@ -0,0 +1,86 @@
1
+ require "fileutils"
2
+ require "momaker/version"
3
+
4
+ module Momaker
5
+ @config_options = { :path => "./src/scss" }
6
+
7
+ def self.hyphenize(str)
8
+ str.gsub(/::/, '/')
9
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
10
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
11
+ .tr("_", "-")
12
+ .tr(" ", "-")
13
+ .downcase!
14
+ end
15
+
16
+ def self.create_module_directory(path)
17
+ FileUtils::mkdir_p(path)
18
+ end
19
+
20
+ def self.create_module(dir, name)
21
+ File.open("#{dir}/_#{name}.scss", "w+") do |file|
22
+
23
+ # Block
24
+ file.write(".#{name} {}" + "\n\n")
25
+
26
+ if @module_submodules.length
27
+
28
+ # Elements
29
+ @module_submodules.each do |submodule|
30
+ file.write(".#{name}__#{submodule[:element]} {}")
31
+ file.write("\n\n")
32
+
33
+ # Modifiers
34
+ submodule[:modifiers].each do |modifier|
35
+ file.write(".#{name}__#{submodule[:element]}--#{modifier} {}")
36
+ file.write("\n\n")
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ def self.start(command, module_type, module_name, remaining_arguments)
44
+ module_name = hyphenize(module_name)
45
+ @module_submodules = []
46
+
47
+ if remaining_arguments
48
+ remaining_arguments.each do |argument|
49
+ argument_array = argument.split("+")
50
+ element = argument_array[0]
51
+ modifiers = argument_array[1].split(",")
52
+ puts "+ #{element}"
53
+ modifiers.each { |m| puts " = #{m}" }
54
+ puts "\n"
55
+
56
+ @module_submodules.push({ :element => element, :modifiers => modifiers })
57
+ end
58
+ end
59
+
60
+ if command.downcase == "generate" || command.downcase == "g"
61
+ unless module_name
62
+ puts "What would you like to call your #{module_type}?"
63
+ print "> "
64
+ module_name = hyphenize(STDIN.gets.chomp().strip)
65
+ end
66
+
67
+ unless module_name.empty?
68
+ puts "Create #{module_type} called #{module_name}? Y/N"
69
+ print "> "
70
+ end
71
+
72
+ if STDIN.gets.chomp().downcase == "y"
73
+ module_path = "#{@config_options[:path]}/#{module_type}"
74
+
75
+ if module_path
76
+ create_module_directory(module_path)
77
+
78
+ if create_module(module_path, module_name)
79
+ puts "Generated your new module:"
80
+ puts "#{module_path}/_#{module_name}.scss"
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,3 @@
1
+ module Momaker
2
+ VERSION = "0.0.1"
3
+ end
data/momaker.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'momaker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "momaker"
8
+ spec.version = Momaker::VERSION
9
+ spec.authors = ["Robert Lyall"]
10
+ spec.email = ["robert.g.lyall@gmail.com"]
11
+ spec.summary = %q{ A small Ruby script for creating modular Sass components }
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: momaker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Robert Lyall
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - robert.g.lyall@gmail.com
44
+ executables:
45
+ - momaker
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/momaker
55
+ - lib/momaker.rb
56
+ - lib/momaker/version.rb
57
+ - momaker.gemspec
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: A small Ruby script for creating modular Sass components
82
+ test_files: []