chid 0.1.6 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-gemset +1 -0
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +27 -0
  5. data/CONTRIBUTING.md +78 -0
  6. data/Gemfile.lock +34 -34
  7. data/README.md +135 -89
  8. data/bin/chid +2 -25
  9. data/chid.gemspec +0 -6
  10. data/lib/chid.rb +0 -66
  11. data/lib/chid/chid_config.rb +6 -83
  12. data/lib/chid/command.rb +1 -1
  13. data/lib/chid/commands/alias/create.rb +53 -0
  14. data/lib/chid/commands/config.rb +48 -0
  15. data/lib/chid/commands/currency/convert.rb +50 -0
  16. data/lib/chid/commands/currency/list.rb +34 -0
  17. data/lib/chid/commands/currency/now.rb +47 -0
  18. data/lib/chid/commands/gitflow/commit.rb +0 -1
  19. data/lib/chid/commands/github.rb +40 -0
  20. data/lib/chid/commands/init.rb +1 -2
  21. data/lib/chid/commands/install.rb +1 -0
  22. data/lib/chid/commands/installs/dotfile.rb +27 -11
  23. data/lib/chid/commands/installs/node.rb +5 -3
  24. data/lib/chid/commands/installs/postgres.rb +6 -3
  25. data/lib/chid/commands/installs/rvm.rb +9 -4
  26. data/lib/chid/commands/installs/vim.rb +69 -0
  27. data/lib/chid/commands/pr.rb +63 -0
  28. data/lib/chid/commands/tmux/open.rb +3 -2
  29. data/lib/chid/commands/workstation/create.rb +101 -0
  30. data/lib/chid/commands/workstation/destroy.rb +61 -0
  31. data/lib/chid/commands/workstation/open.rb +4 -4
  32. data/lib/chid/github_api.rb +9 -0
  33. data/lib/chid/version.rb +1 -1
  34. data/spec/lib/chid/commands/alias/create_spec.rb +55 -0
  35. data/spec/lib/chid/commands/init_spec.rb +4 -2
  36. data/spec/lib/chid/commands/pr_spec.rb +68 -0
  37. data/spec/lib/chid/commands/workstation/create_spec.rb +153 -0
  38. data/spec/support/.bashrc +7 -0
  39. data/spec/support/.chid.config +7 -0
  40. data/tasks/install/yadr_dotfiles.rake +1 -0
  41. data/tasks/run/postgres.rake +1 -0
  42. data/tasks/update/os.rake +1 -0
  43. metadata +21 -58
  44. data/#README.md# +0 -221
  45. data/Rakefile +0 -18
  46. data/lib/chid/yandex_translate_api.rb +0 -39
  47. data/tasks/chid/config.rake +0 -5
  48. data/tasks/chid/init.rake +0 -19
  49. data/tasks/chid/install.rake +0 -14
  50. data/tasks/chid/start.rake +0 -26
  51. data/tasks/chid/update.rake +0 -14
  52. data/tasks/currency/convert.rake +0 -9
  53. data/tasks/currency/current.rake +0 -11
  54. data/tasks/currency/list.rake +0 -10
  55. data/tasks/github.rake +0 -12
  56. data/tasks/help.rake +0 -178
  57. data/tasks/install/node.rake +0 -18
  58. data/tasks/install/postgres.rake +0 -18
  59. data/tasks/install/rvm.rake +0 -21
  60. data/tasks/news.rake +0 -11
  61. data/tasks/stack_overflow.rake +0 -20
  62. data/tasks/tmux/config_windows.rake +0 -8
  63. data/tasks/tmux/new_session.rake +0 -9
  64. data/tasks/translate/yandex_list.rake +0 -7
  65. data/tasks/translate/yandex_translate.rake +0 -8
  66. data/tasks/workstation/create.rake +0 -23
  67. data/tasks/workstation/destroy.rake +0 -14
  68. data/tasks/workstation/list.rake +0 -10
  69. data/tasks/workstation/open.rake +0 -29
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rachid Calazans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-06 00:00:00.000000000 Z
11
+ date: 2020-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
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
41
  - !ruby/object:Gem::Dependency
56
42
  name: http
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +66,6 @@ dependencies:
80
66
  - - ">="
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: easy_translate
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
69
  description: Chid is an assistant to help your day-to-day life. It can be used in
98
70
  some installations, news, configurations, workstations and more.
99
71
  email:
@@ -103,29 +75,40 @@ executables:
103
75
  extensions: []
104
76
  extra_rdoc_files: []
105
77
  files:
106
- - "#README.md#"
78
+ - ".ruby-gemset"
79
+ - ".ruby-version"
107
80
  - CHANGELOG.md
81
+ - CONTRIBUTING.md
108
82
  - Gemfile
109
83
  - Gemfile.lock
110
84
  - README.md
111
- - Rakefile
112
85
  - bin/chid
113
86
  - chid.gemspec
114
87
  - etc/img/stack.png
115
88
  - lib/chid.rb
116
89
  - lib/chid/chid_config.rb
117
90
  - lib/chid/command.rb
91
+ - lib/chid/commands/alias/create.rb
92
+ - lib/chid/commands/config.rb
93
+ - lib/chid/commands/currency/convert.rb
94
+ - lib/chid/commands/currency/list.rb
95
+ - lib/chid/commands/currency/now.rb
118
96
  - lib/chid/commands/gitflow/commit.rb
97
+ - lib/chid/commands/github.rb
119
98
  - lib/chid/commands/init.rb
120
99
  - lib/chid/commands/install.rb
121
100
  - lib/chid/commands/installs/dotfile.rb
122
101
  - lib/chid/commands/installs/node.rb
123
102
  - lib/chid/commands/installs/postgres.rb
124
103
  - lib/chid/commands/installs/rvm.rb
104
+ - lib/chid/commands/installs/vim.rb
125
105
  - lib/chid/commands/news.rb
106
+ - lib/chid/commands/pr.rb
126
107
  - lib/chid/commands/stack_overflow.rb
127
108
  - lib/chid/commands/tmux/list.rb
128
109
  - lib/chid/commands/tmux/open.rb
110
+ - lib/chid/commands/workstation/create.rb
111
+ - lib/chid/commands/workstation/destroy.rb
129
112
  - lib/chid/commands/workstation/list.rb
130
113
  - lib/chid/commands/workstation/open.rb
131
114
  - lib/chid/currency_api.rb
@@ -135,37 +118,18 @@ files:
135
118
  - lib/chid/paginator.rb
136
119
  - lib/chid/stack_overflow_api.rb
137
120
  - lib/chid/version.rb
138
- - lib/chid/yandex_translate_api.rb
139
121
  - spec/lib/chid/command_spec.rb
122
+ - spec/lib/chid/commands/alias/create_spec.rb
140
123
  - spec/lib/chid/commands/init_spec.rb
124
+ - spec/lib/chid/commands/pr_spec.rb
125
+ - spec/lib/chid/commands/workstation/create_spec.rb
141
126
  - spec/lib/chid/commands/workstation/open_spec.rb
142
127
  - spec/spec_helper.rb
143
- - tasks/chid/config.rake
144
- - tasks/chid/init.rake
145
- - tasks/chid/install.rake
146
- - tasks/chid/start.rake
147
- - tasks/chid/update.rake
148
- - tasks/currency/convert.rake
149
- - tasks/currency/current.rake
150
- - tasks/currency/list.rake
151
- - tasks/github.rake
152
- - tasks/help.rake
153
- - tasks/install/node.rake
154
- - tasks/install/postgres.rake
155
- - tasks/install/rvm.rake
128
+ - spec/support/.bashrc
129
+ - spec/support/.chid.config
156
130
  - tasks/install/yadr_dotfiles.rake
157
- - tasks/news.rake
158
131
  - tasks/run/postgres.rake
159
- - tasks/stack_overflow.rake
160
- - tasks/tmux/config_windows.rake
161
- - tasks/tmux/new_session.rake
162
- - tasks/translate/yandex_list.rake
163
- - tasks/translate/yandex_translate.rake
164
132
  - tasks/update/os.rake
165
- - tasks/workstation/create.rake
166
- - tasks/workstation/destroy.rake
167
- - tasks/workstation/list.rake
168
- - tasks/workstation/open.rake
169
133
  homepage: https://github.com/rachidcalazans/chid
170
134
  licenses:
171
135
  - MIT
@@ -186,8 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
150
  - !ruby/object:Gem::Version
187
151
  version: '0'
188
152
  requirements: []
189
- rubyforge_project:
190
- rubygems_version: 2.7.3
153
+ rubygems_version: 3.0.8
191
154
  signing_key:
192
155
  specification_version: 4
193
156
  summary: Simple assistant for day-to-day life. Developers and common users
@@ -1,221 +0,0 @@
1
- # Chid
2
- Chid is an assistant to help your day-to-day life. It can be used in some
3
- installations, news, configurations, workstations and more.
4
-
5
- ![](http://g.recordit.co/pKS2oKCUuU.gif)
6
-
7
- ## Installation
8
-
9
- To get started follow those steps:
10
-
11
- 1- Clone the project:
12
-
13
- ```bash
14
- git clone https://github.com/rachidcalazans/chid.git
15
- ```
16
-
17
- : 2- Install the dependcy if you do not have already installed:
18
-
19
- ```bash
20
- $ gem install bundler
21
- $ bundle install
22
- ```
23
-
24
- 3- Inside the folder project run:
25
-
26
- ```bash
27
- $ rake init
28
- ```
29
-
30
- **Note:** Chid will automatically install a *.chid.config* file and create an
31
- alias on your **.bashrc** or **.zshrc** (if you have zsh installed). After the
32
- installation **Chid** will give you the *bash command* to reload your **sources**
33
- file.
34
-
35
- ## Upgrading
36
-
37
- To update the chid is easy.
38
-
39
- ```bash
40
- $ chid update
41
- ```
42
-
43
- ## Usage
44
-
45
- **Chid** is an app based on **Rake Tasks**. You are available to use all features
46
- as rake tasks or run as a **terminal app**:
47
-
48
- **Note:** All tasks are available for **osx** and **linux**. The *chid* will automatically
49
- knows how run the specific **comand** for each plataform.
50
-
51
- All features are listed bellow:
52
-
53
- #### Install chid configuration
54
-
55
- * `$ chid init` - Will install all necessary confiuration.
56
-
57
- #### Start the app
58
-
59
- * `$ chid` - To start the **chid** terminal app
60
-
61
- **Note:** To run the commands listed bellow you must started the chid app.
62
-
63
- #### Help
64
-
65
- * `help` or `:h` - Show all tasks available
66
-
67
- #### Quit
68
-
69
- * `:q` or `quit` or `bye` or `exit` - Will finish the **chid** app
70
-
71
- #### Currency
72
-
73
- * `current` - Get the current conversion for USD to BRL amount
74
- * `currency list` - Show all types of currencies available to convert
75
- * `convert [amount] [type_from] to [type_to]` - You can convert an amount between
76
- types. Eg.: **convert 10 USD to BRL**
77
-
78
- #### Install apps
79
-
80
- **Note:** All install tasks, chid will always ask if you really want to install it. Also
81
- will install the dependencies if necessary.
82
-
83
- * `install dotfiles` - Install [YADR Dotfiles](https://github.com/skwp/dotfiles)
84
- * `install node` - Install Node
85
- * `install postgres` - Install Postgres
86
- * `install rvm` - Install stable RVM version
87
-
88
- #### Run
89
-
90
- * `run postgres` - Run the postgresql if you already have installed.
91
-
92
- #### Update
93
-
94
- * `update os` or `update` - Will update the linux os. For osx is not available
95
-
96
- #### News
97
-
98
- * `news` - Will show all news from some sites. BBC news, CNN, Espn,
99
- Mashable, Google, Techcrunch, Reddit
100
-
101
- #### Translate
102
-
103
- * `t [TEXT]` or `t [TEXT] [FROM] to [TO]` - Will translate the given text. By
104
- default the **from** is **en** and **to** is **pt**
105
-
106
- Example:
107
- `t hello world` or `t hello world en to pt`
108
-
109
- #### Search on StackOverflow
110
-
111
- A simple search in StackOverflow
112
-
113
- * `stack [TEXT_TO_SEACH]` - Will search on StackOverflow all results for that
114
- text.
115
-
116
- * `stack` - Will ask what you want to search on StackOverflow all results for that
117
-
118
- <p align="left">
119
- <img src="etc/img/stack.png" alt="stack sample" />
120
- </p>
121
-
122
- #### Search GitHub repositories
123
-
124
- A simple search for repository name
125
-
126
- * `github [SEARCH_EXPRESSION]` - Show results for expression paginated every 10
127
-
128
- #### Workstations
129
-
130
- Workstations are a way to make it easy for you to open a set of applications by
131
- simple commands.
132
-
133
- The set of configurations are saved on **.chid.config** file.
134
-
135
- **Note:** All commands bellow is possible run with prefix: `workstation [command]`
136
- or `work [command]`.
137
-
138
- * `work list` - List all workstations
139
- * `work create` - Create a new workstation. Chid will ask for a name to set the
140
- new workstation and after that will list all **applications** available on your
141
- system to chosse witch one you wanna add
142
- * `work destroy` - Chid will ask which workstation you want to destroy and chid
143
- will destroy it after choose
144
- * `work open` - Open a specific workstation. Chid will list all workstations to
145
- choose one of them to open all applications
146
- * `work open [workstation_name]` - Open a specific workstation without choose
147
- from a list. Eg.: `work open base` - It will open all applications inside the
148
- **base** workstation
149
-
150
- ![](http://g.recordit.co/WFqNuxORRd.gif)
151
-
152
- **Note:** For linux users the **work create** is not working. You need create
153
- manually (editing the .chid.config file). Will be explained how on
154
- **How configure and customize your workstations** topic
155
-
156
- #### Chid configuration
157
-
158
- * `chid config` or `config` - Open the **.chid.config** file
159
-
160
- ## How configure and customize your workstations
161
-
162
- The chid configuration file is installed on **~/.chid.config**. You can open: `$ chid
163
- chid_config`
164
-
165
- Chid config is a **YAML** file.
166
-
167
- You can create the workstations just adding on :workstations: key.
168
-
169
- The initial chid config file will be like:
170
-
171
- ```YAML
172
- ---
173
- :chid:
174
- :chid_path: "[CHID_FOLDER_PROJECT_PATH]"
175
- :workstations: {}
176
- ```
177
-
178
- #### Base configuration
179
-
180
- To add a new *workstation* you can edit like:
181
-
182
- ```YAML
183
- ---
184
- :chid:
185
- :chid_path: "[CHID_FOLDER_PROJECT_PATH]"
186
- :workstations:
187
- :base: # Workstation Name
188
- - iTerm #Application Name
189
- - Safari
190
- - Slack
191
- ```
192
-
193
- After edit you can open the **base** workstation running:
194
-
195
- * `$ chid workstation:open['base']` - As rake task
196
- * `work open base` - With the **chid** app running
197
-
198
- ![](http://g.recordit.co/VqTjUsQ9fy.gif)
199
-
200
- #### Advance configuration
201
-
202
- Is possible you can customize some options with each Application when will open it
203
-
204
- - Open the Terminal in a specific folder
205
- - Open a Safari with a specific URL
206
- - Any options which your application can use
207
-
208
- ```YAML
209
- ---
210
- :chid:
211
- :chid_path: "[CHID_FOLDER_PROJECT_PATH]"
212
- :workstations:
213
- :base: # Workstation Name
214
- - iTerm ~/Workspaces/rake-workspace/chid/ & rake tmux_config # Will open
215
- # in a specific folder and will run some Rake Task
216
- - Safari https://github.com/rachidcalazans/chid # Will open the Safari
217
- # in a specific URL
218
- ```
219
-
220
- ![](http://g.recordit.co/40rFYBBR1t.gif)
221
-
data/Rakefile DELETED
@@ -1,18 +0,0 @@
1
- #require 'chid'
2
- # Require all files inside the lib folder only
3
- #%w(lib).each do |inc|
4
- # dir = File.join(File.dirname(__FILE__), inc)
5
- # glob = Dir.glob(dir + "/*.rb")
6
- # glob.each { |r| require r }
7
- #end
8
- #
9
- # Load all rake tasks inside the tasks folder
10
- #dir = File.join(File.dirname(__FILE__), 'tasks')
11
- #glob = Dir.glob(dir + "/**/*.rake")
12
- #glob.each { |r| load r }
13
-
14
-
15
- # Initialize the default variable to use on all rake tasks
16
- #@chid_config = ChidConfig.new
17
-
18
- task :default => :chid
@@ -1,39 +0,0 @@
1
- class YandexTranslateApi
2
- API_TOKEN = 'trnsl.1.1.20170318T165136Z.005f29f713d3e410.1d52e55d7e9a3f125e38645215a101e743b16b98'
3
-
4
- def self.translate(options = {})
5
- text = options.fetch(:text, "")
6
- from = options.fetch(:from, :en).to_sym
7
- to = options.fetch(:to, :pt).to_sym
8
-
9
- uri = URI("https://translate.yandex.net/api/v1.5/tr.json/translate?lang=#{from}-#{to}&key=#{API_TOKEN}&text=#{text}")
10
-
11
- response = HTTP.get(uri)
12
- json = JSON.parse response
13
- json['text'].first
14
- end
15
-
16
- def self.list
17
- puts "Language Code Language Code".green
18
- puts "Azerbaijan az Maltese mt"
19
- puts "Albanian sq Macedonian mk"
20
- puts "Amharic am Maori mi"
21
- puts "English en Marathi mr"
22
- puts "Armenian hy Mongolian mn"
23
- puts "Afrikaans af German de"
24
- puts "Bashkir ba Norwegian no"
25
- puts "Bulgarian bg Persian fa"
26
- puts "Bosnian bs Polish pl"
27
- puts "Welsh cy Portuguese pt"
28
- puts "Vietnamese vi Russian ru"
29
- puts "Italian it Telugu te"
30
- puts "Spanish es Udmurt udm"
31
- puts "Chinese zh French fr"
32
- puts "Xhosa xh Croatian hr"
33
- puts "Latin la Czech cs"
34
- puts "Latvian lv Swedish sv"
35
- puts "Lithuanian lt Scottish gd"
36
- puts "Luxembourgish lb Estonian et"
37
- end
38
-
39
- end
@@ -1,5 +0,0 @@
1
- desc 'Open the .chid.config file'
2
- task :chid_config do
3
- puts "\nOpening the .chid.config..."
4
- system("vim #{@chid_config.chid_config_path}")
5
- end
@@ -1,19 +0,0 @@
1
- desc 'Initial configuration for Chid app'
2
- task :init do
3
- print "Chid is an assistant to help your day-to-day life.\n\n"
4
- print "You can use it as "
5
- print "a terminal App ".green
6
- print "or through "
7
- print "Rake Tasks".green
8
- print", having a greater interaction with it.\n\n"
9
-
10
- print "To initialize the app you can run the command: "
11
- print "$ rake\n".blue
12
- print "Or the command: "
13
- print "$ chid\n".blue
14
- print "But the command "
15
- print "$ chid ".blue
16
- print "will work after you reload your profile\n"
17
-
18
- @chid_config.configure
19
- end