arethusa_plugin_generator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +42 -0
- data/Rakefile +7 -0
- data/arethusa_plugin_generator.gemspec +26 -0
- data/bin/arethusa_plugin_generator +7 -0
- data/lib/arethusa_plugin_generator.rb +5 -0
- data/lib/arethusa_plugin_generator/cli.rb +150 -0
- data/lib/arethusa_plugin_generator/templates/html_template.tt +1 -0
- data/lib/arethusa_plugin_generator/templates/module.tt +2 -0
- data/lib/arethusa_plugin_generator/templates/service.tt +19 -0
- data/lib/arethusa_plugin_generator/version.rb +3 -0
- data/spec/lib/arethusa_plugin_generator_spec.rb +7 -0
- data/spec/spec_helper.rb +22 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6fd94c123789780a8c3b87368308f9c9db4846e9
|
4
|
+
data.tar.gz: 1528bf53fa8e3b0ac8a7ed272034e537007f4fa4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 985866768be8954dfd4e3c434cd80312a8a94ea338beb48700932edf45efdfe28e269bc0ce1e32b81390c3bac610e5fe7fdf636353d068707c38dd7192a98cd7
|
7
|
+
data.tar.gz: 6de27ef1f55aed8e89ba9b03cdf61a15b9c71ef1fdd397be287547002b9b09311932649025bf88a7317ab5a84729247b535c0cb8a57ad7e266530b6e374cbe8e
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 LFDM
|
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,42 @@
|
|
1
|
+
# ArethusaPluginGenerator
|
2
|
+
|
3
|
+
[![Version](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/badge_fury.png)](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/badge_fury)
|
4
|
+
[![Dependencies](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/gemnasium.png)](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/gemnasium)
|
5
|
+
[![Build Status](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/travis.png)](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/travis)
|
6
|
+
[![Coverage](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/coveralls.png)](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/coveralls)
|
7
|
+
[![Code Climate](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/code_climate.png)](http://allthebadges.io/latin-language-toolkit/arethusa_plugin_generator/code_climate)
|
8
|
+
|
9
|
+
Generates a skeleton for an
|
10
|
+
[Arethusa](http://github.com/latin-language-toolkit/arethusa) plugin
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
```
|
15
|
+
gem install arethusa_plugin_generator
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
If you want to create a new plugin, go to you Arethusa directory and
|
21
|
+
then run
|
22
|
+
|
23
|
+
```
|
24
|
+
arethusa_plugin_generator new NAME
|
25
|
+
```
|
26
|
+
|
27
|
+
This will create all files and make all changes you need to get started with your plugin.Also check out `arethusa_plugin_generator help new` to learn about additional options.
|
28
|
+
|
29
|
+
|
30
|
+
## Disclaimer
|
31
|
+
|
32
|
+
Make sure you're running the latest version of this gem at all times. It
|
33
|
+
might change frequently, as Arethusa is continuing to make progress.
|
34
|
+
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it ( https://github.com/[my-github-username]/arethusa_plugin_generator/fork )
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -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 'arethusa_plugin_generator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "arethusa_plugin_generator"
|
8
|
+
spec.version = ArethusaPluginGenerator::VERSION
|
9
|
+
spec.authors = ["LFDM"]
|
10
|
+
spec.email = ["1986gh@gmail.com"]
|
11
|
+
spec.summary = %q{Generates a skeleton for an Arethusa plugin}
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "simplecov", "~> 0.7"
|
25
|
+
spec.add_dependency "thor"
|
26
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module ArethusaPluginGenerator
|
4
|
+
class CLI < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
attr_reader :namespace, :name
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
File.dirname(__FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'new', 'Creates a new Arethusa plugin skeleton'
|
14
|
+
method_option :namespace, aliases: '-n', default: 'arethusa',
|
15
|
+
desc: 'Namespace of the new plugin'
|
16
|
+
method_option :commit, type: :boolean, aliases: '-c',
|
17
|
+
desc: 'Commit the skeleton with git'
|
18
|
+
def new(name)
|
19
|
+
@name = name
|
20
|
+
@namespace = options[:namespace]
|
21
|
+
|
22
|
+
create_directories
|
23
|
+
create_files
|
24
|
+
|
25
|
+
try('insert module into arethusa', :add_module)
|
26
|
+
try('add minification routine', :add_minification)
|
27
|
+
try('add minification task', :add_minification_task)
|
28
|
+
try('add module to index.html', :add_to_index)
|
29
|
+
|
30
|
+
commit_changes if options[:commit]
|
31
|
+
|
32
|
+
puts
|
33
|
+
say_status(:success, "Created #{namespaced_name}")
|
34
|
+
give_conf_instructions
|
35
|
+
end
|
36
|
+
|
37
|
+
no_commands do
|
38
|
+
def try(message, method)
|
39
|
+
puts
|
40
|
+
say_status('trying', "to #{message}...", :yellow)
|
41
|
+
send(method)
|
42
|
+
end
|
43
|
+
|
44
|
+
def namespaced_name
|
45
|
+
[namespace, name].compact.join('.')
|
46
|
+
end
|
47
|
+
|
48
|
+
DIRECTORIES = %w{ plugin_dir template_dir }
|
49
|
+
def create_directories
|
50
|
+
DIRECTORIES.each { |dir| empty_directory(send(dir)) }
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_files
|
54
|
+
create_module
|
55
|
+
create_service
|
56
|
+
create_html_template
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_module
|
60
|
+
template('templates/module.tt', js_dir("#{namespaced_name}.js"))
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_service
|
64
|
+
template('templates/service.tt', plugin_dir("#{name}.js"))
|
65
|
+
end
|
66
|
+
|
67
|
+
def create_html_template
|
68
|
+
template('templates/html_template.tt', html_template_file)
|
69
|
+
end
|
70
|
+
|
71
|
+
def add_module
|
72
|
+
insert_into_file(arethusa_main, before: /\n\]/, force: false) do
|
73
|
+
",\n '#{namespaced_name}'"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def arethusa_main
|
78
|
+
js_dir('arethusa.js')
|
79
|
+
end
|
80
|
+
|
81
|
+
def add_minification
|
82
|
+
insert_into_file(gruntfile, after: /pluginFiles\(.*?core.*?\).*?\n/, force: false) do
|
83
|
+
%[ #{name}: { files: pluginFiles('#{namespaced_name}') },\n]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def add_minification_task
|
88
|
+
insert_into_file(gruntfile, after: /registerTask.*?minify.*?\n/, force: false) do
|
89
|
+
%{ 'uglify:#{name}',\n}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def gruntfile
|
94
|
+
File.join(destination_root, 'Gruntfile.js')
|
95
|
+
end
|
96
|
+
|
97
|
+
def add_to_index
|
98
|
+
insert_into_file(index_file, after: /script.*?core.*?script>\n/) do
|
99
|
+
%{ <script src="../dist/#{namespaced_name}.min.js"></script>\n}
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def index_file
|
104
|
+
File.join(destination_root, 'app', 'index.html')
|
105
|
+
end
|
106
|
+
|
107
|
+
def give_conf_instructions
|
108
|
+
text = <<-EOF
|
109
|
+
Now add your new #{name} plugin to a conf file and add a configuration for it.
|
110
|
+
It could look like this:
|
111
|
+
|
112
|
+
"#{name}" : {
|
113
|
+
"name" : "#{name}",
|
114
|
+
"template" : "#{html_template_file.slice(/template.*/)}"
|
115
|
+
}
|
116
|
+
EOF
|
117
|
+
puts text.lines.map { |line| "\t#{line}" }.join
|
118
|
+
end
|
119
|
+
|
120
|
+
def plugin_dir(file = '')
|
121
|
+
File.join(js_dir, namespaced_name, file)
|
122
|
+
end
|
123
|
+
|
124
|
+
def template_dir(file = '')
|
125
|
+
File.join(temp_dir, namespaced_name, file)
|
126
|
+
end
|
127
|
+
|
128
|
+
def html_template_file
|
129
|
+
template_dir("#{name}.html")
|
130
|
+
end
|
131
|
+
|
132
|
+
def js_dir(file = '')
|
133
|
+
File.join(destination_root, 'app/js', file)
|
134
|
+
end
|
135
|
+
|
136
|
+
def temp_dir
|
137
|
+
File.join(destination_root, 'app/templates')
|
138
|
+
end
|
139
|
+
|
140
|
+
def commit_changes
|
141
|
+
message = %{"Add skeleton for #{namespaced_name}"}
|
142
|
+
`git add -A`
|
143
|
+
`git commit -m #{message}`
|
144
|
+
sha = `git rev-parse --short HEAD`.chomp
|
145
|
+
puts
|
146
|
+
say_status(:commited, %(#{sha} #{message}))
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
This is the HTML template for <%= namespaced_name %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
angular.module('<%= namespaced_name %>').service('<%= name %>', [
|
4
|
+
'state',
|
5
|
+
'configurator',
|
6
|
+
function(state, configurator) {
|
7
|
+
var self = this;
|
8
|
+
|
9
|
+
function configure() {
|
10
|
+
configurator.getConfAndDelegate('<%= name %>', self);
|
11
|
+
}
|
12
|
+
|
13
|
+
configure();
|
14
|
+
|
15
|
+
this.init = function() {
|
16
|
+
configure();
|
17
|
+
};
|
18
|
+
}
|
19
|
+
]);
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
Coveralls.wear!
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
10
|
+
|
11
|
+
SimpleCov.start do
|
12
|
+
add_filter '/spec/'
|
13
|
+
end
|
14
|
+
|
15
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
16
|
+
require 'arethusa_plugin_generator'
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
20
|
+
config.run_all_when_everything_filtered = true
|
21
|
+
config.filter_run :focus
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: arethusa_plugin_generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- LFDM
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-27 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.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
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: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Generates a skeleton for an Arethusa plugin
|
84
|
+
email:
|
85
|
+
- 1986gh@gmail.com
|
86
|
+
executables:
|
87
|
+
- arethusa_plugin_generator
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- arethusa_plugin_generator.gemspec
|
99
|
+
- bin/arethusa_plugin_generator
|
100
|
+
- lib/arethusa_plugin_generator.rb
|
101
|
+
- lib/arethusa_plugin_generator/cli.rb
|
102
|
+
- lib/arethusa_plugin_generator/templates/html_template.tt
|
103
|
+
- lib/arethusa_plugin_generator/templates/module.tt
|
104
|
+
- lib/arethusa_plugin_generator/templates/service.tt
|
105
|
+
- lib/arethusa_plugin_generator/version.rb
|
106
|
+
- spec/lib/arethusa_plugin_generator_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
homepage: ''
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.2.2
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Generates a skeleton for an Arethusa plugin
|
132
|
+
test_files:
|
133
|
+
- spec/lib/arethusa_plugin_generator_spec.rb
|
134
|
+
- spec/spec_helper.rb
|