musket 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGJmNTk1N2QzMjkzZGIwNTYyOGM3M2NlOTk5ZGUzY2JhNDQ2N2FmNA==
5
+ data.tar.gz: !binary |-
6
+ ZjhiM2U1MzFiNGZkODcyMjI5ZjAzNzUwYWM5ZmMzMmQ0MTI2ODIwYQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZDA0YjljODI1OGU2ODU0ZWNjYjk4ZThjZWExNTk4YTQ4OTViOTcxNWFlM2U1
10
+ MDFjNzIxOTY5Zjc1NzgyMDc1NjhhZDE5MzQwZDhlNmRhNzZlNWM2MjcyNjQ5
11
+ MGEzY2U3NzZiYzcxMGZkYjRjMjk1MjNhNmE0ODFkYzEyZDk2NTA=
12
+ data.tar.gz: !binary |-
13
+ ZmVhNzA0NDM4YzcwOWQzZGVhMDA4OTM2YWJlMjhkNTgyNTJhMmZlMjdhZTAy
14
+ OTJhMWI1NzE5NGI5YzRhZmM0ZTMxNWZmNGYzN2EyNmU3NzlmMjk2ZWRmYjU1
15
+ YzQ5YTY0NzNjZTZkYzYwOGE4NGQzMzZiZmQ5MTlhMzlkNDkzOGI=
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in musket.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Aniket Pant
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.
@@ -0,0 +1,49 @@
1
+ # Musket
2
+
3
+ musket is a gem which can be used to generate front-end templates. It is capable for creating HTML, CSS and JS files with the basic requirements.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'musket'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install musket
18
+
19
+ ## Usage
20
+
21
+ ### Setup
22
+
23
+ Run `musket setup`.
24
+
25
+ The `setup` command creates a `.musket` directory in your home folder. It contains a configuration file named `config.yml` which can be modified by you according to your need. It also creates a directory `templates` which houses all the templates which can be used by `musket`.
26
+
27
+ ### List
28
+
29
+ Use `musket list` to get a list of available templates.
30
+
31
+ ### Generate
32
+
33
+ `musket generate [TEMPLATE] [FILENAME]`
34
+
35
+ The TEMPLATE name provided should be a valid TEMPLATE name. The FILENAME is an optional field. If no FILENAME is supplied, it defaults to 'musket'.
36
+
37
+ The generated file has the name `FILENAME.TEMPLATE`.
38
+
39
+ ## Creating templates
40
+
41
+ If you wish to create a template of your own, you can created them under `.musket/templates/`. The templates should have a `.mote` extension. You should read up on how [mote](https://github.com/soveran/mote) parses the templates.
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'musket/cli'
4
+ Musket::CLI.start
@@ -0,0 +1,46 @@
1
+ require 'musket/configuration'
2
+ require 'musket/version'
3
+
4
+ require 'mote'
5
+ require 'fileutils'
6
+ require 'yaml'
7
+
8
+ module Musket
9
+ CONFIG_DIR = Dir.home + '/.musket/'
10
+ CONFIG_FILE = CONFIG_DIR + 'config.yml'
11
+ TEMPLATE_DIR = CONFIG_DIR + 'templates/'
12
+
13
+ class << self
14
+ def load_config
15
+ @config = Musket::Configuration.read if File.exists?CONFIG_FILE
16
+ end
17
+
18
+ def templates
19
+ d = Dir.new(TEMPLATE_DIR)
20
+ template_list = []
21
+ d.each {
22
+ |f|
23
+ template_name = File.basename(f, '.mote')
24
+ template_list.push(template_name) if template_name != '.' and template_name != '..'
25
+ }
26
+ return template_list
27
+ end
28
+
29
+ def generate(template, filename)
30
+ self.load_config
31
+ filename = "musket" if filename == ''
32
+ template_file = TEMPLATE_DIR + "#{template}.mote"
33
+ f = File.open(template_file)
34
+ output = Mote.parse(f.read, self, [:author]).call([author: @config["author"]])
35
+ current_dir = Dir.pwd
36
+ new_file = File.open(current_dir + "/#{filename}.#{template}", 'w')
37
+ new_file.puts(output)
38
+ new_file.close
39
+ end
40
+
41
+ def install
42
+ Musket::Configuration.create unless File.exists?CONFIG_FILE
43
+ Musket::Configuration.copy_templates unless File.exists?TEMPLATE_DIR
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,31 @@
1
+ require 'musket'
2
+ require 'thor'
3
+
4
+ module Musket
5
+ class CLI < Thor
6
+ package_name "musket"
7
+ map "-u" => :generate
8
+
9
+ desc "generate [TEMPLATE] [FILENAME]", "generates a new file with the provided template and filename"
10
+ def generate(template="", filename="")
11
+ templates = Musket.templates
12
+ if templates.include? template
13
+ Musket.generate(template, filename) if template != ''
14
+ else
15
+ puts "Please provide a valid template name!"
16
+ end
17
+ end
18
+
19
+ desc "list", "lists available templates"
20
+ def list
21
+ templates = Musket.templates
22
+ puts "List of available templates:"
23
+ puts templates.join('\n')
24
+ end
25
+
26
+ desc "setup", "creates configuration directory and default templates"
27
+ def setup
28
+ Musket.install
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ module Musket
2
+ class Configuration
3
+ def self.read
4
+ config = File.open(CONFIG_FILE, 'r')
5
+ output = YAML.load(config.read)
6
+ return output
7
+ end
8
+
9
+ def self.create
10
+ FileUtils.mkdir(CONFIG_DIR) unless File.exists?CONFIG_DIR
11
+ config = File.open(CONFIG_FILE, 'w+')
12
+ data = {
13
+ 'author' => 'TODO: Write Author Name',
14
+ 'twitter' => 'TODO: Write Twitter Handle'
15
+ }
16
+ config.puts(data.to_yaml)
17
+ config.close
18
+ end
19
+
20
+ def self.copy_templates
21
+ FileUtils.mkdir(TEMPLATE_DIR) unless File.exists?TEMPLATE_DIR
22
+ FileUtils.cp_r File.expand_path('../../templates', File.dirname(__FILE__)), CONFIG_DIR
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Musket
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'musket/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "musket"
8
+ spec.version = Musket::VERSION
9
+ spec.authors = ["Aniket Pant"]
10
+ spec.email = ["me@aniketpant.com"]
11
+ spec.description = %q{musket is a gem which can be used to generate front-end templates. It is capable for creating HTML, CSS and JS files with the basic requirements.}
12
+ spec.summary = %q{RubyGem for generating front-end templates}
13
+ spec.homepage = "https://github.com/aniketpant/musket"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_runtime_dependency "thor"
25
+ spec.add_runtime_dependency "mote"
26
+ end
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE html>
2
+ <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
3
+ <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
4
+ <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
5
+ <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
6
+ <head>
7
+ <meta charset="utf-8">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
9
+ <title>Site Title</title>
10
+ <meta name="author" content="{{ author }}">
11
+ <meta name="description" content="Site Description">
12
+ <meta name="viewport" content="width=device-width">
13
+
14
+ <!-- stylesheets -->
15
+ <link rel="stylesheet" href="style.css">
16
+ </head>
17
+ <body>
18
+ <!--[if lt IE 7]>
19
+ <p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
20
+ <![endif]-->
21
+
22
+ <header>
23
+ </header>
24
+
25
+ <section>
26
+ </section>
27
+
28
+ <footer>
29
+ </footer>
30
+ </body>
31
+ </html>
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'musket'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestMusket < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: musket
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Aniket Pant
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-05 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mote
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: musket is a gem which can be used to generate front-end templates. It
70
+ is capable for creating HTML, CSS and JS files with the basic requirements.
71
+ email:
72
+ - me@aniketpant.com
73
+ executables:
74
+ - musket
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - .gitignore
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/musket
85
+ - lib/musket.rb
86
+ - lib/musket/cli.rb
87
+ - lib/musket/configuration.rb
88
+ - lib/musket/version.rb
89
+ - musket.gemspec
90
+ - templates/html.mote
91
+ - test/helper.rb
92
+ - test/test_musket.rb
93
+ homepage: https://github.com/aniketpant/musket
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.0.3
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: RubyGem for generating front-end templates
117
+ test_files:
118
+ - test/helper.rb
119
+ - test/test_musket.rb