asker-tool 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db562740b610fc29b5dd47354892919aa3041bc383f8ff6c818421f7a6ec5654
4
- data.tar.gz: 9eab6c83ed23bbceb48ff54c6a1e29bfae0f2b1f0fe4ecf52a9b6d27f1d0df30
3
+ metadata.gz: 649acd19a295cc267a200754428f54c987a688cf6b81487d4ea0f2662bc4968a
4
+ data.tar.gz: bebb65797eefd45784b3a1db72d0f41c15ec6fca9e8792ca893670712fe425f3
5
5
  SHA512:
6
- metadata.gz: a9ef725d0968201216c953d237268bcbdbd96be1ffcb4888a9b4ab3a93150e69d4b97c37ec8bef16208efae484650ad5aad2acb74185ce2b913092e3eb1f2277
7
- data.tar.gz: 030dfc6afaece6e49b2f70401cadc7a2aba7bbdde2f2fc4cfa8e161128f541e1d7ba239ea312aa19c59c1e6ce9fb74ec355638bc0cfd430749740a0a0e7f476b
6
+ metadata.gz: 7aa8c6683ed5931197398b88d2651c06f99fa75f713643bbf04f6c31fbad900d2cdc08efc7ccc6f3ab255de04d6345e7a2751786e760444e91fda4cf84cac1eb
7
+ data.tar.gz: 3440de3f9bd77a4c0b3d0ce023ef76bf3335dfe555d52d7bea91b7a9148ac0804659803ae5bd662452801e8c1cbdabc6bfe114b9ec4e2a4d74b5b5d3cef3ef8d
@@ -3,13 +3,10 @@
3
3
 
4
4
  # Commands
5
5
 
6
- By now, ASKER run as CLI command.
7
-
8
- | Command | Description |
9
- | ----------------------- | ------------------------------- |
10
- | asker | Show available functions |
11
- | asker version | Show current version |
12
- | asker PATH/TO/INPUTFILE | Create questions for input file |
13
- | asker file PATH/TO/INPUTFILE | File keyword is optional |
14
- | asker check PATH/TO/INPUTFILE | Check HAML file syntax |
15
- | asker init | Create default config.ini file |
6
+ Running `asker` as CLI command with these available command functions:
7
+ * `asker`: Show available functions.
8
+ * `asker version`: Show current version.
9
+ * `asker PATH/TO/INPUTFILE`: Create questions for selected input file.
10
+ * `asker file PATH/TO/INPUTFILE`: It's the same as `asker PATH/TO/INPUTFILE`, because `file` keyword is optional.
11
+ * `asker check PATH/TO/INPUTFILE`: Check HAML file syntax.
12
+ * `asker init`: Create default config.ini file.
@@ -3,18 +3,18 @@
3
3
 
4
4
  # Installation
5
5
 
6
- * Installation process:
6
+ * **Install** Asker:
7
7
  1. Install Ruby on your system.
8
8
  2. `gem install asker-tool`
9
- * Run `asker version` to check that your installation is ok.
10
9
 
11
- > **PROBLEMS**: If you have problems to find `asker`command (OpenSUSE distro), try this:
10
+ Run `asker version` to check that your installation is ok.
11
+
12
+ > **FIND asker COMMAND**: If you have problems to find `asker`command (OpenSUSE distro), try this:
12
13
  > * `find / -name asker`, to find absolute path to teuton command.
13
14
  > * As superuser do `ln -s /PATH/TO/bin/asker /usr/local/bin/asker`, to create symbolic link to asker command.
14
- > * Try again as normal user.
15
15
 
16
- * **Update** Asker with `gem asker update`.
17
- * **Uninstall** Asker with `gem uninstall asker`
16
+ * **Update** Asker with `gem asker-tool update`.
17
+ * **Uninstall** Asker with `gem uninstall asker-tool`
18
18
 
19
19
  > Others ways to install Asker:
20
20
  > * [Installation scripts](scripts.md)
@@ -1,26 +1,38 @@
1
1
 
2
2
  [<< back](README.md)
3
3
 
4
- # Using installation scripts
4
+ # Installation scripts
5
5
 
6
- ## GNU/Linux installation script
6
+ ---
7
+ ## GNU/Linux
7
8
 
8
- Run as `root` user:
9
+ **Install**: Run as `root` user.
9
10
  ```
10
- wget -qO- https://raw.githubusercontent.com/dvarrui/asker/devel/install/linux_asker_install.sh | bash
11
+ wget -qO- https://raw.githubusercontent.com/dvarrui/asker/devel/install/linux/install_asker.sh | bash
11
12
  ```
12
13
 
13
14
  Run `asker version` as normal user.
14
15
 
15
- ## Windows installation script
16
+ **Uninstall**: Run as `root` user.
17
+ ```
18
+ wget -qO- https://raw.githubusercontent.com/dvarrui/asker/devel/install/linux/uninstall_asker.sh | bash
19
+ ```
20
+
21
+ ---
22
+ ## Windows
16
23
 
17
24
  Requirements:
18
25
  * Windows 7+ / Windows Server 2003+
19
26
  * PowerShell v2+
20
27
 
21
- Run this coomand as Administrator user on PowerShell (PS):
28
+ **Install**: Run this coomand as Administrator user on PowerShell (PS):
22
29
  ```
23
- Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/dvarrui/asker/davel/install/windows_asker_install.ps1'))
30
+ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/dvarrui/asker/devel/install/windows/install_asker.ps1'))
24
31
  ```
25
32
 
26
33
  Run `asker version` as normal user.
34
+
35
+ **Uninstall**: Run this coomand as Administrator user on PowerShell (PS):
36
+ ```
37
+ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/dvarrui/asker/devel/install/windows/uninstall_asker.ps1'))
38
+ ```
@@ -11,6 +11,7 @@ require_relative 'asker/exporter/main'
11
11
  require_relative 'asker/loader/project_loader'
12
12
  require_relative 'asker/loader/input_loader'
13
13
  require_relative 'asker/checker'
14
+ require_relative 'asker/skeleton'
14
15
 
15
16
  # This class does all the job
16
17
  # * start
@@ -67,6 +68,13 @@ class Asker
67
68
  Checker.check(filepath)
68
69
  end
69
70
 
71
+ ##
72
+ # Create asker input demo files
73
+ # @param dirpath (String)
74
+ def self.create_skeleton(dirpath)
75
+ Skeleton.create(dirpath)
76
+ end
77
+
70
78
  private
71
79
 
72
80
  def show_create_output_files
@@ -7,7 +7,7 @@ require 'inifile'
7
7
  class Application
8
8
  include Singleton
9
9
 
10
- VERSION = '2.1.2' # Application version
10
+ VERSION = '2.1.3' # Application version
11
11
  NAME = 'asker' # Application name
12
12
  GEM = 'asker-tool' # Gem name
13
13
  attr_reader :config
@@ -75,6 +75,16 @@ class CLI < Thor
75
75
  Asker.check(filename)
76
76
  end
77
77
 
78
+ map ['n', '-b', '--new', 'new'] => 'create_skeleton'
79
+ desc 'new', 'Create Asker demo input files'
80
+ ##
81
+ # Create Asker demo input files
82
+ # @param dirname (String) Path to folder
83
+ def create_skeleton(dirname)
84
+ # Asker start processing input file
85
+ Asker.create_skeleton(dirname)
86
+ end
87
+
78
88
  ##
79
89
  # This actions are equals:
80
90
  # * asker demo/foo.haml
File without changes
@@ -0,0 +1,13 @@
1
+ %map{ :lang => 'en', :context => 'list,of,words,to,define,context', :version => '1'}
2
+
3
+ %concept
4
+ %names Example1
5
+ %tags list,of,words,to,define,this,concept
6
+ %def Definition 1 of Example1
7
+ %table{ :fields => 'attribute, value'}
8
+ %row
9
+ %col attr1
10
+ %col value1
11
+ %row
12
+ %col attr2
13
+ %col value2
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'rainbow'
5
+
6
+ # Skeleton: create skeleton for asker input files
7
+ # * create
8
+ # * create_main_dir_and_files
9
+ # * create_dir
10
+ # * create_dirs
11
+ # * copyfile
12
+ module Skeleton
13
+ def self.create(dirpath)
14
+ puts "\n[INFO] Creating #{Rainbow(dirpath).bright} project skeleton"
15
+ create_dir dirpath
16
+ copy_files_into(dirpath)
17
+ end
18
+
19
+ def self.copy_files_into(project_dir)
20
+ # Directory and files: Ruby script, Configfile, gitignore
21
+ items = [
22
+ { source: 'files/example-concept.haml', target: 'example-concept.haml' }
23
+ # { source: 'files/example-code.haml', target: 'example-code.haml' },
24
+ ]
25
+ source_basedir = File.join(File.dirname(__FILE__))
26
+ items.each do |item|
27
+ source = File.join(source_basedir, item[:source])
28
+ target = File.join(project_dir, item[:target])
29
+ copyfile(source, target)
30
+ end
31
+ end
32
+
33
+ def self.create_dir(dirpath)
34
+ if Dir.exist? dirpath
35
+ puts "* Exists dir! => #{Rainbow(dirpath).yellow}"
36
+ else
37
+ begin
38
+ FileUtils.mkdir_p(dirpath)
39
+ puts "* Create dir => #{Rainbow(dirpath).green}"
40
+ rescue StandardError
41
+ puts "* Create dir ERROR => #{Rainbow(dirpath).red}"
42
+ end
43
+ end
44
+ end
45
+
46
+ def self.create_dirs(*args)
47
+ args.each { |arg| create_dir arg }
48
+ end
49
+
50
+ def self.copyfile(target, dest)
51
+ if File.exist? dest
52
+ puts "* Exists file! => #{Rainbow(dest).yellow}"
53
+ else
54
+ puts "* File not found! => #{Rainbow(target).yellow}" unless File.exist? target
55
+ begin
56
+ FileUtils.cp(target, dest)
57
+ puts "* Create file => #{Rainbow(dest).green}"
58
+ rescue StandardError
59
+ puts "* Create file ERROR => #{Rainbow(dest).red}"
60
+ end
61
+ end
62
+ end
63
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asker-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
@@ -216,6 +216,8 @@ files:
216
216
  - lib/asker/exporter/concept_screen_exporter.rb
217
217
  - lib/asker/exporter/main.rb
218
218
  - lib/asker/files/config.ini
219
+ - lib/asker/files/example-code.haml
220
+ - lib/asker/files/example-concept.haml
219
221
  - lib/asker/formatter/code_string_formatter.rb
220
222
  - lib/asker/formatter/concept_doc_formatter.rb
221
223
  - lib/asker/formatter/concept_string_formatter.rb
@@ -235,7 +237,8 @@ files:
235
237
  - lib/asker/loader/project_loader.rb
236
238
  - lib/asker/logger.rb
237
239
  - lib/asker/project.rb
238
- homepage: https://github.com/dvarrui/asker
240
+ - lib/asker/skeleton.rb
241
+ homepage: https://github.com/dvarrui/asker/blob/devel
239
242
  licenses:
240
243
  - GPL-3.0
241
244
  metadata: {}