opencode_theme 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: 676a4ee24704bc1ed3fce7f93f1fa52a59637d9b
4
- data.tar.gz: 70746d77d4f1431a0073e0853cb2d98ae8ecda0f
3
+ metadata.gz: 35774a3297513205a35dd5972c12259bfff66969
4
+ data.tar.gz: dcca8fa2c69c727fa6335530f4dae65384a85f22
5
5
  SHA512:
6
- metadata.gz: d42f8ed80761220ba1fa6e72e94d3a4aaeee7c8315c48605f23cdfbca6c891088076901041293aadee3e4636513a062d97717f3aea2bd7150b89f3dc9aaf53e1
7
- data.tar.gz: 3d4bc1299f1194450f048b62be893579be9c4f064e02fc9c36f9b5724aa0a592d010801f696a0a108ea94f89ce539bf438adfd1330f31d45e337f43f1e308bec
6
+ metadata.gz: f18f4f1d9871da2cc4381429a3412c5ab5020af66c40adbe3fff23beb1ef8fc7c700464d6521f0d51a042be4c74c9213f2276320c2a83881795aa6d8438e8cec
7
+ data.tar.gz: 902cfd164b5e3beacc5773cbbe954795c5929ffbb288c79ac7bb4e3e32ca254e9725c544a279bdc9f9423ca0edbe562b7959f668e36d8c0ea8148a9488d502d8
data/README.md CHANGED
@@ -1,29 +1,68 @@
1
- # OpencodeTheme
1
+ # Opencode Theme
2
+ [![RubyGems][gem_version_badge]][ruby_gems]
3
+ [![RubyGems][gem_downloads_badge]][ruby_gems]
2
4
 
3
- TODO: Write a gem description
5
+ Opencode Theme Command Line tool for developing themes in [TrayCommerce](https://github.com/tray-tecnologia).
6
+ ## Dependencies
7
+
8
+ * Ruby v2.1.3 or greater
4
9
 
5
10
  ## Installation
6
11
 
7
- Add this line to your application's Gemfile:
12
+ Install Opencode Theme from RubyGems with the command:
13
+
14
+ ```bash
15
+ $ gem install opencode_theme
16
+ ```
8
17
 
9
- gem 'opencode_theme'
18
+ or install from source with:
10
19
 
11
- And then execute:
20
+ ```bash
21
+ $ git clone https://github.com/tray-tecnologia/opencode_theme
22
+ cd opencode_theme
23
+ bundle install
24
+ bundle exec opencode -h
25
+ ```
12
26
 
13
- $ bundle
27
+ ## Usage
14
28
 
15
- Or install it yourself as:
29
+ Run:
16
30
 
17
- $ gem install opencode_theme
31
+ ```bash
32
+ $ opencode configure API_KEY PASSWORD THEME_ID
33
+ ```
18
34
 
19
- ## Usage
35
+ You can see more in `opencode -h`, and details here: [CLI Commands](http://dev.tray.com.br/hc/pt-br/articles/215996428-Comandos-da-GEM-OpenCode).
36
+
37
+ ## Versioning
38
+
39
+ Opencode Theme follows the [Semantic Versioning](http://semver.org/) standard.
40
+
41
+ ## Issues
20
42
 
21
- TODO: Write usage instructions here
43
+ If you have problems, see [ISSUES.md](https://github.com/tray-tecnologia/opencode_theme/blob/master/CONTRIBUTING.md) and please create a [Github Issue](https://github.com/tray-tecnologia/opencode_theme/issues).
22
44
 
23
45
  ## Contributing
24
46
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
47
+ Please see [CONTRIBUTING.md](https://github.com/tray-tecnologia/opencode_theme/blob/master/CONTRIBUTING.md) for details.
48
+
49
+ ## Release
50
+
51
+ Follow this steps to release a new version of the gem:
52
+
53
+ 1. Test if everything is running ok;
54
+ 2. Change version of the gem on `VERSION` constant;
55
+ 3. Add the release date on the `CHANGELOG`;
56
+ 4. Do a commit "vX.X.X", follow the semantic version;
57
+ 5. Run `$ rake release`, this will send the gem to the RubyGems;
58
+ 6. Check if the gem is on the RubyGems and the tags are correct on the github;
59
+
60
+ This gem was created and is maintained by [TrayCommerce](https://github.com/tray-tecnologia).
61
+
62
+ ![Tray-logo](https://avatars1.githubusercontent.com/u/3370163?v=3&s=220)
63
+
64
+
65
+ [tray_commerce]: http://www.tray.com.br
66
+ [gem_version_badge]: http://img.shields.io/gem/v/opencode_theme.svg?style=flat
67
+ [gem_downloads_badge]: http://img.shields.io/gem/dt/opencode_theme.svg?style=flat
68
+ [ruby_gems]: http://rubygems.org/gems/opencode_theme
@@ -10,7 +10,7 @@ require 'launchy'
10
10
  require 'mimemagic'
11
11
 
12
12
  MimeMagic.add('application/json', extensions: %w(json js), parents: 'text/plain')
13
- MimeMagic.add('application/x-pointplus', extensions: %w(scss), parents: 'text/css')
13
+ MimeMagic.add('application/x-pointplus', extensions: %w(scss styl), parents: 'text/css')
14
14
  MimeMagic.add('application/vnd.ms-fontobject', extensions: %w(eot), parents: 'font/opentype')
15
15
 
16
16
  module OpencodeTheme
@@ -87,7 +87,7 @@ module OpencodeTheme
87
87
  end
88
88
  end
89
89
 
90
- desc 'bootstrap API_KEY PASSWORD THEME_NAME THEME_BASE', 'Cria um novo tema com o nome informado'
90
+ desc 'new API_KEY PASSWORD THEME_NAME THEME_BASE', 'Cria um novo tema com o nome informado'
91
91
  method_option :master, type: :boolean, default: false
92
92
  def bootstrap(api_key = nil, password = nil, theme_name = 'default', theme_base = 'default')
93
93
  OpencodeTheme.config = { api_key: api_key, password: password }
@@ -160,7 +160,7 @@ module OpencodeTheme
160
160
  say('Done.', :green) unless options['quiet']
161
161
  end
162
162
 
163
- desc 'remove FILE', 'Remove um arquivo do tema (apenas se o tema nao estiver publicado)'
163
+ desc 'rm FILE', 'Remove um arquivo do tema (apenas se o tema nao estiver publicado)'
164
164
  method_option :quiet, type: :boolean, default: false
165
165
  def remove(*keys)
166
166
  keys.each do |key|
@@ -329,7 +329,7 @@ module OpencodeTheme
329
329
  def valid_name?(key)
330
330
  return if temporary_file?(key)
331
331
  name = key.split('/').last
332
- if name =~ /^[0-9a-zA-Z\-_.]+\.(ttf|eot|svg|woff|css|scss|html|js|jpg|gif|png|json|TTF|EOT|SVG|WOFF|CSS|SCSS|HTML|JS|PNG|GIF|JPG|JSON)$/
332
+ if name =~ /^[0-9a-zA-Z\-_.]+\.(ttf|eot|svg|woff|css|scss|styl|html|js|jpg|gif|png|json|TTF|EOT|SVG|WOFF|CSS|SCSS|STYL|HTML|JS|PNG|GIF|JPG|JSON)$/
333
333
  valid = true
334
334
  else
335
335
  response = {}
@@ -1,3 +1,3 @@
1
1
  module OpencodeTheme
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -5,17 +5,28 @@ describe OpencodeTheme::Cli, :functional do
5
5
  FILE_NAME = 'layouts/default.html'
6
6
  API_KEY = '11451c354c1f95fe60f80d7672bf184a'
7
7
  PASSWORD = '14ae838d9e971465af45b35803b8f0a4'
8
+ THEME_NAME = 'TA Test Theme'
8
9
 
9
10
  before(:all) do
10
11
  # clearing generated and downloaded files
11
12
  FileUtils.rm_rf 'config.yml' if File.exist?('config.yml')
12
- FileUtils.rm_rf 'default' if File.exist?('default')
13
+ FileUtils.rm_rf THEME_NAME if File.exist?('default')
13
14
  end
14
15
 
15
16
  after(:all) do
17
+ # deleting created theme
18
+ FileUtils.cd THEME_NAME
19
+ config = YAML.load_file 'config.yml'
20
+ res = OpencodeTheme.theme_delete(config[:theme_id])
21
+ if res[:success]
22
+ puts " deleted theme #{config[:theme_id]}"
23
+ else
24
+ puts " THEME #{config[:theme_id]} NOT DELETED! DELETE MANUALLY!"
25
+ end
26
+ FileUtils.cd '..'
16
27
  # clearing generated and downloaded files
17
28
  FileUtils.rm_rf 'config.yml'
18
- FileUtils.rm_rf 'default'
29
+ FileUtils.rm_rf THEME_NAME
19
30
  end
20
31
 
21
32
  context 'Invalid or Inexistent Configuration' do
@@ -68,12 +79,12 @@ describe OpencodeTheme::Cli, :functional do
68
79
 
69
80
  context 'Bootstrap' do
70
81
  it 'create new theme' do
71
- output = capture(:stdout) { subject.bootstrap API_KEY, PASSWORD }
82
+ output = capture(:stdout) { subject.bootstrap API_KEY, PASSWORD, THEME_NAME }
72
83
  FileUtils.cd '..'
73
84
  expect(output).to include 'Configuration [OK]'
74
- expect(output).to include 'Create default theme on store'
75
- expect(output).to include 'Saving configuration to default'
76
- expect(output).to include 'Downloading default assets from Opencode'
85
+ expect(output).to include "Create #{THEME_NAME} theme on store"
86
+ expect(output).to include "Saving configuration to #{THEME_NAME}"
87
+ expect(output).to include "Downloading #{THEME_NAME} assets from Opencode"
77
88
  expect(output).to include "Downloaded: #{FILE_NAME}"
78
89
  expect(output).to include 'Done.'
79
90
  end
@@ -90,8 +101,8 @@ describe OpencodeTheme::Cli, :functional do
90
101
 
91
102
  context 'Cleaning cache' do
92
103
  it 'cleans the cache' do
93
- expect(File.exist? 'default').to eq true
94
- FileUtils.cd 'default'
104
+ expect(File.exist? THEME_NAME).to eq true
105
+ FileUtils.cd THEME_NAME
95
106
  output = capture(:stdout) { subject.clean }
96
107
  FileUtils.cd '..'
97
108
  expect(output).to include 'Clean cache [OK]'
@@ -100,8 +111,8 @@ describe OpencodeTheme::Cli, :functional do
100
111
 
101
112
  context 'Download' do
102
113
  it 'downloads all files' do
103
- expect(File.exist? 'default').to eq true
104
- FileUtils.cd 'default'
114
+ expect(File.exist? THEME_NAME).to eq true
115
+ FileUtils.cd THEME_NAME
105
116
  output = capture(:stdout) { subject.download }
106
117
  FileUtils.cd '..'
107
118
  expect(output).to include 'Downloaded'
@@ -112,8 +123,8 @@ describe OpencodeTheme::Cli, :functional do
112
123
  end
113
124
 
114
125
  it 'downloads a single file' do
115
- expect(File.exist? 'default').to eq true
116
- FileUtils.cd 'default'
126
+ expect(File.exist? THEME_NAME).to eq true
127
+ FileUtils.cd THEME_NAME
117
128
  output = capture(:stdout) { subject.download FILE_NAME }
118
129
  FileUtils.cd '..'
119
130
  expect(output).to include "Downloaded: #{FILE_NAME}"
@@ -124,8 +135,8 @@ describe OpencodeTheme::Cli, :functional do
124
135
 
125
136
  context 'Upload' do
126
137
  it 'uploads all files' do
127
- expect(File.exist? 'default').to eq true
128
- FileUtils.cd 'default'
138
+ expect(File.exist? THEME_NAME).to eq true
139
+ FileUtils.cd THEME_NAME
129
140
 
130
141
  output = capture(:stdout) { subject.upload }
131
142
  FileUtils.cd '..'
@@ -135,8 +146,8 @@ describe OpencodeTheme::Cli, :functional do
135
146
  end
136
147
 
137
148
  it 'uploads a single file' do
138
- expect(File.exist? 'default').to eq true
139
- FileUtils.cd 'default'
149
+ expect(File.exist? THEME_NAME).to eq true
150
+ FileUtils.cd THEME_NAME
140
151
  output = capture(:stdout) { subject.upload FILE_NAME }
141
152
  FileUtils.cd '..'
142
153
  expect(output).to include "File uploaded: #{FILE_NAME}"
@@ -157,14 +168,14 @@ describe OpencodeTheme::Cli, :functional do
157
168
  let(:output) { capture(:stdout) { subject.help } }
158
169
  it 'displays help about each command' do
159
170
  expect(output).to include 'Commands:'
160
- expect(output).to include 'bootstrap API_KEY PASSWORD THEME_NAME THEME_BASE'
171
+ expect(output).to include 'new API_KEY PASSWORD THEME_NAME THEME_BASE'
161
172
  expect(output).to include 'clean'
162
173
  expect(output).to include 'configure API_KEY PASSWORD THEME_ID'
163
174
  expect(output).to include 'download FILE'
164
175
  expect(output).to include 'help [COMMAND]'
165
176
  expect(output).to include 'list'
166
177
  expect(output).to include 'open'
167
- expect(output).to include 'remove FILE'
178
+ expect(output).to include 'rm FILE'
168
179
  expect(output).to include 'systeminfo'
169
180
  expect(output).to include 'upload FILE'
170
181
  expect(output).to include 'watch'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opencode_theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Takashi Tanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor