arethusa-cli 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00569634f1ab3c084d084f04b1a69831c041f58e
4
- data.tar.gz: 2ad0fd525633daa0b5a08338ad8cae25a77486da
3
+ metadata.gz: cf3fe6efd000c674f22e5a9df309516a978029dc
4
+ data.tar.gz: f4bd1cbad4ab82ed0b1af12e81cdf36c22008413
5
5
  SHA512:
6
- metadata.gz: 872094e3326c8ccdaa3a1f437826ce12705c756f37b6349696b6d552139899f5d0d2779a720e440b765262b46cd6ac76ce64b61b8b664583709a2694305d5ea7
7
- data.tar.gz: 00bc6daa7a58040615262a9354f01a80b4bd12813464c3a26bc76e77b3562915dcf09a335b79e767b05c3341d19e81e69d6d80f77711dbbfba79b3c354cb0fec
6
+ metadata.gz: 09baafa70abaa3ac6d61a8deb8b9359f78d992a14075f4c11397d08d4332fe6872bdd54c07b42297070dc97e375612cfb7f634cc9b07606f797c419be4d0b802
7
+ data.tar.gz: 3a04a90f36caa2082feba8c21662307da99ef2a7760f41a82e5dc050034e527d93a764c5585900a4914ea685b70b08f349f81af16730d08f825e9de61445b614
@@ -35,6 +35,21 @@ class Arethusa::CLI
35
35
  give_conf_instructions
36
36
  end
37
37
 
38
+ desc 'spec NAME', 'Generates a new spec file for an Arethusa plugin'
39
+ method_option :namespace, aliases: '-n', default: 'arethusa',
40
+ desc: 'Namespace of the new plugin'
41
+ method_option :commit, type: :boolean, aliases: '-c',
42
+ desc: 'Commit the skeleton with git'
43
+ def spec(name)
44
+ @name = name
45
+ @namespace = options[:namespace]
46
+
47
+ create_spec_file
48
+
49
+ commit_changes if options[:commit]
50
+ say_status(:success, "Created spec file for #{namespaced_name}")
51
+ end
52
+
38
53
  no_commands do
39
54
  def name(js = false)
40
55
  if js
@@ -83,6 +98,11 @@ class Arethusa::CLI
83
98
  template('templates/html_template.tt', html_template_file)
84
99
  end
85
100
 
101
+ def create_spec_file
102
+ empty_directory(spec_dir)
103
+ template('templates/plugin_spec.tt', spec_dir("#{name}_spec.js"))
104
+ end
105
+
86
106
  def add_module
87
107
  insert_into_file(arethusa_main, after: /arethusa\.core',\n/, force: false) do
88
108
  " '#{namespaced_name(true)}',\n"
@@ -152,8 +172,14 @@ It could look like this:
152
172
  File.join(destination_root, 'app/templates')
153
173
  end
154
174
 
155
- def commit_changes
156
- message = %{"Add skeleton for #{namespaced_name}"}
175
+ def spec_dir(file = '')
176
+ File.join(destination_root, 'spec', namespaced_name, file)
177
+ end
178
+
179
+ def commit_changes(spec = false)
180
+ sp = spec ? "spec " : ""
181
+
182
+ message = %{"Add #{sp}skeleton for #{namespaced_name}"}
157
183
  `git add -A`
158
184
  `git commit -m #{message}`
159
185
  sha = `git rev-parse --short HEAD`.chomp
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ describe('<%= name(true) %>', function() {
4
+ var <%= name(true) %>, state;
5
+
6
+ beforeEach(function() {
7
+ module("arethusa.core", function($provide) {
8
+ $provide.value('configurator', arethusaMocks.configurator());
9
+ });
10
+
11
+ module("<%= namespaced_name(true) %>");
12
+
13
+ inject(function(_<%= name(true) %>_, _state_) {
14
+ <%= name(true) %> = _<%= name(true) %>_;
15
+ state = _state_;
16
+ state.tokens = arethusaMocks.tokens();
17
+ });
18
+ });
19
+
20
+ // Write your specs here!
21
+ });
@@ -1,5 +1,5 @@
1
1
  module Arethusa
2
2
  class CLI
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arethusa-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - LFDM
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-17 00:00:00.000000000 Z
11
+ date: 2014-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -117,6 +117,7 @@ files:
117
117
  - lib/arethusa/cli/subcommand.rb
118
118
  - lib/arethusa/cli/templates/html_template.tt
119
119
  - lib/arethusa/cli/templates/module.tt
120
+ - lib/arethusa/cli/templates/plugin_spec.tt
120
121
  - lib/arethusa/cli/templates/service.tt
121
122
  - lib/arethusa/cli/transformer.rb
122
123
  - lib/arethusa/cli/version.rb